0todd0000 / spm1d

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

Y-axis normalized data #202

Closed GabriellaSelena closed 2 years ago

GabriellaSelena commented 2 years ago

Hello!! I am a PhD student working on gait analysis of dogs. Since dogs are fairly variable in size and shape, it is common practice to normalize waveforms along the y-axis in addition to time normalization, to reduce the variability between dogs. To do this we calculate a grand mean by subtracting an individual's mean value at each time point from the groups mean (Y0 -YA) then add this factor to each time point for every trial.

I wanted to see how SPM responded to grand mean normalized data and I am fairly confused by the result.

Pre-normalized Screen Shot 2021-11-29 at 12 17 44 PM

Normalized SPM_ALL Results

Any thoughts would be greatly appreciated. Thanks so much, Gabriella

0todd0000 commented 2 years ago

Hi Gabriella, The post-normalization F values are extremely large (10^30), indicating that variance is close to zero. This suggests that the normalization procedure may be inappropriate. Todd

GabriellaSelena commented 2 years ago

Thanks Todd, this makes sense.

Follow up question: at least in canine gait analysis it can be common to see waveforms that are shifted vertically, but that aren't apparently different. Example: image_2022-01-05_174501 SPM results on the data above Elbow SPM_RM_nonparaANOVA jpg

From my playing around with SPM, it seems like it is sensitive to considering these shifts as significant- but I'm really trying to gauge how similar the waveforms are to each other. I guess I am wondering if SPM is the best fit, or if I've misinterpreted how SPM works.

0todd0000 commented 2 years ago

For ANOVA, SPM tests the null hypothesis of equivalent means, so if the means are very different (even if simply shifted), the results will generally be significant.

The only way to change this behavior in classical ANOVA is to make the means more similar. For example: subtract the group's grand mean value from each observation in that group. This will vertically shift all observations so that the 1D group means all have mean values (across time) of zero.

GabriellaSelena commented 2 years ago

Got it! I tried this and it indeed worked. Thank you so much!

Final question, unrelated: when doing post-hoc t-tests should one load each observation or just the mean for each subject?

Thanks again for all of your help!

0todd0000 commented 2 years ago

Common post hoc analyses use all observations. To see why, imagine ANOVA with just two groups. This is equivalent to a two-sample test; both use all observations.

More generally, post hoc analyses can include any and all kinds of analyses, so you could indeed consider just the means if you like. But the usual post hoc procedures --- which generally replicate the main ANOVA results --- do indeed consider all observations.

GabriellaSelena commented 2 years ago

Ah- Again this makes sense. Thank you again and again :)

0todd0000 commented 2 years ago

No problem! I'll close this issue for now, but please feel free to re-open it or create a new issue if anything else comes up.