Linear mixed effect model in statsmodel package 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.


*

*If I want to regress out the effects of covariates (3 distinct covariates are expected to be used as fixed factors) from the neuroimaging data, then linear mixed effects model is appropriate approach?
If it is not, then how can I use linear mixed effects model in my dataset? (I am confused with the purpose of it)

*Then, what would be the example code? 

*And how should I interpret the result to get values that I want?

 A: 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).
The 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()

