[R] R strucchange question: recursive-based CUSUM

Achim Zeileis Achim.Zeileis at R-project.org
Fri Oct 30 17:31:17 CET 2009


Julia:

> I'm trying now to apply the package strucchange to see whether there is a 
> structural change in linear regression. I have noted the following problem 
> that arises in my case with recursive-based CUSUM: generic function 
> recresid() in efp() generates an error, since (probably) it cannot compute 
> the inverse matrix of (X^(i-1)^T)*(X^(i-1)) at each step (i-1), because the 
> matrix (X^(i-1)^T)*(X^(i-1)) does not have full rank for all i (X consists of 
> dummy variables). Does any solution of this problem exist (for example, to 
> replace the ordinary inverse by the generalised inverse, ginv())?

The 1-step-ahead prediction error is well-defined even if there are rank 
deficiencies. For example, using lm.fit() will automatically alias 
coefficients that are not identified. The reason why recresid() doesn't 
use this is that it employs a more efficient updating algorithm.

If you need to investigate the recursive CUSUM test, you could hack 
recresid() and use the slower but more robust implementation based on 
lm.fit().

Personally, however, I would recommend to use a different test. In most 
situations (unless the break occurs very early in the sample), there are 
more powerful methods than the recursive CUSUM test.

hth,
Z




More information about the R-help mailing list