statsmodels.stats.diagnostic.recursive_olsresiduals

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

calculate recursive ols with residuals and cusum test statistic

Parameters
olsresultsinstance of RegressionResults

uses only endog and exog

skipint or None

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

lamdafloat

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

alpha{0.95, 0.99}

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

Returns
rresidarray

recursive ols residuals

rparamsarray

recursive ols parameter estimates

rypredarray

recursive prediction of endogenous variable

rresid_standardizedarray

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

rresid_scaledarray

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

rcusumarray

cumulative residuals for cusum test

rcusumciarray

confidence interval for cusum test, currently hard coded for alpha=0.95

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.