0todd0000 / spm1d

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

conducting three-way ANOVA unequal group sizes #159

Closed MKeller96 closed 3 years ago

MKeller96 commented 3 years ago

Hi todd,

I would like to conduct a three-way ANOVA (6x2x2) with one RM factor using; spm1d.stats.anova3onerm(Y, A, B, C, SUBJ). Sadly I get an error saying ''Design must be balanced.'' The SPM1d documentation (Matlab) says that unbalanced two- and three-way repeated-measures ANOVA results have not been verified and thus results have to be taken with caution. Therefore I thought it was possible to run this function for unequal group sizes. However, in another post I read that this is only supported for one way ANOVA's. I would still like to do this, am I doing something wrong?

Y = data set A = muscle
(I am analysing 6 muscles' RMS amplitude per subject) B = group
(I have 2 groups, one with 9 subjects and one with 22 subjects) C = time
(I measured the RMS amplitude at two points in time)

I already ran a 2-way RM ANOVA (6x2) for both groups seperatly which worked fine. I hope you can help me!

Kind regards,

Max Keller

0todd0000 commented 3 years ago

Hi Max,

Unbalanced designs are indeed not yet supported for general ANOVA in spm1d. The necessary non-sphericity corrections have been implemented, but they are not yet working correctly for continuum-level results.

Running the two-way RM analyses worked likely because the design is balanced when considering one group in isolation.

One possibility to proceed would be to:

  1. Randomly select 9 subjects from the second group.
  2. Run balanced ANOVA.
  3. Repeat 1 and 2 for a number of random sub-samples (at least 20, and the more the better); if the results are qualitatively stable over random sub-samples it would suggest that the larger sample is not necessarily needed to achieve the same results.

This is a non-ideal work-around, but the results would be robust if stable to random sub-sampling.

Todd