The forecast package for R, created and maintained by Professor Rob Hyndman of Monash University, is one of the more useful R packages available available on CRAN. 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 Forecasting: Principles and Practice (by Hyndman and George Athanasopoulos) which walks you through the theory and practice, with many examples in R based on the forecast package. Topics covered include multiple regression, Time series decomposition, exponential smoothing, and ARIMA models.
The forecast package itself recently received a major update, to version 7. One major new capability is the ability to easily chart forecasts using the ggplot2 package with the new autoplot function. For example:
fc <- forecast(fdeaths) autoplot(fc)
You can also add forecasts to any ggplot using the new geom_forecasts geom provided by the forecast package:
autoplot(mdeaths) + geom_forecast(h=36, level=c(50,80,95))
There have been several updates to the forecasting functions as well. The function for fitting linear models to time series data, tslm, has been rewritten to be more compatible with the standard lm 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 nnetar function.
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.
Hyndsight: forecast v7 and ggplot2 graphics ; Forecast v7 (part 2) (via traims)
The "forecast" package is indeed the best tool out there for automatic model selection. In the context of business where many models must be automated to run on a schedule, and an expert cannot tune and select the individual models, it offers a methodologically sound approach to this problem. As an extension to this, the individual models can be combined to form a composite model that is more stable on a wide range of datasets and more accurate. This approach should be familiar to those who do machine learning and utilize ensembles/stacking. See the "forecastHybrid" package for tools to do the ensemble automatically.
Posted by: David Shaub | June 23, 2016 at 12:17