Which statsmodels ANOVA model for within- and between-subjects design?

Viewed 535

I have a classic ANOVA design: two experimental conditions with two levels each; one participant answers on two of the four resulting conditions. A sample of my data looks like this:

participant_ID  Condition_1 Condition_2 dependent_var
1               1           1           0.71
1               2           1           0.43
2               1           1           0.77
2               2           1           0.37
3               1           1           0.58
3               2           1           0.69
4               2           1           0.72
4               1           1           0.12
26              2           2           0.91
26              1           2           0.53
27              1           2           0.29
27              2           2           0.39
28              2           2           0.75
28              1           2           0.51
29              1           2           0.42
29              2           2           0.31

Using statsmodels, I wish to identify the effects of both conditions on the dependent variable, allowing for the fact that each participant answers twice and that there may be interactions. My expectation would be that I would use the repeat-measures ANOVA option as follows:

from statsmodels.stats.anova import AnovaRM

aovrm = AnovaRM(data, 'dependent_var', 'participant_ID', within=['Condition_1'], between = ['Condition_2'], aggregate_func= 'mean').fit()

However, when I do this, I get the following error:

NotImplementedError: Between subject effect not yet supported!

Does anyone know of a workaround for this that doesn't involve learning R? My instinct would be to try a mixed linear model, but I don't know how to account for the fact that each participant answered twice.

Apologies if this turns out to really be a Cross Validated question!

1 Answers
Related