0todd0000 / spm1d

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

Question regarding ttest2 #227

Closed hanj321 closed 1 year ago

hanj321 commented 1 year ago

Hi everyone,

I was trying to apply SPM1D for my gait analysis and wanted to ask a question regarding data preparation.

Currently, I have gait cycle data from Group A and Group B. Group A is considered as novices group and Group B is considered as experts group. Unfortunately, I have unbalanced experimental design in which Group A data was collected three times (each with several hours apart) and Group B data was only collected once. My interest is to see if over time, the gait pattern of Group A became similar to Group B.

Because it is unbalanced repeated measures, I plan to just perform two sample t-test between each of the Group A data collected in time period (i.e., session) with that of Group B data. I have small sample sizes for each group (6 for Group A and 5 for Group B), but for each participants, they have around 10-15 trials.

My question is when I perform a two-sample t-test (ttest2) between each session of Group A and that of Group B, do I have to take a summary gait cycle of each participant (mean) first and use that to compare difference between two groups? In other words mean of mean, or is it possible to use the whole set of gait cycles in one session of Group A and that of Group B to do ttest2? This might be a very basic stat question, but was not sure about it because it seems to affect the SPM results significantly.

Also, I would appreciate if there are other alternatives in SPM analysis that can applied to my study design.

Thank you.

0todd0000 commented 1 year ago

My question is when I perform a two-sample t-test (ttest2) between each session of Group A and that of Group B, do I have to take a summary gait cycle of each participant (mean) first and use that to compare difference between two groups?

Yes, for a two-sample t test. Each observation is regarded as independent, so if you have n subjects who each perform m trials then submit all nm trials for analysis, it would incorrectly appear to the analysis procedure that there are nm separate subjects. The reason it affects results is because the sample size is very different. As the sample size increases the critical threshold decreases, and since nm is much greater than n the threshold will be incorrectly much lower for the nm case. This is true not only for SPM procedures but for all statistical procedures including those in standard software packages like SPSS.

hanj321 commented 1 year ago

Thank you Dr. Pataky for a detailed response. Based on what I searched, the SPM1D also provides repeated one-way ANOVA, but it has to be a balanced design. So if I have 5 subjects in Group A and 6 subjects in Group B, does that mean I can't implement repeated one-way ANOVA SPM for my design even though I have same number of responses per subject?

Thank you.

0todd0000 commented 1 year ago

If the number of subjects is unequal across the different factor levels then it is possible that it is not a repeated-measures (RM) design. RM designs require that each subject is measured across each level. If indeed it is not an RM design then you can use normal (non-RM) one-way ANOVA. spm1d offers preliminary support for unequal group sizes for one-way ANOVA so there should be no problem executing the procedure.

hanj321 commented 1 year ago

Thank you Dr. Pataky. So just to be clear on the analysis, when you suggest to use the one-way ANOVA, I should also use the summary measure of each participant, because it is not non-RM ANOVA right? I tried doing RM ANOVA because I wanted to take account the individual variability when comparing the gait pattern differences in two groups (Group A and B).

I have unequal number of participants in each group (5 and 6), but all subject has equal number of responses across each level. So there are 6 gait cycles for each participant and there are two groups of participants. With such study design, is there a recommended analysis for SPM? I'm a little confused here and would appreciate any help.

hanj321 commented 1 year ago

Dr. Pataky, I think I figured this out actually. I tried using the two-way ANOVA with repeated-measures on one factor. The two factors are my Group and number of gait cycles, but only the gait cycles are repeated.

0todd0000 commented 1 year ago

OK, thank you for confirming! I'm closing this now, please feel free to create a new issue if anything comes up.