cusum test for parameter stability based on ols residuals
olsresiduals : ndarray
array of residuals from an OLS estimation
ddof : int
number of parameters in the OLS estimation, used as degrees of freedom correction for error variance.
sup_b : float
test statistic, maximum of absolute value of scaled cumulative OLS residuals
pval : float
Probability of observing the data under the null hypothesis of no structural change, based on asymptotic distribution which is a Brownian Bridge
tabulated critical values, for alpha = 1%, 5% and 10%
tested agains R:strucchange
Not clear: Assumption 2 in Ploberger, Kramer assumes that exog x have asymptotically zero mean, x.mean(0) = [1, 0, 0, ..., 0] Is this really necessary? I don’t see how it can affect the test statistic under the null. It does make a difference under the alternative. Also, the asymptotic distribution of test statistic depends on this.
From examples it looks like there is little power for standard cusum if exog (other than constant) have mean zero.
Ploberger, Werner, and Walter Kramer. “The Cusum Test with Ols Residuals.” Econometrica 60, no. 2 (March 1992): 271-285.