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.


forecast

R-CMD-check CRAN_Status_Badge Downloads Licence

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.

A complementary forecasting package is the fable package, which implements many of the same models but in a tidyverse framework.

Installation

You can install the stable version from CRAN.

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

You can install the development version from Github

# install.packages("pak")
pak::pak("robjhyndman/forecast")

Usage

library(forecast)
library(ggplot2)

# ETS forecasts
USAccDeaths |>
  ets() |>
  forecast() |>
  autoplot()

# Automatic ARIMA forecasts
WWWusage |>
  auto.arima() |>
  forecast(h = 20) |>
  autoplot()

# ARFIMA forecasts
library(fracdiff)
x <- fracdiff.sim(100, ma = -0.4, d = 0.3)$series
arfima(x) |>
  forecast(h = 30) |>
  autoplot()

# Forecasting with STL
USAccDeaths |>
  stlm(modelfunction = ar) |>
  forecast(h = 36) |>
  autoplot()

AirPassengers |>
  stlf(lambda = 0) |>
  autoplot()

USAccDeaths |>
  stl(s.window = "periodic") |>
  forecast() |>
  autoplot()

# TBATS forecasts
USAccDeaths |>
  tbats() |>
  forecast() |>
  autoplot()

taylor |>
  tbats() |>
  forecast() |>
  autoplot()

For more information

License

This package is free and open source software, licensed under GPL-3.

Reference manual

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

install.packages("forecast")

9.0.2 by Rob Hyndman, 7 months ago


https://pkg.robjhyndman.com/forecast/, https://github.com/robjhyndman/forecast


Report a bug at https://github.com/robjhyndman/forecast/issues


Browse source code at https://github.com/cran/forecast


Authors: Rob Hyndman [aut, cre, cph] (ORCID: , George Athanasopoulos [aut] (ORCID: , Christoph Bergmeir [aut] (ORCID: , Gabriel Caceres [aut] , Leanne Chhay [aut] , Kirill Kuroptev [aut] , Maximilian Mücke [aut] , Mitchell O'Hara-Wild [aut] (ORCID: , Fotios Petropoulos [aut] (ORCID: , Slava Razbash [aut] , Earo Wang [aut] , Farah Yasmeen [aut] , Federico Garza [ctb] , Daniele Girolimetto [ctb] , Ross Ihaka [ctb, cph] , R Core Team [ctb, cph] , Daniel Reid [ctb] , David Shaub [ctb] , Yuan Tang [ctb] , Xiaoqian Wang [ctb] , Zhenyu Zhou [ctb]


Documentation:   PDF Manual  


GPL-3 license


Imports colorspace, fracdiff, generics, ggplot2, graphics, lmtest, magrittr, nnet, parallel, Rcpp, stats, timeDate, urca, withr, zoo

Suggests forecTheta, knitr, methods, rmarkdown, rticles, scales, seasonal, testthat, uroot

Linking to Rcpp, RcppArmadillo


Imported by ACV, AEDForecasting, AFR, ARInfoLSTM, ATAforecasting, AriGaMyANNSVR, ArvindSt, AutoAds, AutoNN, BrazilCrime, CDSimX, CEEMDANML, CGMissingDataR, ConsReg, CvmortalityMult, DendroFlux, EEMDelm, EQUALrepeat, EWSmethods, EXPAR, EXPARMA, EcoMetrics, ForeComp, HDTSA, InterNL, KarsTS, MAARTS, MSGARCHelm, ModalForecast, MortalityGaps, NRMstatsML, OBL, PH1XBAR, PortalHacienda, RcmdrPlugin.RiskDemo, SBAGM, SMOARIMA, Saylac, ScottKnottESD, TCIU, TSANN, TSF, TSPred, TSstudio, Tcomp, TrendSLR, Tushare, VMDML, WRTDStidal, WaveST, WaveletANN, WaveletArima, WaveletETS, WaveletGARCH, WaveletML, WaveletRF, WaveletSVR, actfts, armaOptions, autoTS, autostsm, bayesforecast, betaARMA, beyondWhittle, bfast, bmgarch, boiwsa, bridgr, caretForecast, chopper, clmplus, coconots, compIndexBuilder, cricketr, decompML, decomposedPSF, demofit, demor, dendRoAnalyst, doBy, dsa, ecorisk, eemdARIMA, eemdTDNN, epicasting, estadistica, exmort, fDMA, finnts, forecastLSW, forecasteR, fpp2, fracARMA, gratis, grattan, harbinger, hpiR, hybridts, iClick, idionomics, imputeCGM, imputeTS, imputeTestbench, its.analysis, knnp, kssa, lfl, lineartestr, matman, midasr, modeltime, mrf, narfima, netseer, ngboostForecast, nnfor, nortsTest, outliers.ts.oga, paramsim, popstudy, portalr, portes, postshock, predtoolsTS, rcrimeanalysis, seastests, seer, shinyTempSignal, spduration, stR, stlARIMA, stlELM, stlTDNN, sweep, timetk, toscca, trendtestR, tsBSS, tsSelect, tsaux, tscv, tsfeatures, tsforecast, tsoutliers, tspredit, tssim, tsutils, tsviz, tswge, ubair, uotm, utsf, vmdTDNN, wired.

Depended on by ARIMAANN, DIMORA, Dowd, ECTTDNN, EMDANNhybrid, MAPA, Mcomp, Rlgt, Rssa, StMoMo, THETASVM, TSSVM, ZRA, conformalForecast, demography, dendrometeR, expsmooth, fma, forecTheta, forecastHybrid, ftsa, garma, hdftsa, hts, thief.

Suggested by AER, COINT, Dyn4cast, FinanceGraphs, GACE, GREENREG, ICompELM, MARSS, PSF, R4VN, Rbearcat, accuracylevel, arimasel, bayesRecon, corset, dlookr, epimdr, epimdr2, equatiomatic, fChange, fable, fableCount, flap, fracdiff, ggfortify, healthyR.ts, highcharter, htsDegenerateR, iForecast, icomb, ivx, lazybar, lifecontingencies, mFilter, mellio, mlr, mlr3forecast, nullabor, origami, pander, performance, pmml, rainbow, riem, rpanelauto, sarima, setartree, shapr, tactile, trajectories, tsbox, vctsfr.

Enhanced by greybox, texreg.


See at CRAN