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. >>> >>> Best, >>> Bernhard >>> >>> ------------------------------ >>> *Von:* Grzegorz Konat [mailto:grzegorz.ko...@ibrkk.pl] >>> *Gesendet:* Mittwoch, 30. März 2011 20:50 >>> *An:* Pfaff, Bernhard Dr.; r-help@r-project.org >>> *Betreff:* Re: [R] VECM with UNRESTRICTED TREND >>> >>> Hello Bernhard, >>> >>> Thank You very much. Unfortunately I'm still not really sure how should I >>> use dummy vars in this context... >>> If I have a system of three variables (x, y, z), lag order = 2 and 1 >>> cointegrating relation, what should I do? I mean, what kind of 'pattern' >>> should be used to create those dummy variables, what should they represent >>> and how many of them do I need? >>> >>> Many thanks in advance! >>> >>> Best, >>> Greg >>> >>> 2011/3/30 Pfaff, Bernhard Dr. <bernhard_pf...@fra.invesco.com> >>> >>>> Hello Greg, >>>> >>>> you can exploit the argument 'dumvar' for this. See ?ca.jo >>>> >>>> Best, >>>> Bernhard >>>> >>>> > -----Ursprüngliche Nachricht----- >>>> > Von: r-help-boun...@r-project.org >>>> > [mailto:r-help-boun...@r-project.org] Im Auftrag von Grzegorz Konat >>>> > Gesendet: Mittwoch, 30. März 2011 16:46 >>>> > An: r-help@r-project.org >>>> > Betreff: [R] VECM with UNRESTRICTED TREND >>>> > >>>> > Dear All, >>>> > >>>> > My question is: >>>> > >>>> > how can I estimate VECM system with "unrestricted trend" (aka >>>> > "case 5") option as a deterministic term? >>>> > >>>> > As far as I know, ca.jo in urca package allows for "restricted trend" >>>> > only [vecm >>>> > <- ca.jo(data, type = "trace"/"eigen", ecdet = "trend", K = >>>> > n, spec = "transitory"/"longrun")]. >>>> > Obviously, I don't have to do this in urca, so if another >>>> > package gives the possibility, please let me know too! >>>> > >>>> > Thanks in advance! >>>> > >>>> > Greg >>>> > >>>> > [[alternative HTML version deleted]] >>>> > >>>> > ______________________________________________ >>>> > 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. >>>> > >>>> ***************************************************************** >>>> Confidentiality Note: The information contained in this message, >>>> and any attachments, may contain confidential and/or privileged >>>> material. It is intended solely for the person(s) or entity to >>>> which it is addressed. Any review, retransmission, dissemination, >>>> or taking of any action in reliance upon this information by >>>> persons or entities other than the intended recipient(s) is >>>> prohibited. If you received this in error, please contact the >>>> sender and delete the material from any computer. >>>> ***************************************************************** >>>> >>>> >>> >> >
______________________________________________ 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.