Thomas Schönhoff
2004-Nov-05 10:54 UTC
[R] Error message from vignette strucchange-intro example
Hello,
I am just studying the following example from vignette:
strucchange-intro,
contineousely ending up in an error.
This is the given code:
1. library(strucchange)
2. data(USIncExp)
3. if (!"package:stats" %in% search()) library(ts)
4. USIncExp2 <- window(USIncExp, start = c(1985, 12))
A.Modelling:
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))
#here is what eval is looking for in vain: diff.expenditure
colnames(USIncExp2) <-
c("income","expenditure","diff.income","diff.expenditure","coint.res")
B. Error correction formula
ecm.model <- diff.expenditure ~ coint.res + diff.income
C. Using EFP (OLS) test function
ocus <- efp(ecm.model, type = "OLS-CUSUM", data = USIncExp2)
or
me <- efp(ecm.model, type = "ME", data = USIncExp2, h = 0.2)
Both commads under C give me :
-------------------------------------------------------------------
Error in eval(expr, envir, enclos) : Object "diff.expenditure" not
found
-------------------------------------------------------------------
Since quite some time I am sitting here and wonder whether there is an
error in the given code or if it my simple inability to catch up with
a self-breed error (???)
----------------------------------------------
platform i386-pc-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 2
minor 0.0
year 2004
month 10
day 04
language R
------------------------------------------------
Maybe someone to direct my delusion to something helpful, so far I've
looked for typos and alike, as far I can say the code should work,
isn't it?
Thomas
Achim Zeileis
2004-Nov-05 16:50 UTC
[R] Error message from vignette strucchange-intro example
Thomas:> I am just studying the following example from vignette: > strucchange-intro,With problems like this, please contact the package maintainer, or at least Cc.> contineousely ending up in an error. > > This is the given code: > > 1. library(strucchange) > 2. data(USIncExp) > 3. if (!"package:stats" %in% search()) library(ts) > 4. USIncExp2 <- window(USIncExp, start = c(1985, 12)) > > A.Modelling: > > 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)) > > #here is what eval is looking for in vain: diff.expenditure > colnames(USIncExp2) <- > c("income","expenditure","diff.income","diff.expenditure","coint.res")But until here the code is working, right? You've got a multivariate time series object now with the above column names, haven't you?> B. Error correction formula > > ecm.model <- diff.expenditure ~ coint.res + diff.income > > C. Using EFP (OLS) test function > > ocus <- efp(ecm.model, type = "OLS-CUSUM", data = USIncExp2) > > > Both commads under C give me : > > ------------------------------------------------------------------- > Error in eval(expr, envir, enclos) : Object "diff.expenditure" not > found---------------------------------------------------------------- > --- > > Since quite some time I am sitting here and wonder whether there is an > error in the given code or if it my simple inability to catch up with > a self-breed error (???)Looks like the latter. I tried this with the CRAN versions of strucchange, sandwich and zoo with R --vanilla (in 2.0.0) and had no problems. Also the daily CRAN checks don't indicate that something went wrong: http://cran.r-project.org/src/contrib/checkSummary.html I suggest that you have another thorough look. If you find something str(ucch)ange, you can also contact me off-list. Z> > ---------------------------------------------- > platform i386-pc-linux-gnu > arch i386 > os linux-gnu > system i386, linux-gnu > status > major 2 > minor 0.0 > year 2004 > month 10 > day 04 > language R > ------------------------------------------------ > > > > Maybe someone to direct my delusion to something helpful, so far I've > looked for typos and alike, as far I can say the code should work, > isn't it? > > Thomas > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >