On Sun, 9 Oct 2011, buehlerman wrote:
> I want to apply Nyblom-Hansen test with the strucchange package, but I
> don't know how is the correct way and what is the difference between
the
> following two approaches (leeding to different results):
The difference is that sctest(formula, type = "Nyblom-Hansen") applies
the
Nyblom-Hansen test statistic to a model which assesses both coefficients
_and_ error variance.
The approach via functional = meanL2BB, on the other hand, allows to apply
the same type of test statistic to the score functions of any model. In
your case, where you used the default fit = glm in gefp(), a linear
regression model is used where the error variance is _not_ included as a
full model parameter but only as a nuisance parameter. Hence, the
difference.
Of course, one may also add another score function for the error variance.
On example("DIJA", package = "strucchange") I provide a
function normlm()
with corresponding estfun() method. If you load these, you can do:
R> sctest(gefp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data =
longley, fit = normlm), functional = meanL2BB)
M-fluctuation test
data: gefp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley,
fit = normlm)
f(efp) = 0.8916, p-value = 0.4395
which leads to the same output as sctest(formula, type =
"Nyblom-Hansen").
Finally, instead of using gefp(..., fit = normlm), you could have also
used efp(..., type = "Score-CUSUM"):
R> sctest(efp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data =
longley, type = "Score-CUSUM"), functional = "meanL2")
Score-based CUSUM test with mean L2 norm
data: efp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data =
longley, type = "Score-CUSUM")
f(efp) = 0.8916, p-value = 0.4395
I hope that this clarifies more than adding to the confusion ;-)
The reason for the various approaches is that efp() was always confined to
the linear model and gefp() then extended it to arbitrary estimating
function-based models. And for the linear model this provides the option
of treating the variance of a nuisance parameter or a full model
parameter.
Hope that helps,
Z
>
> data("longley")
>
> # 1. Approach:
> sctest(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley,
> type = "Nyblom-Hansen")
>
> #results in:
> # Score-based CUSUM test with mean L2 norm
> #
> #data: Employed ~ Year + GNP.deflator + GNP + Armed.Forces
> #f(efp) = 0.8916, p-value = 0.4395
>
> #2. Approach:
> sctest(gefp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data >
longley), functional = meanL2BB)
>
> #results in:
> # M-fluctuation test
> #
> #data: gefp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data >
longley)
> #f(efp) = 0.8165, p-value = 0.3924
>
>
> I could not find any examples or further remarks of the first approach with
> sctest(..., type = "Nyblom-Hansen").
> Maybe the first approach is unlike the second no joint test for all
> coefficients?
>
> Thank you in advance for your help!
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/strucchange-Nyblom-Hansen-Test-tp3887208p3887208.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>