<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/"></div></div><div><a data-url="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/" data-counturl="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/" data-count="horizontal" data-text="Updates to the ‘forecast’ package for R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2016/06/updates-to-the-forecast-package-for-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>The <a target="_blank" href="http://robjhyndman.com/software/forecast/">forecast package</a> for R, created and maintained by Professor Rob Hyndman of Monash University, is one of the more useful R packages available <a target="_blank" href="https://mran.microsoft.com/package/forecast/">available on CRAN</a>. Statistical forecasting — the process of predicting the future value of a time series — is used in just about every realm of data analysis, whether it's trying to predict a future stock price or trying to anticipate changes in the weather. If you're looking to learn about forecasting, a great place to start is the online book <a target="_blank" href="https://www.otexts.org/fpp">Forecasting: Principles and Practice</a> (by Hyndman and George Athana­sopou­los) which walks you through the theory and practice, with many examples in R based on the forecast package. Topics covered include <a target="_blank" href="https://www.otexts.org/fpp/5">multiple regression</a>, <a target="_blank" href="https://www.otexts.org/fpp/6">Time series decomposition</a>, <a target="_blank" href="https://www.otexts.org/fpp/7">exponential smoothing</a>, and <a target="_blank" href="https://www.otexts.org/fpp/8">ARIMA models</a>.</p>
<p>The forecast package itself recently received a major update, to version 7. One major new capability is the ability to easily <a target="_blank" href="http://robjhyndman.com/hyndsight/forecast7-ggplot2/">chart forecasts using the ggplot2 package</a> with the new <span>autoplot</span> function. For example:</p>
<pre>fc &lt;- forecast(fdeaths)
autoplot(fc)<br> <a target="_blank" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c870ff11970b-pi"><img title="Autoplot" alt="Autoplot" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c870ff11970b-800wi" border="0"></a><br><br></pre>
<p>You can also add forecasts to any ggplot using the new geom_forecasts geom provided by the forecast package:</p>
<pre>autoplot(mdeaths) + geom_forecast(h=36, level=c(50,80,95))</pre>
<p><a target="_blank" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c870fd2d970b-pi"><img title="Geom_forecast" alt="Geom_forecast" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c870fd2d970b-800wi" border="0"></a></p>
<p>There have been <a target="_blank" href="http://robjhyndman.com/hyndsight/forecast7-part-2/">several updates to the forecasting functions</a> as well. The function for fitting linear models to time series data, <span>tslm</span>, has been rewritten to be more compatible with the standard <span>lm</span> function. It's now possible to forecast means (as well as medians) when using Box-Cox transformations. And you can now apply neural networks to time series data by building a nonlinear autoregressive model with the new <span>nnetar</span> function.</p>
<p>Those are just some of the highlights of the updates to the forecast package in version 7. For complete details, follow the links to Rob Hyndman's blog, below.</p>
<p>Hyndsight: <a target="_blank" href="http://robjhyndman.com/hyndsight/forecast7-ggplot2/">forecast v7 and ggplot2 graphics</a> ; <a target="_blank" href="http://robjhyndman.com/hyndsight/forecast7-part-2/">Forecast v7 (part 2)</a> (<a target="_blank" href="https://twitter.com/traims/status/744586138304778240">via</a> traims)</p>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/"></div></div><div><a data-url="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/" data-counturl="http://www.r-bloggers.com/updates-to-the-forecast-package-for-r/" data-count="vertical" data-text="Updates to the ‘forecast’ package for R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2016/06/updates-to-the-forecast-package-for-r.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/sUL8gMsRwGg"></a></div>