Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ellisp/forecastHybrid

Convenient functions for ensemble forecasts in R combining approaches from the {forecast} package
https://github.com/ellisp/forecastHybrid

Last synced: 3 days ago
JSON representation

Convenient functions for ensemble forecasts in R combining approaches from the {forecast} package

Awesome Lists containing this project

README

        

[![Travis-CI Build Status](https://travis-ci.org/ellisp/forecastHybrid.svg?branch=master)](https://travis-ci.org/ellisp/forecastHybrid)
[![Coverage Status](https://coveralls.io/repos/github/ellisp/forecastHybrid/badge.svg?branch=master)](https://coveralls.io/github/ellisp/forecastHybrid?branch=master)
[![CRAN version](http://www.r-pkg.org/badges/version/forecastHybrid)](http://www.r-pkg.org/pkg/forecastHybrid)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/forecastHybrid)](http://www.r-pkg.org/pkg/forecastHybrid)

# forecastHybrid
Convenient functions for ensemble forecasts in R combining approaches from the [forecast](https://github.com/robjhyndman/forecast) package.

For a more detailed description of the package and usage, consult the [vignette](https://cran.r-project.org/web/packages/forecastHybrid/vignettes/forecastHybrid.html).

The package is still under heavy development, but many basic features have been implemented. Some features (such as optimized parallelization between rather than within models, cross validation for determing model error rates, and automatically selecting the optimal combination of base models) have not yet been developed.

## Installation
The stable release of the package is hosted on [CRAN](https://cran.r-project.org/web/packages/forecastHybrid/index.html) and can be installed as usual:
````r
install.packages("forecastHybrid")
````

The latest development version can be installed using the [devtools](https://cran.r-project.org/web/packages/devtools/index.html) package.

```{r eval = FALSE}
devtools::install_github("ellisp/forecastHybrid/pkg")
```
Version updates to CRAN will be published frequently after new features are implemented, so the development version is not recommended unless you plan to modify the code.

## Usage

```{r cache = TRUE}
library(forecastHybrid)

# Build a hybrid forecast on the wineind dataset using auto.arima, ets, and tbats models.
# Each model is given equal weight
hm1 <- hybridModel(wineind, models = "aet", weights = "equal")

# Now plot the forecast for the next 48 periods
plot(forecast(hm1, h = 48))

# Build the ensemble model on the same data but this time use auto.arima, nnetar, stlm, and tbats models.
hm2 <- hybridModel(wineind, models = "anst", weights = "equal")

# Now plot the forecast for the next 48 periods
plot(forecast(hm2, h = 48))

# Extract the point forecasts from this model
fc <- forecast(hm2, h = 48)
fc$mean

# Extract the (default) upper 80% and 95% prediction intervals
fc$upper
# Extract the (default) lower 80% and 95% prediction intervals
fc$lower

# Produce a forecast with prediction intervals at the 70%, 80%, 90%, and 95% levels
fc2 <- forecast(hm2, h = 48, level = c(70, 80, 90, 95))
```