0todd0000 / spm1d

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

Dataframe preparation for spm 1D two and three way repeated measures. #16

Closed bernard-liew closed 9 years ago

bernard-liew commented 9 years ago

Dear Todd,

I don't think I could find examples of dataframe preparation to 1D 2 and 3 way repeated measures ANOVA. Maybe I can give a context using my study design. I have 20 subjects performing gait over 2 repeated factors LOAD (0,10,20kg) and SPEED (1,2,3m/s), thus 9 combinations. I want to measure joint power normalised to 101 points. My thoughts:

1) create one data frame of 180 x 101 array. The first 9 rows represent first subject... etc.. 2) for each subject arrange the rows in order of load/speed combination e.g. (0/1,0/2,0/3,...20/1,20/2,20/3) or vice -versa speed/load. 3) Create another 180 x 1 array listing the order of load (A) 4) create 180 x 1 array listing the order of speed (B) 5) create 180 x 1 array of SUBJ..

Is that right?

Regards, Bernard

0todd0000 commented 9 years ago

Hi Bernard, That sounds right, I think that organization will work. Your design sounds a like two-way repeated measures ANOVA (i.e. repeated measures on both LOAD and SPEED), so I think the function you'll want is: spm1d.stats.anova2rm

Indeed there aren't yet any 1D examples for many of the ANOVA designs, but you can follow the 0D examples like this one: ./examples/stats0d/anova3onerm.py Conducting 1D analysis is almost exactly the same as these 0D examples. The only difference is that the dependent variable Y is (J x 1) and (J x Q) in the 0D and 1D cases, respectively. The other variables (A, B, C, SUBJ) are identical for 0D and 1D analysis.

Todd