0todd0000 / spm1d

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

May I use two-way Anova with 1rm with groups of different size? #138

Closed MarcusFV closed 3 years ago

MarcusFV commented 4 years ago

Hi Toddy, I have several variables of a foot model collected during running before and after some intervention. I have two groups: control and experimental. Control group did not undergo the intervention. My first choice was two-way Anova with 1rm: two groups (control and experimental) and two instants (before and after intervention). As post-hoc tests, I am using independent t test to compare the groups at each instant, and paired t test to compare instants for each group. However, some results do not make sense. Anova returns no significant results, for example, but post-hoc tests do. There is a small difference between group sizes: control group has 47 individuals, and experimental group 42 individuals. Can this difference explain these discreptant results? For repeated measures, I am taking 5 running cycles for each individual in each instant (before and after intervention). Should I take only one average running cycle for each variable? As I have only two groups, and only two instants, two-way Anova with 1rm is a suitable statistical design?

Or should I use another test? Most variables has two (X, Y) or three components (X, Y, Z). Maybe, I should use two-sample Hotelling test followed by independent t test as post-hoc test (for each variable component) for comparing groups in the instants before and after intervention. And paired Hotelling test followed by paired t test as post-hoc test for comparing before and after instants for each group.

What would be the correct/best statistical test to be used in this study? If I use two Hotelling tests as suggested above, should I correct the p value for Hotelling tests? Or only for post-hoc tests?

I would appreciate your help. And I thank you in advance. Regards, Marcus

0todd0000 commented 4 years ago

There is a small difference between group sizes: control group has 47 individuals, and experimental group 42 individuals. Can this difference explain these discreptant results?

A group size difference would likely not be responsible for this difference by itself.

As post-hoc tests, I am using independent t test to compare the groups at each instant, and paired t test to compare instants for each group.

This sounds fine, provided you use a correction for the multiple post hoc tests. See here: https://spm1d.org/doc/PostHoc/anova.html

For repeated measures, I am taking 5 running cycles for each individual in each instant (before and after intervention). Should I take only one average running cycle for each variable?

Yes, I recommend using only within-individual averages.

As I have only two groups, and only two instants, two-way Anova with 1rm is a suitable statistical design?

Yes, spm1d.stats.anova2onerm is suitable.

Most variables has two (X, Y) or three components (X, Y, Z).

It sounds like the dependent variables (DVs) are multivariate (i.e., vectors, not scalars), and that there is more than one multivariate DV. There are several things to consider.

For your experiment I would recommend the following:

Last, please note:

Todd

MarcusFV commented 4 years ago

Thank you very much, Todd (sorry not writing correctly your name previously). I'll perform the Hotelling tests. I will return you the results as soon as possible.

Concerning using an average running cycle. I collected aroung 42 running cycles for each individual, discarching the first ones and the last ones. I have used 3 average running cycles (mean of 14 + mean of 14 + mean of 14) You have recommended to use only one average running cycle. This was my first decision. But, SPM return this warning message when using 1rm:

Warning: Only one observation per subject found. Residuals and inference will be approximate. To avoid approximate residuals: (a) Add multiple observations per subject and per condition, and (b) ensure that all subjects and conditions have the same number of observations.

Can I ignore this warning and use only one average running cycle?

By the way, is there an easy way to plot two-way Anova results in only one row inside a figure? SPM two-way Anova plots main effects in one row and interaction effect in other row (I am referring to the subplots). It is hard work to move the subplots in order to plot main effects and interaction effect in only one row, so that the post-hoc tests can be plotted in the subsequent rows.

Thank you again. Good Night (here in Brazil is 1:30 AM!) Best, Marcus

0todd0000 commented 4 years ago

Thank you very much, Todd (sorry not writing correctly your name previously).

No problem!

Can I ignore this warning and use only one average running cycle?

Yes, you can ignore this warning. Try both ways: (1) with one mean observation per individual, and (2) with multiple observations per individual. If you have set up the analyses correctly, the results should be practically identical.

By the way, is there an easy way to plot two-way Anova results in only one row inside a figure?

Yes, the easiest way is to use the subplots command like this:

from matplotlib import pyplot as plt
import spm1d

#(0) Load data:
dataset      = spm1d.data.uv1d.anova2.SPM1D_ANOVA2_2x2()
Y,A,B        = dataset.get_data()

#(1) Conduct ANOVA:
alpha        = 0.05
FF           = spm1d.stats.anova2(Y, A, B, equal_var=True)
FFi          = FF.inference(alpha)

#(2) Plot results:
plt.close('all')
fig,ax = plt.subplots(1, 3, figsize=(12,3))
for axx,Fi in zip(ax,FFi):
    Fi.plot(ax=axx)
    Fi.plot_threshold_label(ax=axx)
    Fi.plot_p_values(ax=axx)
plt.setp(ax[1:], ylabel=None)
ax[0].set_title('Main A')
ax[1].set_title('Main B')
ax[2].set_title('Interaction AB')
plt.show()

fig

MarcusFV commented 4 years ago

Thank you, Todd. Best, Marcus