[R] Chow test(1960)/Structural change test
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Sun May 17 23:22:36 CEST 2009
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]]
>
>
More information about the R-help
mailing list