0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

p-value of non significant results #240

Closed LeSensduMouvement closed 10 months ago

LeSensduMouvement commented 1 year ago

Hello, I'm currentely using SPM1D package with Python, performing several paired t-tests with my data. I would like to include p-values of non significant results to my results discussion, as it is possible with 0D statistics. Although I can find p-values of significant results, I couldn't find it for non significant results. I was wondering if I missed something or if in SPM, p-value of non significant results weren't available or pointless. Maybe could you advise me more relevant data from SPM analysis to discuss non significant results?

Thank you!

0todd0000 commented 1 year ago

Please refer to issues #222 and #191 for relevant discussions.

To summarize those discussions:

ShengxingFu commented 1 year ago

Hello, I used One-dimensional SPM two-way ANOVA with repeated measures on one factor to assess differences between groups across times. However, there was no significant interaction effect of group and time or group effect. I would like to include a specific P-value of the non-significant interaction effect of group and time or non-significant group effect in my study. Could you tell me how to calculate the P-value?

Thank you very much!

0todd0000 commented 1 year ago

Provided you have used parametric inference, please use rft1d.t.sf to calculate p-values for specific test statistic values. BUT note that these p-values may not be accurate when they are large (e.g. p>0.4).

Below is a modification of the anova2 example script

import spm1d

def pmax_f(spm):
    from spm1d import rft1d
    zmax = spm.z.max()  # maximum test statistic value
    df   = spm.df       # degrees of freedom
    Q    = spm.Q        # number of domain nodes
    fwhm = spm.fwhm     # smoothness estimate
    p    = rft1d.f.sf(zmax, df, Q, fwhm)  # RFT survival function
    return p

dataset = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_2x3()
y,A,B   = dataset.get_data()
spms    = spm1d.stats.anova2(y, A, B, equal_var=True).inference(0.05)
pmax    = [pmax_f(spm)  for spm in spms]
print( pmax )



This yields the result:

[0.3677, 0.009, 0.3114]

These are p-values for the maximum F-values from each of the anova2 effects.

ShengxingFu commented 1 year ago

Hello, Thanks for your help. However, there are many rft1d codes in the downloaded MATLAB source code from https://spm1d.org/index.html#. Which is the related rft1d code? image

0todd0000 commented 1 year ago

rft1d.f is appropriate for ANOVA. "f" means the "F statistic".