pingouin
pingouin copied to clipboard
Get residuals from anova
Hi, recently I have been playing with statsmodels
and pinguin
and I have not been able to figure out how to get residuals from pinguin. What I mean is (taking your example):
df = pg.read_dataset('anova2')
# Pinguin
df.anova(dv="Yield", between=["Blend", "Crop"]).round(3)
# statsmodels
model = ols( 'Yield ~ C(Blend) + C(Crop) + C(Blend):C(Crop)', df).fit()
aov_table = anova_lm(model, typ=2)
res = model.resid
pg.qqplot(res, dist='norm')
If I would like to plot the residuals, how can I do that without calling model.resid
?
Thanks.
Hi @jankaWIS,
Thanks for opening the issue. Pingouin does not currently return the residuals for ANOVA models (it does only in the linear_regression function). I don't think it should be too hard to implement though. I'm jammed up right now but can take a look at that within the next couple of months. Or, if you'd like to submit a pull request, please feel free to do so!
Best, Raphael