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:¶
- res
RegressionResults
Results from estimation of a regression model.
- skip
int
,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).
- lamda
float
,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.
- res
- Returns:¶
- rresid
ndarray
The recursive ols residuals.
- rparams
ndarray
The recursive ols parameter estimates.
- rypred
ndarray
The recursive prediction of endogenous variable.
- rresid_standardized
ndarray
The recursive residuals standardized so that N(0,sigma2) distributed, where sigma2 is the error variance.
- rresid_scaled
ndarray
The recursive residuals normalize so that N(0,1) distributed.
- rcusum
ndarray
The cumulative residuals for cusum test.
- rcusumci
ndarray
The confidence interval for cusum test using a size of alpha.
- rresid
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.