[R] Error message from vignette strucchange-intro example

Thomas Schönhoff tom_woody at web.de
Fri Nov 5 11:54:41 CET 2004


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




More information about the R-help mailing list