Hi All, Is there any way to 1) Convert the below forecast to a datafram 2) Any way to write it to an excel table? library(vars) library(fpp)VARselect(usconsumption, lag.max = 3, type="const")$selectionvar <- VAR(usconsumption, p=1,type "both",lag.max = 3) serial.test(var, lags.pt = 3,type = "PT.asymptotic") fcst <- forecast(var) Regards Lal [[alternative HTML version deleted]]
Rolf Turner
2017-Feb-01 22:05 UTC
[R] [FORGED] Export Forecasted output to a table (excel)
On 02/02/17 08:03, Lal Prasad wrote:> Hi All, > > Is there any way to > > 1) Convert the below forecast to a datafram > 2) Any way to write it to an excel table? > > > library(vars) > library(fpp)VARselect(usconsumption, lag.max = 3, > type="const")$selectionvar <- VAR(usconsumption, p=1,type > "both",lag.max = 3) > serial.test(var, lags.pt = 3,type = "PT.asymptotic") > > fcst <- forecast(var)(1) Read the posting guide. (2) In particular don't post in HTML. (3) As it appears, your code makes no sense to me. (4) DON'T use Excel. Ever. See: http://www.stat.uiowa.edu/~jcryer/JSMTalk2001.pdf cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
Daniel Nordlund
2017-Feb-01 22:25 UTC
[R] [FORGED] Export Forecasted output to a table (excel)
On 2/1/2017 2:05 PM, Rolf Turner wrote:> On 02/02/17 08:03, Lal Prasad wrote: >> Hi All, >> >> Is there any way to >> >> 1) Convert the below forecast to a datafram >> 2) Any way to write it to an excel table? >> >> >> library(vars) >> library(fpp)VARselect(usconsumption, lag.max = 3, >> type="const")$selectionvar <- VAR(usconsumption, p=1,type >> "both",lag.max = 3) >> serial.test(var, lags.pt = 3,type = "PT.asymptotic") >> >> fcst <- forecast(var) > > (1) Read the posting guide. > > (2) In particular don't post in HTML. > > (3) As it appears, your code makes no sense to me. > > (4) DON'T use Excel. Ever. See: > > http://www.stat.uiowa.edu/~jcryer/JSMTalk2001.pdf > > cheers, > > Rolf Turner >Unfortunately, that link appears to be broken / does not exist anymore. Dan -- Daniel Nordlund Port Townsend, WA USA
Thanks all for the information provided. Is there any way I could convert an object of type mforecast (output of forecast()) to dataframe? On Thu, Feb 2, 2017 at 12:33 AM, Lal Prasad <lal.prasad at gmail.com> wrote:> Hi All, > > Is there any way to > > 1) Convert the below forecast to a datafram > 2) Any way to write it to an excel table? > > > library(vars) > library(fpp)VARselect(usconsumption, lag.max = 3, type="const")$selectionvar <- VAR(usconsumption, p=1,type = "both",lag.max = 3) > serial.test(var, lags.pt = 3,type = "PT.asymptotic") > > fcst <- forecast(var) > > Regards > > Lal > >[[alternative HTML version deleted]]
Hello, Objects of type mforecast are list with many members. In order to have a data.frame you need to tell us which members you want. Do not mistake the output of the print method with the object, to see what mforecast objects are try str(fcst) Rui Barradas Em 02-02-2017 01:55, Lal Prasad escreveu:> Thanks all for the information provided. > Is there any way I could convert an object of type mforecast (output of > forecast()) to dataframe? > > On Thu, Feb 2, 2017 at 12:33 AM, Lal Prasad <lal.prasad at gmail.com> wrote: > >> Hi All, >> >> Is there any way to >> >> 1) Convert the below forecast to a datafram >> 2) Any way to write it to an excel table? >> >> >> library(vars) >> library(fpp)VARselect(usconsumption, lag.max = 3, type="const")$selectionvar <- VAR(usconsumption, p=1,type = "both",lag.max = 3) >> serial.test(var, lags.pt = 3,type = "PT.asymptotic") >> >> fcst <- forecast(var) >> >> Regards >> >> Lal >> >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >