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


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.


The recursive ols residuals.


The recursive ols parameter estimates.


The recursive prediction of endogenous variable.


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


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


The cumulative residuals for cusum test.


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


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.


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: May 25, 2024