Skip to content

Export Forecasted output to a table (excel)

9 messages · Lal Prasad, Rolf Turner, Daniel Nordlund +3 more

#
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
#
On 02/02/17 08:03, Lal Prasad wrote:
(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
#
On 2/1/2017 2:05 PM, Rolf Turner wrote:
Unfortunately, that link appears to be broken / does not exist anymore.

Dan
#
A google-search quickly turned up this:

http://people.stat.sfu.ca/~cschwarz/Stat-650/Notes/Handouts.readings/ExcelPracticalforStat.pdf
David Winsemius
Alameda, CA, USA
#
That did seem somewhat dated after I read it (being 15 years old) and I think other resources might be more current:

https://web.stanford.edu/group/ssds/cgi-bin/drupal/files/Guides/Using%20Excel%20for%20Data%20Manipulation%20and%20Statistical%20Analysis_1.pdf

http://people.umass.edu/evagold/excel.html

http://www.burns-stat.com/documents/tutorials/spreadsheet-addiction

http://www.phusewiki.org/docs/2009%20PAPERS/SP06.pdf

http://homepages.ulb.ac.be/~gmelard/rech/gmelard_csda23.pdf
#
On 02/02/17 11:25, Daniel Nordlund wrote:
Thanks for pointing that out Dan.  The following rather messy link does 
seem to work. The line gets wrapped (at least it does in my mailer) so 
you may need to mess around copying and pasting.

https://www.google.co.nz/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwilxsmC_O_RAhVEmJQKHeTKDrkQFggYMAA&url=https%3A%2F%2Foit.utk.edu%2Fresearch%2Fdocumentation%2FDocuments%2FExcelStatProbs.pdf&usg=AFQjCNEocZnHA4b9_9FNxkD2lzHBA9EaNw

cheers,

Rolf

P.S.  See also:

http://www.burns-stat.com/documents/tutorials/spreadsheet-addiction/

R.
#
The original 2001 JSM presentation by Jon Cryer is available here:

  https://oit.utk.edu/research/documentation/Documents/ExcelStatProbs.pdf

and here:

  http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.617.4297&rep=rep1&type=pdf

It would appear that he has retired from Iowa and may no longer have an online directory.

Patrick Burns also has a very good presentation and a reference listing here:

  http://www.burns-stat.com/documents/tutorials/spreadsheet-addiction/

as does Frank:

  http://biostat.mc.vanderbilt.edu/wiki/Main/ExcelProblems


FWIW, in the context of a nuanced response and differentiating between using Excel for any actual analyses, which is largely what the above references are warning against and simply for narrowly exporting R results, there are various packages available that can facilitate that, presuming you solve the underlying issue of getting the data into a compatible format (e.g. data frame).

The R Data Import/Export Manual is helpful here:

  https://cran.r-project.org/doc/manuals/r-release/R-data.html

The use of the ?str function can help provide insights into the structure of the returned object and how you might access selected components of the structure to achieve your goal.

An alternative to using Excel would be to use something like the Knitr package, which supports the use of markdown and can facilitate exporting formatted tables, etc. to HTML, PDF and so forth:

  https://yihui.name/knitr/


Regards,

Marc Schwartz
#
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:

            

  
  
#
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: