Reputation: 199
How to generate residuals for all 303 observations in Python:
from statsmodels.stats.outliers_influence import OLSInfluence
OLSInfluence(resid)
or
res.resid()
I am trying to generate residual similar to what we generate in R using:
res$resid
Upvotes: 0
Views: 3043
Reputation: 22897
statsmodels does not have a default resid
for GLM
, but it has the following
resid_anscombe Anscombe residuals.
resid_anscombe_scaled Scaled Anscombe residuals.
resid_anscombe_unscaled Unscaled Anscombe residuals.
resid_deviance Deviance residuals.
resid_pearson Pearson residuals.
resid_response Response residuals.
resid_working Working residuals.
The residual y - E(y|x)
are the response residuals resid_response
Those residuals are available as attributes of the results instance that is returned by the fit
method.
Upvotes: 1