Learn R Programming

fable

The R package fable provides a collection of commonly used univariate and multivariate time series forecasting models including exponential smoothing via state space models and automatic ARIMA modelling. These models work within the fable framework, which provides the tools to evaluate, visualise, and combine models in a workflow consistent with the tidyverse.

Installation

You can install the stable version from CRAN:

install.packages("fable")

You can install the development version from GitHub

# install.packages("remotes")
remotes::install_github("tidyverts/fable")

Installing this software requires a compiler

Example

library(fable)
library(tsibble)
library(tsibbledata)
library(lubridate)
library(dplyr)
aus_retail %>%
  filter(
    State %in% c("New South Wales", "Victoria"),
    Industry == "Department stores"
  ) %>% 
  model(
    ets = ETS(box_cox(Turnover, 0.3)),
    arima = ARIMA(log(Turnover)),
    snaive = SNAIVE(Turnover)
  ) %>%
  forecast(h = "2 years") %>% 
  autoplot(filter(aus_retail, year(Month) > 2010), level = NULL)

Learning to forecast with fable

  • The pkgdown site describes all models provided by fable, and how they are used: https://fable.tidyverts.org/
  • The forecasting principles and practices online textbook provides an introduction to time series forecasting using fable: https://otexts.com/fpp3/ (WIP)

Getting help

  • Questions about forecasting can be asked on Cross Validated.

  • Common questions about the fable package are often found on Stack Overflow. You can use this to ask for help if the question isn’t already answered. A minimally reproducible example that describes your issue is the best way to ask for help!

Copy Link

Version

Install

install.packages('fable')

Monthly Downloads

17,807

Version

0.4.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Last Published

September 25th, 2024

Functions in fable (0.4.0)

ETS

Exponential smoothing state space model
THETA

Theta method
common_xregs

Common exogenous regressors
components.ETS

Extract estimated states from an ETS model.
forecast.AR

Forecast a model from the fable package
VAR

Estimate a VAR model
fitted.model_mean

Extract fitted values from a fable model
VARIMA

Estimate a VARIMA model
forecast.model_mean

Forecast a model from the fable package
fitted.ETS

Extract fitted values from a fable model
fitted.TSLM

Extract fitted values from a fable model
TSLM

Fit a linear model with time series components
fitted.VAR

Extract fitted values from a fable model
RW

Random walk models
fitted.ARIMA

Extract fitted values from a fable model
refit.NNETAR

Refit a NNETAR model
refit.ETS

Refit an ETS model
VECM

Estimate a VECM model
generate.AR

Generate new data from a fable model
glance.AR

Glance a AR
glance.ARIMA

Glance an ARIMA model
interpolate.ARIMA

Interpolate missing values from a fable model
forecast.croston

Forecast a model from the fable package
forecast.fable_theta

Forecast a model from the fable package
forecast.ARIMA

Forecast a model from the fable package
residuals.TSLM

Extract residuals from a fable model
interpolate.TSLM

Interpolate missing values from a fable model
fable-package

fable: Forecasting Models for Tidy Time Series
interpolate.model_mean

Interpolate missing values from a fable model
forecast.ETS

Forecast a model from the fable package
generate.TSLM

Generate new data from a fable model
generate.VAR

Generate new data from a fable model
glance.fable_theta

Glance a theta method
generate.ARIMA

Generate new data from a fable model
reexports

Objects exported from other packages
breusch_godfrey

Breusch-Godfrey Test
residuals.croston

Extract residuals from a fable model
fitted.croston

Extract fitted values from a fable model
fitted.NNETAR

Extract fitted values from a fable model
fitted.AR

Extract fitted values from a fable model
fitted.fable_theta

Extract fitted values from a fable model
generate.RW

Generate new data from a fable model
generate.NNETAR

Generate new data from a fable model
forecast.TSLM

Forecast a model from the fable package
forecast.VAR

Forecast a model from the fable package
fitted.RW

Extract fitted values from a fable model
glance.RW

Glance a lag walk model
glance.model_mean

Glance a average method model
residuals.VAR

Extract residuals from a fable model
glance.TSLM

Glance a TSLM
forecast.NNETAR

Forecast a model from the fable package
refit.AR

Refit an AR model
refit.ARIMA

Refit an ARIMA model
tidy.ARIMA

Tidy a fable model
tidy.ETS

Tidy a fable model
generate.VECM

Generate new data from a fable model
forecast.RW

Forecast a model from the fable package
tidy.model_mean

Tidy a fable model
unitroot_options

Options for the unit root tests for order of integration
generate.ETS

Generate new data from a fable model
residuals.NNETAR

Extract residuals from a fable model
residuals.fable_theta

Extract residuals from a fable model
glance.ETS

Glance an ETS model
glance.NNETAR

Glance a NNETAR model
refit.RW

Refit a lag walk model
generate.model_mean

Generate new data from a fable model
glance.VAR

Glance a VAR
glance.VECM

Glance a VECM
refit.model_mean

Refit a MEAN model
refit.TSLM

Refit a TSLM
residuals.AR

Extract residuals from a fable model
residuals.model_mean

Extract residuals from a fable model
tidy.AR

Tidy a fable model
residuals.RW

Extract residuals from a fable model
tidy.NNETAR

Tidy a fable model
tidy.RW

Tidy a fable model
residuals.ETS

Extract residuals from a fable model
residuals.ARIMA

Extract residuals from a fable model
tidy.TSLM

Tidy a fable model
tidy.croston

Tidy a fable model
tidy.VAR

Tidy a fable model
tidy.fable_theta

Tidy a fable model
IRF.VAR

Calculate impulse responses from a fable model
ARIMA

Estimate an ARIMA model
IRF.ARIMA

Calculate impulse responses from a fable model
IRF.VECM

Calculate impulse responses from a fable model
MEAN

Mean models
CROSTON

Croston's method
AR

Estimate a AR model
NNETAR

Neural Network Time Series Forecasts