Hello
I'm using the nice package strucchange to see whether there is a
structural change in a regression, and especially, if the change is in
the slope or intercept coefficient.
The "Vignette" with the package (see fig 4 page 8) gives an example to
obtain a plot of the empirical process for each coefficient. However, I
don't obtain it, even with the code given in example...
Do you have also only one plot? Do you see what I do wrong, and how I
could obtain the same plot as in example?
Thanks a lot!!
The code in example is:
library("strucchange")
data("USIncExp")
USIncExp2 <- window(USIncExp, start = c(1985, 12))
coint.res <- residuals(lm(expenditure ~ income, data = USIncExp2))
coint.res <- lag(ts(coint.res, start = c(1985, 12), freq = 12),
k = -1)
USIncExp2 <- cbind(USIncExp2, diff(USIncExp2), coint.res)
USIncExp2 <- window(USIncExp2, start = c(1986, 1), end = c(2001,
2))
colnames(USIncExp2) <- c("income", "expenditure", "diff.income",
"diff.expenditure", "coint.res")
ecm.model <- diff.expenditure ~ coint.res + diff.income
me <- efp(ecm.model, type = "ME", data = USIncExp2, h = 0.2)
plot(me, functional = NULL)
Frage uber package strucchange
2 messages · Matthieu Stigler, Achim Zeileis
1 day later
On Sun, 2 Mar 2008, Matthieu Stigler wrote:
Hello I'm using the nice package strucchange to see whether there is a structural change in a regression, and especially, if the change is in the slope or intercept coefficient. The "Vignette" with the package (see fig 4 page 8) gives an example to obtain a plot of the empirical process for each coefficient. However, I don't obtain it, even with the code given in example... Do you have also only one plot? Do you see what I do wrong, and how I could obtain the same plot as in example?
Hmmm, I don't know what could go wrong for you. For me, the code you attached below produces a plot with three panels (one for each parameter). Unsurprisingly, this looks like the vignette because it was generated with the same code. I've got no idea what might go wrong on your machine... One additional remark: The function gefp() (instead of efp) has some more flexible plotting functionality. You can look at Achim Zeileis (2006). Implementing a Class of Structural Change Tests: An Econometric Computing Approach. Computational Statistics and Data Analysis, 50, 2987-3008. for details. A preprint version of that paper is available from my Web page. Best, Z
Thanks a lot!!
The code in example is:
library("strucchange")
data("USIncExp")
USIncExp2 <- window(USIncExp, start = c(1985, 12))
coint.res <- residuals(lm(expenditure ~ income, data = USIncExp2))
coint.res <- lag(ts(coint.res, start = c(1985, 12), freq = 12),
k = -1)
USIncExp2 <- cbind(USIncExp2, diff(USIncExp2), coint.res)
USIncExp2 <- window(USIncExp2, start = c(1986, 1), end = c(2001,
2))
colnames(USIncExp2) <- c("income", "expenditure", "diff.income",
"diff.expenditure", "coint.res")
ecm.model <- diff.expenditure ~ coint.res + diff.income
me <- efp(ecm.model, type = "ME", data = USIncExp2, h = 0.2)
plot(me, functional = NULL)