statsmodels.stats.outliers_influence.GLMInfluence#
- class statsmodels.stats.outliers_influence.GLMInfluence(results, resid=None, endog=None, exog=None, hat_matrix_diag=None, cov_params=None, scale=None)[source]#
Influence and outlier measures (experimental)
This uses partly formulas specific to GLM, specifically cooks_distance is based on the hessian, i.e. observed or expected information matrix and not on cov_params, in contrast to MLEInfluence. Standardization for changes in parameters, in fittedvalues and in the linear predictor are based on cov_params.
- Parameters:
- results
instanceofresultsclass This only works for model and results classes that have the necessary helper methods.
- resid
ndarray,optional Residuals to use instead of the default
resid_pearsoncomputed from the results instance.- endog
ndarray,optional Endogenous (response) variable to use instead of
results.model.endog.- exog
ndarray,optional Exogenous (design) variable to use instead of
results.model.exog.- hat_matrix_diag
ndarray,optional Diagonal of the generalized leverage to use instead of the value computed internally.
- cov_params
ndarray,optional Covariance matrix of the parameter estimates to use instead of
results.cov_params().- scale
float,optional Scale parameter to use instead of
results.scale.
- results
- Attributes:
- dbetas
change in parameters divided by the standard error of parameters from the full model results,
bse.d_fittedvalues_scaledChange in fittedvalues scaled by standard errors
d_linpredChange in linear prediction
- d_linpred_scale
local change in linear prediction scaled by the standard errors for the prediction based on cov_params.
Methods
plot_index([y_var, threshold, title, ax, idx])Index plot for influence attributes
plot_influence([external, alpha, criterion, ...])Plot of influence in regression.
resid_score([joint, index, studentize])Score observations scaled by inverse hessian
Score residual divided by sqrt of hessian factor
Creates a DataFrame with influence results
Notes
This has not yet been tested for correctness when offset or exposure are used, although they should be supported by the code.
Some GLM specific measures like d_deviance are still missing.
Computing an explicit leave-one-observation-out (LOOO) loop is included but no influence measures are currently computed from it.
Methods
plot_index([y_var, threshold, title, ax, idx])Index plot for influence attributes
plot_influence([external, alpha, criterion, ...])Plot of influence in regression.
resid_score([joint, index, studentize])Score observations scaled by inverse hessian
Score residual divided by sqrt of hessian factor
Creates a DataFrame with influence results
Properties
Cook's distance
Change in expected response, fittedvalues
Change in fittedvalues scaled by standard errors
Change in linear prediction
Change in linpred scaled by standard errors
Change in parameter estimates
Scaled change in parameter estimates
Diagonal of the hat_matrix for GLM
Diagonal of the hat_matrix using only exog as in OLS
Parameter estimate based on one-step approximation
Internally studentized pearson residuals