statsmodels.graphics.regressionplots.added_variable_resids#
- statsmodels.graphics.regressionplots.added_variable_resids(results, focus_exog, resid_type=None, use_glm_weights=True, fit_kwargs=None)[source]#
Residualize the endog variable and a ‘focus’ exog variable in a regression model with respect to the other exog variables
- Parameters:
- results
regressionresultsinstance A fitted model including the focus exog and all other predictors of interest.
- focus_exog
intorstr The column of results.model.exog or a variable name that is to be residualized against the other predictors.
- resid_type
str,optional The type of residuals to use for the dependent variable. If None, uses resid_deviance for GLM/GEE and resid otherwise.
- use_glm_weightsbool,
optional Only used if the model is a GLM or GEE. If True, the residuals for the focus predictor are computed using WLS, with the weights obtained from the IRLS calculations for fitting the GLM. If False, unweighted regression is used.
- fit_kwargs
dict,optional Keyword arguments to be passed to fit when refitting the model.
- results
- Returns:
Notes
The ‘focus variable’ residuals are always obtained using linear regression.
Currently only GLM, GEE, and OLS models are supported.