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:  olsresults (instance of RegressionResults) – uses only endog and exog
 skip (int 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)
 lamda (float) – 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:  rresid (array) – recursive ols residuals
 rparams (array) – recursive ols parameter estimates
 rypred (array) – recursive prediction of endogenous variable
 rresid_standardized (array) – recursive residuals standardized so that N(0,sigma2) distributed, where sigma2 is the error variance
 rresid_scaled (array) – recursive residuals normalize so that N(0,1) distributed
 rcusum (array) – cumulative residuals for cusum test
 rcusumci (array) – 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): 149192.