2

I want to carry out a structural change test on exchange rate data. I have a zoo series named m with several exchange rates. I first create a window m1.

m1 <- window(m, start = as.Date("1998-12-31"), end = as.Date("2010-12-31"))

The first column of m1 looks like the following.

head(m1$mbel)

1998-12-31 1999-01-31 1999-02-28 1999-03-31 1999-04-30 1999-05-31 
1.2346     1.2278     1.2269     1.2259     1.2328     1.2357 

mbel is the variable of interest currently. For mbel, I want to test parameter stability for a simple linear model, mbel ~ mbel(lag1).

I first combine the level and first lags of logs of mbel data.

cb <- cbind(log(m1$mbel),lag(log(m1$mbel),k = -1))
colnames(cb) <- c("rate","ratelag1")
cb <- window(cb, start = as.Date("1999-01-31"), end = as.Date("2010-12-31"))

head(cb)
            rate  ratelag1
1999-01-31 0.2052240 0.2107470
1999-02-28 0.2044907 0.2052240
1999-03-31 0.2036753 0.2044907
1999-04-30 0.2092880 0.2036753
1999-05-31 0.2116376 0.2092880
1999-06-30 0.2190552 0.2116376

Now with library strucchange, I use the following tests.

r <-  Fstats(cb$rate~cb$ratelag1, data = cb )
re <- efp(cb$rate~cb$ratelag1,data = cb,type="RE")
plot(re)
sctest(re) 

The following error is showing up:

Error in eval(attr(terms(formula), "variables")[[2]], data, env) : 
numeric 'envir' arg not of length one

What am I missing here? Please help.

ritesh pandey
  • 41
  • 1
  • 5
  • 3
    possible duplicate of [R: numeric 'envir' arg not of length one in predict()](http://stackoverflow.com/questions/9026383/r-numeric-envir-arg-not-of-length-one-in-predict) – sds May 27 '14 at 01:12

0 Answers0