Skip to contents

Package

Forecast package

forecast-package
forecast: Forecasting Functions for Time Series and Linear Models

Time series analysis

Functions for working with time series

msts()
Multi-Seasonal Time Series
subset(<ts>) subset(<msts>)
Subsetting a time series
bizdays()
Number of trading days in each season
easter()
Easter holidays in each season
monthdays()
Number of days in each season
fourier() fourierf()
Fourier terms for modelling seasonality
seasonaldummy() seasonaldummyf()
Seasonal dummy variables
findfrequency()
Find dominant frequency of a time series
BoxCox() InvBoxCox()
Box Cox Transformation
BoxCox.lambda()
Automatic selection of Box Cox transformation parameter
tsclean()
Identify and replace outliers and missing values in a time series
tsoutliers()
Identify and replace outliers in a time series
na.interp()
Interpolate missing values in a time series
ndiffs()
Number of differences required for a stationary series
nsdiffs()
Number of differences required for a seasonally stationary series
ocsb.test()
Osborn, Chui, Smith, and Birchenhall Test for Seasonal Unit Roots
bld.mbb.bootstrap()
Box-Cox and Loess-based decomposition bootstrap.
is.constant()
Is an object constant?

Seasonal decomposition

Functions used in seasonal decomposition

ma()
Moving-average smoothing
mstl()
Multiple seasonal decomposition
seasadj()
Seasonal adjustment
seasonal() trendcycle() remainder()
Extract components from a time series decomposition

Modelling

Functions for estimating time series models

arfima()
Fit a fractionally differenced ARFIMA model
Arima()
Fit ARIMA model to univariate time series
auto.arima()
Fit best ARIMA model to univariate time series
ets()
Exponential smoothing state space model
baggedModel() baggedETS()
Forecasting using a bagged model
bats()
BATS model (Exponential smoothing state space model with Box-Cox transformation, ARMA errors, Trend and Seasonal components)
tbats()
TBATS model (Exponential smoothing state space model with Box-Cox transformation, ARMA errors, Trend and Seasonal components)
nnetar()
Neural Network Time Series Forecasts
forecast(<stl>) stlm() forecast(<stlm>) stlf()
Forecasting using stl objects
tslm()
Fit a linear model with time series components

Forecasting

Functions for producing forecasts

rwf() naive() snaive()
Naive and Random Walk Forecasts
meanf()
Mean Forecast
ses() holt() hw()
Exponential smoothing forecasts
dshw()
Double-Seasonal Holt-Winters Forecasting
forecast(<stl>) stlm() forecast(<stlm>) stlf()
Forecasting using stl objects
splinef()
Cubic Spline Forecast
thetaf()
Theta method forecast
croston()
Forecasts for intermittent demand using Croston's method
modelAR()
Time Series Forecasts with a user-defined model
sindexf()
Forecast seasonal index
forecast(<fracdiff>) forecast(<Arima>) forecast(<ar>)
Forecasting using ARIMA or ARFIMA models
forecast(<ets>)
Forecasting using ETS models
forecast(<baggedModel>)
Forecasting using a bagged model
forecast(<bats>) forecast(<tbats>)
Forecasting using BATS and TBATS models
forecast(<HoltWinters>)
Forecasting using Holt-Winters objects
forecast(<lm>)
Forecast a linear model with possible time series components
forecast(<mlm>)
Forecast a multiple linear model with possible time series components
forecast(<modelAR>)
Forecasting using user-defined model
forecast(<mts>)
Forecasting time series
forecast(<nnetar>)
Forecasting using neural network models
forecast(<StructTS>)
Forecasting using Structural Time Series models
forecast(<ts>) forecast(<default>) print(<forecast>)
Forecasting time series
is.forecast() is.mforecast() is.splineforecast()
Is an object a particular forecast type?

Plotting

Functions for plotting time series and forecasts

gghistogram()
Histogram with optional normal and kernel density functions
ggseasonplot() seasonplot()
Seasonal plot
ggmonthplot() ggsubseriesplot()
Create a seasonal subseries ggplot
gglagplot() gglagchull()
Time series lag ggplots
Acf() Pacf() Ccf() taperedacf() taperedpacf()
(Partial) Autocorrelation and Cross-Correlation Function Estimation
autoplot(<acf>) ggAcf() ggPacf() ggCcf() autoplot(<mpacf>) ggtaperedacf() ggtaperedpacf()
ggplot (Partial) Autocorrelation and Cross-Correlation Function Estimation and Plotting
ggtsdisplay() tsdisplay()
Time series display
checkresiduals()
Check that residuals from a time series model look like white noise
StatForecast GeomForecast geom_forecast()
Forecast plot
plot(<Arima>) plot(<ar>) autoplot(<Arima>) autoplot(<ar>)
Plot characteristic roots from ARIMA model
plot(<bats>) autoplot(<tbats>) autoplot(<bats>) plot(<tbats>)
Plot components from BATS model
plot(<ets>) autoplot(<ets>)
Plot components from ETS model
plot(<forecast>) autoplot(<forecast>) autoplot(<splineforecast>) autolayer(<forecast>) plot(<splineforecast>)
Forecast plot
autoplot(<mforecast>) autolayer(<mforecast>) plot(<mforecast>)
Multivariate forecast plot
autoplot(<decomposed.ts>) autoplot(<stl>) autoplot(<StructTS>) autoplot(<seas>) autoplot(<mstl>)
Plot time series decomposition components using ggplot
autolayer(<mts>) autolayer(<msts>) autolayer(<ts>) autoplot(<ts>) autoplot(<mts>) autoplot(<msts>) fortify(<ts>)
Automatically create a ggplot for time series objects
autolayer()
Create a ggplot layer appropriate to a particular data type
is.acf() is.Arima() is.baggedModel() is.bats() is.ets() is.modelAR() is.stlm() is.nnetar() is.nnetarmodels()
Is an object a particular model type?

Model analysis

Functions for analysing time series models

fitted(<ARFIMA>) fitted(<Arima>) fitted(<ar>) fitted(<bats>) fitted(<ets>) fitted(<modelAR>) fitted(<nnetar>) fitted(<tbats>)
h-step in-sample forecasts for time series models.
residuals(<forecast>) residuals(<ar>) residuals(<Arima>) residuals(<bats>) residuals(<tbats>) residuals(<ets>) residuals(<ARFIMA>) residuals(<nnetar>) residuals(<stlm>) residuals(<tslm>)
Residuals for various time series models
checkresiduals()
Check that residuals from a time series model look like white noise
arimaorder()
Return the order of an ARIMA or ARFIMA model
arima.errors()
Errors from a regression model with ARIMA errors
simulate(<ets>) simulate(<Arima>) simulate(<ar>) simulate(<lagwalk>) simulate(<fracdiff>) simulate(<nnetar>) simulate(<modelAR>) simulate(<tbats>)
Simulation from a time series model
tbats.components()
Extract components of a TBATS model
getResponse()
Get response variable from time series model.
modeldf()
Compute model degrees of freedom

Forecast evaluation

Functions used for evaluating forecasts

accuracy(<default>)
Accuracy measures for a forecast model
CVar()
k-fold Cross-Validation applied to an autoregressive model
CV()
Cross-validation statistic
tsCV()
Time series cross-validation
dm.test()
Diebold-Mariano test for predictive accuracy

Data

Data sets included in the package

gas
Australian monthly gas production
gold
Daily morning gold prices
taylor
Half-hourly electricity demand
wineind
Australian total wine sales
woolyrnq
Quarterly production of woollen yarn in Australia