pingouin.mixed_anova

pingouin.mixed_anova(dv=None, within=None, subject=None, between=None, data=None, correction='auto', remove_na=True, export_filename=None)[source]

Mixed-design (split-plot) ANOVA.

Parameters:
dv : string

Name of column containing the dependant variable.

within : string

Name of column containing the within factor.

subject : string

Name of column containing the subject identifier.

between : string

Name of column containing the between factor.

data : pandas DataFrame

DataFrame

correction : string or boolean

If True, return Greenhouse-Geisser corrected p-value. If ‘auto’ (default), compute Mauchly’s test of sphericity to determine whether the p-values needs to be corrected.

remove_na : boolean

If True, automatically remove from the analysis subjects with one or more missing values:

Ss    x1       x2       x3
1     5.0      4.2      nan
2     4.6      3.6      3.9

In this example, if remove_na == True, Ss 1 will be removed from the ANOVA because of the x3 missing value. If False, the two non-missing values will be included in the analysis.

export_filename : string

Filename (without extension) for the output file. If None, do not export the table. By default, the file will be created in the current python console directory. To change that, specify the filename with full path.

Returns:
aov : DataFrame

ANOVA summary

'Source' : Names of the factor considered
'ddof1' : Degrees of freedom (numerator)
'ddof2' : Degrees of freedom (denominator)
'F' : F-values
'p-unc' : Uncorrected p-values
'np2' : Partial eta-square effect sizes
'eps' : Greenhouse-Geisser epsilon factor ( = index of sphericity)
'p-GG-corr' : Greenhouse-Geisser corrected p-values
'W-spher' : Sphericity test statistic
'p-spher' : p-value of the sphericity test
'sphericity' : sphericity of the data (boolean)

See also

anova
One-way and two-way ANOVA
rm_anova
One-way and two-way repeated measures ANOVA

Notes

Results have been tested against R and JASP.

Examples

Compute a two-way mixed model ANOVA.

>>> from pingouin import mixed_anova, read_dataset
>>> df = read_dataset('mixed_anova')
>>> aov = mixed_anova(dv='Scores', between='Group',
...                   within='Time', subject='Subject', data=df)
>>> aov
        Source     SS  DF1  DF2     MS      F     p-unc    np2    eps
0        Group  5.460    1   58  5.460  5.052  0.028420  0.080      -
1         Time  7.628    2  116  3.814  4.027  0.020373  0.065  0.999
2  Interaction  5.168    2  116  2.584  2.728  0.069530  0.045      -