I try to use linear mixed effect model in Python statsmodels package. However, I have no idea how to conduct and interpret the result.
Group 1 (20 people) : base line & follow up
Group 2 (20 people) : base line & follow up
Two groups went through an experiment and neuroimaging was done before(baseline) & after(follow up) the experiment. Each group consists of about 20 people.
The purpose of a mixed effects model is to incorporate fixed effects, which are typically variables that are predictors that you have interest in, variables that you control in an experiment, and confounders; and random effects which are variables such as grouping factors for which there are repeated measures.
In your case you have participants that are measured twice and you are interested in the change from baseline and whether this differs by treatment group. This is a common use case for mixed effects models, because it avoids the pitfalls of regressing change on baseline which causes bias due to mathematical coupling, and ANCOVA which can be biased when participants are not randomised into groups (or where the randomisation fails).
statsmodels package in python can fit such a model
import statsmodels.api as sm import statsmodels.formula.api as smf data = sm.datasets.get_rdataset("dietox", "geepack").data md = smf.mixedlm("Weight ~ Time", data, groups=data["Pig"]) mdf = md.fit()