On Sun, 17 May 2009, Axel Leroix wrote:
Hi,
Â
A question on something which normally should be easy !
Â
I perform a linear regression using lm function:
Â
reg1 <- lm (a b+c+d, data = database1)
Â
Then I try to perform the Chow (1960) test (structural change test) on my
regression. I know the breakpoint date. I try the following code like it is
described in the âExamplesâ section of the âstrucchangeâ package :
Â
sctest(reg1, data = database1, type = "Chow", Â point = 20, asymptotic = FALSE)
You just need the formula, not the fitted model:
sctest(a ~ b + c + d, data = database1, type = "Chow", point = 20)
If you want to perform it "by hand", then the following should work:
fit the nested model and then perform the model comparison calling anova()
(or lrtest() from "lmtest" for the asymptotic version).
reg2 <- lm(a ~ factor(1:nrow(database1) <= 20) / (b + c + d),
data = database1)
anova(reg1, reg2)
hth,
Z
Â
Unfortunately, this does not work and I have the following error message:
Â
Error in UseMethod("sctest") : No applied method for "sctest".
Â
I guess that I should compute fs statistics first (Fisher statistics) but Iâm
not sure about my guess. Moreover, in case my guess is true I do know how to do
it although I have read the package documentation!
On the basis of this documentation Iâm able to perform other structural
change test (CUSUM, MOSUMâ¦) but Iâm particularly interested in the Chow
(1960) test. So please is there someone who can help me in implementing it.
Â
Many thanks in advance.
Â
Â
[[alternative HTML version deleted]]
______________________________________________
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.