statsmodels.stats.diagnostic.recursive_olsresiduals

statsmodels.stats.diagnostic.recursive_olsresiduals(res, skip=None, lamda=0.0, alpha=0.95, order_by=None)[source]

Calculate recursive ols with residuals and Cusum test statistic

Parameters:
resRegressionResults

Results from estimation of a regression model.

skipint, default None

The number of observations to use for initial OLS, if None then skip is set equal to the number of regressors (columns in exog).

lamdafloat, default 0.0

The weight for Ridge correction to initial (X’X)^{-1}.

alpha{0.90, 0.95, 0.99}, default 0.95

Confidence level of test, currently only two values supported, used for confidence interval in cusum graph.

order_byarray_like, default None

Integer array specifying the order of the residuals. If not provided, the order of the residuals is not changed. If provided, must have the same number of observations as the endogenous variable.

Returns:
rresidndarray

The recursive ols residuals.

rparamsndarray

The recursive ols parameter estimates.

rypredndarray

The recursive prediction of endogenous variable.

rresid_standardizedndarray

The recursive residuals standardized so that N(0,sigma2) distributed, where sigma2 is the error variance.

rresid_scaledndarray

The recursive residuals normalize so that N(0,1) distributed.

rcusumndarray

The cumulative residuals for cusum test.

rcusumcindarray

The confidence interval for cusum test using a size of alpha.

Notes

It produces same recursive residuals as other version. This version updates the inverse of the X’X matrix and does not require matrix inversion during updating. looks efficient but no timing

Confidence interval in Greene and Brown, Durbin and Evans is the same as in Ploberger after a little bit of algebra.

References

jplv to check formulas, follows Harvey BigJudge 5.5.2b for formula for inverse(X’X) updating Greene section 7.5.2

Brown, R. L., J. Durbin, and J. M. Evans. “Techniques for Testing the Constancy of Regression Relationships over Time.” Journal of the Royal Statistical Society. Series B (Methodological) 37, no. 2 (1975): 149-192.


Last update: Nov 14, 2024