Forecasting Functions for Time Series and Linear Models

Methods and tools for displaying and analysing univariate time series forecasts including exponential smoothing via state space models and automatic ARIMA modelling.


The R package forecast provides methods and tools for displaying and analysing univariate time series forecasts including exponential smoothing via state space models and automatic ARIMA modelling.

You can install the stable version on R CRAN.

install.packages('forecast', dependencies = TRUE)

You can install the development version from Github

# install.packages("devtools")
devtools::install_github("robjhyndman/forecast")
library(forecast)
 
# ETS forecasts
fit <- ets(USAccDeaths)
plot(forecast(fit))
 
# Automatic ARIMA forecasts
fit <- auto.arima(WWWusage)
plot(forecast(fit, h=20))
 
# ARFIMA forecasts
library(fracdiff)
x <- fracdiff.sim( 100, ma=-.4, d=.3)$series
fit <- arfima(x)
plot(forecast(fit, h=30))
 
# Forecasting with STL
tsmod <- stlm(USAccDeaths, modelfunction=ar)
plot(forecast(tsmod, h=36))
 
plot(stlf(AirPassengers, lambda=0))
 
decomp <- stl(USAccDeaths,s.window="periodic")
plot(forecast(decomp))
 
# TBATS forecasts
fit <- tbats(USAccDeaths)
plot(forecast(fit))
 
taylor.fit <- tbats(taylor)
plot(forecast(taylor.fit))

This package is free and open source software, licensed under GPL (>= 2).

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.