[R-SIG-Finance] Forcasting VAR/VEC
Megh Dal
megh700004 at yahoo.com
Fri Dec 17 16:37:02 CET 2010
Thanks Mat for your reply. However this is not what I wanted. I already have the coefficients estimated and using those estimated coefficients I want to forecast. Here your input is TS data, from that data you have estimated coefficients, which is of specific class. Therefore you could use directly predict() function.
As I have coefficients in Matrix class, I cant convert them to specific class for prediction. Is there any way to do that?
2ndly I wondering how without the initial values i.e. last few observations of TS, predict() function in your example could actually predict?
Thanks,
--- On Thu, 12/16/10, mat <matthieu.stigler at gmail.com> wrote:
> From: mat <matthieu.stigler at gmail.com>
> Subject: Re: [R-SIG-Finance] Forcasting VAR/VEC
> To: "Megh Dal" <megh700004 at yahoo.com>, "R Finance" <r-sig-finance at stat.math.ethz.ch>, "Dr. Bernhard Pfaff" <bernhard at pfaffikus.de>
> Date: Thursday, December 16, 2010, 2:47 PM
>
> library(vars)
> data(Canada)
> modeleVAR<-VAR(Canada, p=2)
>
> class(modeleVAR) # so you have your varest object!
> predict(modeleVAR, n.ahead=3)
>
> Hope this helps?
>
> Matthieu
>
> Le 14. 12. 10 18:38, Megh Dal a écrit :
> > I tied to post it through Nabble, however it perhaps
> failed........ Here is my query. Your help will be highly
> appreciated.
> >
> > I found a direct problem while implementing predict
> method. To use that, I need to give values for argument
> "object":
> >
> > object: An object of class ‘‘varest’’;
> generated by ‘VAR()’, or an
> > object of
> class ‘‘vec2var’’; generated by ‘vec2var()’.
> >
> > Here what I have I the estimated coefficients and last
> few values (required for prediction). Given those, how can I
> construct object of that class?
> >
> > For example, I have VAR[2] model with estimated
> coefficients:
> >
> > A1<- t(matrix(c(-0.9444135, 0.5289205,
> 1.54338344, -1.2059849, 0.08658383, -0.7626375,
> 0.5384060, 1.34211012, -0.1540462, 0.07684465,
> > -1.5000912, 0.5975748, 2.08629175,
> -1.3629879, 0.16405863, 0.5622497, -0.5749668,
> -0.01207330, 1.6547463, -0.37280903, -1.1190102,
> > 0.4834678, 1.04152221, -0.5084529,
> 0.91748918), 5))
> >
> > A2<- t(matrix(c(-0.5281084, 0.6750694,
> -0.00700632, 0.5744008, -0.540538174,
> -0.5115759, 0.6663074, -0.03690401, 0.1015040,
> > -0.483984397, -0.6669159, 0.7810531,
> -0.08478713, 0.2837110, -0.634807434, 0.2474859,
> -0.2126529, -0.04611398, -0.2851814, -0.003198122,
> > 0.1136257, -0.4070806, -0.15362813, 0.1043871,
> -0.570401589), 5))
> >
> > ## and deterministic terms with monthly seasonal dummy
> (11 dummy variables + constant):
> >
> > Mu<- t(matrix(c(0.01971314683, 7.392074e-05,
> 0.06745512042, 0.03066764063, -0.05716243051,
> -0.01666261294, -0.02648375478, -0.07739940822,
> > -0.08537205872, -0.03454705454, 0.01026347102,
> 3.93408495893, 0.01124435027, 0.00826573416, 0.07232184812,
> 0.02643898799, -0.02290620244,
> > 0.00631679187, -0.02120713774, -0.06034222549,
> -0.06737971493, -0.02466344307, 0.01574220616,
> 3.67816873865, 0.01817359276, 0.00511780538,
> > 0.06717006338, 0.06206760303, -0.04353428003,
> -0.03033956305, -0.00535023233, -0.06992876937,
> -0.10020345332, -0.04323120694, 0.00399287988,
> > 3.01849213684,-0.00696500762, 0.00784220761,
> 0.00337317617, -0.00771413903, 0.03016416594, 0.02404299199,
> 0.00752992866, 0.01211247641,
> > 0.01442465011, 0.00162618787, 0.00646325736,
> 0.18377741575,0.06172376263, 0.03093119587, 0.00519357485,
> -0.00720735363, -0.02268228948,
> > -0.03428031321, 0.01599783772, -0.01470977952,
> -0.00498472297, -0.03734476303, -0.03712904004,
> 2.95905626288), ncol=5))
> >
> > ## and last 4 values of TS
> >
> > YY<- t(matrix(c(-0.55367226, 3.276980, -0.57634682,
> 3.827854, 4.248918, -0.57806007, 3.254492, -0.61281320,
> 3.835869, 4.280090, -0.51697066,
> > 3.300236, -0.55756556, 3.815981, 4.274613,
> -0.47619582, 3.320164, -0.48689008, 3.793915, 4.216955),
> 5))
> >
> > Given those information, how I can predict values for
> next 2 steps?
> >
> > Thanks,
> >
> > --- On Mon, 12/13/10, Pfaff, Bernhard Dr.<Bernhard_Pfaff at fra.invesco.com>
> wrote:
> >
> >> From: Pfaff, Bernhard Dr.<Bernhard_Pfaff at fra.invesco.com>
> >> Subject: AW: [R-SIG-Finance] Forcasting VAR/VEC
> >> To: "Megh"<megh700004 at yahoo.com>,
> r-sig-finance at stat.math.ethz.ch
> >> Date: Monday, December 13, 2010, 2:19 PM
> >> ?vars::predict
> >>
> >>> -----Ursprüngliche Nachricht-----
> >>> Von: r-sig-finance-bounces at r-project.org
> >>> [mailto:r-sig-finance-bounces at r-project.org]
> >> Im Auftrag von Megh
> >>> Gesendet: Montag, 13. Dezember 2010 07:57
> >>> An: r-sig-finance at stat.math.ethz.ch
> >>> Betreff: [R-SIG-Finance] Forcasting VAR/VEC
> >>>
> >>>
> >>> Hi dears, I am looking for some function to
> predict
> >> through
> >>> horizon "h", say, given the corefficients of a
> VAR/VEC
> >> model.
> >>> I have moderately gone through packages
> "urca"&
> >> "vars" but
> >>> did not find any significant:
> >>>
> >>>> ls("package:vars")
> >>> [1] "A"
> >> "Acoef"
> "arch"
> >>> "arch.test" "B"
> >>
> >>> "Bcoef"
> "BQ"
> >>
> "causality"
> >>> [9] "fanchart"
> >> "fevd"
> "irf"
> >>
> >>> "normality"
> "normality.test" "Phi"
> >> "Psi"
> "restrict"
> >>> [17] "roots"
> >> "serial"
> "serial.test"
> >>> "stability" "SVAR"
> >> "SVEC"
> "VAR"
> "VARselect"
> >>> [25] "vec2var"
> >>>> ls("package:urca")
> >>> [1] "ablrtest"
> >> "alphaols" "alrtest"
> "bh5lrtest"
> >>> "bh6lrtest" "blrtest"
> >> "ca.jo"
> "ca.po"
> >>> [9] "cajolst"
> >> "cajools"
> "cajorls"
> "lttest"
> >>> "plot"
> >>
> >>> "plotres"
> >> "punitroot"
> "qunitroot"
> >>> [17] "summary"
> >> "unitrootTable"
> "ur.df" "ur.ers"
> >>
> >>> "ur.kpss"
> "ur.pp"
> >>
> "ur.sp"
> "ur.za"
> >>> Can somebofy help in finding any relevant
> function for
> >> prediction?
> >>> Thanks,
> >>> --
> >>> View this message in context:
> >>> http://r.789695.n4.nabble.com/Forcasting-VAR-VEC-tp3084994p308
> >> 4994.html
> >>> Sent from the Rmetrics mailing list archive
> at
> >> Nabble.com.
> >>>
> _______________________________________________
> >>> R-SIG-Finance at r-project.org
> >> mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >>> -- Subscriber-posting only. If you want to
> post,
> >> subscribe first.
> >>> -- Also note that this is not the r-help list
> where
> >> general R
> >>> questions should go.
> >>>
> >>
> *****************************************************************
> >> 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-SIG-Finance at r-project.org
> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post,
> subscribe first.
> > -- Also note that this is not the r-help list where
> general R questions should go.
>
>
More information about the R-SIG-Finance
mailing list