Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two-way repeated measures ANOVA python function

Thanks in advance for any answers. I want to conduct a 2-way repeated measures ANOVA in python where one IV has 5 levels and the other 4 levels, with one DV. I've tried looking around in scipy documentation and a few online blogs but can't seem to find anything.

like image 852
DGMC90 Avatar asked Jan 11 '23 23:01

DGMC90


1 Answers

You can use the rm_anova function in the Pingouin package (of which I am the creator) that works directly with pandas DataFrame, e.g.:

import pingouin as pg

# Compute the 2-way repeated measures ANOVA. This will return a dataframe.
pg.rm_anova(dv='dv', within=['iv1', 'iv2'], subject='id', data=df)

# Optional post-hoc tests
pg.pairwise_ttests(dv='dv', within=['iv1', 'iv2'], subject='id', data=df)
like image 80
Raphael Avatar answered Jan 17 '23 13:01

Raphael