Achim Zeileis wrote:
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
Thanks a lot for detailed answer, I'll try to implement this in
Rec-CUSUM () (and other tests as well).
MfG,
Julia
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.