Dear Pfaff, Would that be possible to fit a Time varying VECM using urca?
Yours, Renoir On Thursday, March 31, 2011, Grzegorz Konat <grzegorz.ko...@ibrkk.pl> wrote: > The code you gave me works fine with Finland, but the same for my data - > does not! > I do: > > library(urca) > data(my.data) > dat1 <- my.data[, c("dY", "X", "dM")] > trend <- matrix(1:nrow(dat1), ncol = 1) > colnames(trend) <- "trd" > yxm.vecm <- ca.jo(dat1, type = "trace", ecdet = "const", K = 2, spec = > "longrun", dumvar = trend) > > and the result is again: > > Error in r[i1, , drop = FALSE] - r[-nrow(r):-(nrow(r) - lag + 1L), , drop = > FALSE] : > non-numeric argument to binary operator > > I attach my dataset in xls format. If you have 5 minutes and wish to check > it out, I'd be extremely grateful! > > Best, > Greg > > > > 2011/3/31 Pfaff, Bernhard Dr. <bernhard_pf...@fra.invesco.com> > >> Well, without further information, I do not know, but try the following >> >> library(urca) >> example(ca.jo) >> trend <- matrix(1:nrow(sjf), ncol = 1) >> colnames(trend) <- "trd" >> ca.jo(sjf, type = "trace", ecdet = "const", K = 2, spec = "longrun", >> dumvar = trend) >> >> Best, >> Bernhard >> >> >> >> ------------------------------ >> *Von:* Grzegorz Konat [mailto:grzegorz.ko...@ibrkk.pl] >> *Gesendet:* Donnerstag, 31. März 2011 14:40 >> >> *An:* Pfaff, Bernhard Dr.; r-help@r-project.org >> *Betreff:* Re: [R] VECM with UNRESTRICTED TREND >> >> 'time' was a trend variable from my.data set. Equivalent to the output of >> the command 'matrix' you just gave me. >> >> So now I did: >> >> library(urca) >> data(my.data) >> names(my.data) >> attach(my.data) >> dat1 <- my.data[, c("dY", "X", "dM")] >> mat1 <- matrix(seq(1:nrow(dat1)), ncol = 1) >> args('ca.jo') >> yxm.vecm <- ca.jo(dat1, type = "trace", ecdet = "const", K = 2, spec = >> "longrun", dumvar=mat1) >> >> and the output is: >> >> Error in r[i1, , drop = FALSE] - r[-nrow(r):-(nrow(r) - lag + 1L), , drop >> = FALSE] : >> non-numeric argument to binary operator >> In addition: Warning message: >> In ca.jo(dat1, type = "trace", ecdet = "const", K = 2, spec = "longrun", >> : >> No column names in 'dumvar', using prefix 'exo' instead. >> >> What do I do wrong? >> >> Best, >> Greg >> >> >> 2011/3/31 Pfaff, Bernhard Dr. <bernhard_pf...@fra.invesco.com> >> >>> >>> >>> >>> Hello Bernhard, >>> >>> thank You so much one again! Now I (more or less) understand the idea, but >>> still have problem with its practical application. >>> >>> I do (somewhat following example 8.1 in your textbook): >>> >>> library(urca) >>> data(my.data) >>> names(my.data) >>> attach(my.data) >>> dat1 <- my.data[, c("dY", "X", "dM")] >>> dat2 <- cbind(time) >>> >>> What is 'time'? Just employ matrix(seq(1:nrow(dat1)), ncol = 1) for >>> creating the trend variable. >>> >>> Best, >>> Bernhard >>> >>> >>> args('ca.jo') >>> yxm.vecm <- ca.jo(dat1, type = "trace", ecdet = "trend", K = 2, spec = >>> "longrun", dumvar=dat2) >>> >>> The above code produces following output: >>> >>> Error in r[i1, , drop = FALSE] - r[-nrow(r):-(nrow(r) - lag + 1L), , >>> drop = FALSE] : >>> non-numeric argument to binary operator >>> >>> What does that mean? Should I use cbind command to dat1 as well? And >>> doesn't it transform the series into series of integer numbers? >>> >>> Thank you once again (especially for your patience). >>> >>> Best, >>> Greg >>> >>> >>> >>> 2011/3/31 Pfaff, Bernhard Dr. <bernhard_pf...@fra.invesco.com> >>> >>>> Hello Greg, >>>> >>>> you include your trend as a (Nx1) matrix and use this for 'dumvar'. The >>>> matrix 'dumvar' is just added to the VECM as deterministic regressors and >>>> while you are referring to case 5, this is basically what you are after, if >>>> I am not mistaken. But we aware that this implies a quadratic trend for the >>>> levels ______________________________________________ R-help@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.