|Maintainer:||Rob J Hyndman, Rebecca Killick|
|Contact:||Rob.Hyndman at monash.edu|
|Contributions:||Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see the Contributing guide.|
|Citation:||Rob J Hyndman, Rebecca Killick (2022). CRAN Task View: Time Series Analysis. Version 2022-07-19. URL https://CRAN.R-project.org/view=TimeSeries.|
|Installation:||The packages from this task view can be installed automatically using the ctv package. For example, |
Base R ships with a lot of functionality useful for time series, in particular in the stats package. This is complemented by many packages on CRAN, which are briefly summarized below. There is overlap between the tools for time series and those designed for specific domains including Econometrics, Finance and Environmetrics.
The packages in this view can be roughly structured into the following topics. If you think that some package is missing from the list, please let us know, either via e-mail to the maintainer or by submitting an issue or pull request in the GitHub repository linked above.
"ts"that can represent regularly spaced time series (using numeric time stamps). Hence, it is particularly well-suited for annual, monthly, quarterly data, etc.
mafrom forecast, and
rollmeanfrom zoo. The latter also provides a general function
rollapply, along with other specific rolling statistics functions. slider calculates a diverse and comprehensive set of type-stable running functions for any R data types. tsibble provides
slide()for rolling statistics,
tile()for non-overlapping sliding windows, and
stretch()for expanding windows. tbrf provides rolling functions based on date and time windows instead of n-lagged observations. roll provides parallel functions for computing rolling statistics. runner provides tools for running any R function in rolling windows or date windows. runstats provides fast computational methods for some running sample statistics. For data.table,
froll()can be used for high-performance rolling statistics.
tsobjects. (Partial) autocorrelation functions plots are implemented in
pacf(). Alternative versions are provided by
Pacf()in forecast, along with a combination display using
tsdisplay(). Seasonal displays are obtained using
seasonplotin forecast, and
seasplotin tsutils. feasts and brolgar provide various time series graphics for tsibble objects including time plots, season plots, subseries plots, ACF and PACF plots, and some combination displays. Interactive graphics for tsibbles using htmlwidgets are provided by tsibbletalk. dCovTS computes and plots the distance covariance and correlation functions of time series. ggseas provides additional ggplot2 graphics for seasonally adjusted series and rolling statistics. Calendar plots are implemented in sugrrants. gravitas allows for visualizing probability distributions conditional on bivariate temporal granularities. dygraphs provides an interface to the Dygraphs interactive time series charting library. TSstudio provides some interactive visualization tools for time series. ZRA plots forecast objects from the forecast package using dygraphs. Basic fan plots of forecast distributions are provided by forecast and vars. More flexible fan plots of any sequential distributions are implemented in fanplot.
"ts"can only deal with numeric time stamps, but many more classes are available for storing time/date information and computing with it. For an overview see R Help Desk: Date and Time Classes in R by Gabor Grothendieck and Thomas Petzoldt in R News 4(1), 29-32.
"yearqtr"from zoo allow for more convenient computation with monthly and quarterly observations, respectively.
"Date"from the base package is the basic class for dealing with dates in daily data. The dates are internally stored as the number of days since 1970-01-01.
hours()and date/time (intra-day) in
chron(). There is no support for time zones and daylight savings time. Internally,
"chron"objects are (fractional) days since 1970-01-01.
"POSIXlt"implement the POSIX standard for date/time (intra-day) information and also support time zones and daylight savings time. However, the time zone computations require some care and might be system-dependent. Internally,
"POSIXct"objects are the number of seconds since 1970-01-01 00:00:00 GMT. Package lubridate provides functions that facilitate certain POSIX-based computations, while clock provides a comprehensive library for date-time manipulations using a new family of orthogonal date-time classes (durations, time points, zoned-times, and calendars). timechange allows for efficient manipulation of date-times accounting for time zones and daylight saving times. wktmo converts weekly data to monthly data in several different ways.
"timeDate"is provided in the timeDate package (previously: fCalendar). It is aimed at financial time/date information and deals with time zones and daylight savings times via a new concept of “financial centers”. Internally, it stores all information in
"POSIXct"and does all computations in GMT only. Calendar functionality, e.g., including information about weekends and holidays for various stock exchanges, is also included.
"ti"class for time/date information.
"mondate"class from the mondate package facilitates computing with dates in terms of months.
"ts"is the basic class for regularly spaced time series using numeric time stamps.
shift()for lead/lag operations. Further basic time series functionalities are offered by DTSg which is based on data.table. dtts provides high-frequency time series support via nanotime and data.table.
"POSIXct"time stamps, intended especially for financial applications. These include
"timeSeries"in timeSeries (previously: fSeries) implements time series with
"tis"in tis implements time series with
tsobjects to PostgreSQL relations.
tsibbleformat. fabletools provides tools for extending the fable framework.
tsobjects, while modeltime and modeltime.ensemble provides time series forecasting tools for use with the ‘tidymodels’ ecosystem.
HoltWinters()in stats provides some basic models with partial optimization,
ETS()from fable and
ets()from forecast provide a larger set of models and facilities with full optimization. robets provides a robust alternative to the
ets()function. smooth implements some generalizations of exponential smoothing. legion implements multivariate versions of exponential smoothing. The MAPA package combines exponential smoothing models at different levels of temporal aggregation to improve forecast accuracy. Some Bayesian extensions of exponential smoothing are contained in Rlgt.
THETA()function from fable,
thetaf()function from forecast, and
theta()from tsutils. An alternative and extended implementation is provided in forecTheta.
ar()in stats (with model selection).
arima()in stats is the basic function for ARIMA, SARIMA, RegARIMA, and subset ARIMA models. It is enhanced in the fable package via the
ARIMA()function which allows for automatic modelling. Similar functionality is provided in the forecast package via the
arma()in the tseries package provides different algorithms for ARMA and subset ARMA models. Other estimation methods including the innovations algorithm are provided by itsmr. Package gsarima contains functionality for Generalized SARIMA time series simulation. Robust ARIMA modeling is provided in the robustarima package. bayesforecast fits Bayesian time series models including seasonal ARIMA and ARIMAX models. BayesARIMAX implements Bayesian estimation of ARIMAX models. The mar1s package handles multiplicative AR(1) with seasonal processes. TSTutorial provides an interactive tutorial for Box-Jenkins modelling. Improved prediction intervals for ARIMA and structural time series models are provided by tsPI.
arfimafunction in the arfima and the tfarima packages.
StructTS()in stats, while automatic modelling and forecasting are provided by UComp and autostsm. statespacer implements univariate state space models including structural and SARIMA models. Bayesian structural time series models are implemented in bsts Robust Kalman filtering is provided by RobKF.
garch()from tseries fits basic GARCH models. Many variations on GARCH models are provided by rugarch. Other univariate GARCH packages include fGarch which implements ARIMA models with a wide class of GARCH innovations. bayesforecast fits Bayesian time series models including several variations of GARCH models. There are many more GARCH packages described in the Finance task view.
Box.test()in the stats package. Additional tests are given by testcorr.
tscleanfunctions in the forecast package provide some simple heuristic methods for identifying and correcting outliers. otsad implements a set of online anomaly detectors for time series. tsrobprep provides methods for replacing missing values and outliers using a model-based approach.
na.interp()from the forecast package. imputeTestbench provides tools for testing and comparing imputation methods. mtsdi implements an EM algorithm for imputing missing values in multivariate normal time series, accounting for spatial and temporal correlations.
accuracy()function from the fable and forecast packages. Distributional forecast evaluation using scoring rules is available in fable, scoringRules and scoringutils. The Diebold-Mariano test for comparing the forecast accuracy of two models is implemented in the
dm.test()function in forecast. A multivariate version of the Diebold-Mariano test is provided by multDM. tsutils implements the Nemenyi test for comparing forecasts. greybox provides
ro()for general rolling origin evaluation of forecasts.
Spectral density estimation is provided by
spectrum() in the stats package, including the periodogram, smoothed periodogram and AR estimates. Bayesian spectral inference is provided by bspec, beyondWhittle and regspec. quantspec includes methods to compute and plot Laplace periodograms for univariate time series. The Lomb-Scargle periodogram for unevenly sampled time series is computed by lomb. spectral uses Fourier and Hilbert transforms for spectral filtering. psd produces adaptive, sine-multitaper spectral density estimates. kza provides Kolmogorov-Zurbenko Adaptive Filters including break detection, spectral analysis, wavelets and KZ Fourier Transforms. multitaper also provides some multitaper spectral analysis tools. Higher-order spectral analysis is implemented in rhosa, including bispectrum, bicoherence, cross-bispectrum and cross-bicoherence.
Wavelet methods : The wavelets package includes computing wavelet filters, wavelet transforms and multiresolution analyses. Multiresolution forecasting using wavelets is also implemented in mrf. WaveletComp provides some tools for wavelet-based analysis of univariate and bivariate time series including cross-wavelets, phase-difference and significance tests. biwavelet is a port of the WTC Matlab package for univariate and bivariate wavelet analyses. mvLSW provides tools for multivariate locally stationary wavelet processes. LSWPlib contains functions for simulation and spectral estimation of locally stationary wavelet packet processes. Tests of white noise using wavelets are provided by hwwntest. Wavelet scalogram tools are contained in wavScalogram. Further wavelet methods can be found in the packages rwt, waveslim, wavethresh.
Filters and smoothing :
filter() in stats provides autoregressive and moving average linear filtering of multiple univariate time series. The robfilter package provides several robust time series filters.
smooth() from the stats package computes Tukey’s running median smoothers, 3RS3R, 3RSS, 3R, etc. sleekts computes the 4253H twice smoothing method. mFilter implements several filters for smoothing and extracting trend and cyclical components including Hodrick-Prescott and Butterworth filters. smoots provides nonparametric estimation of the time trend and its derivatives.
Empirical Mode Decomposition (EMD) and Hilbert spectral analysis is provided by EMD. Additional tools, including ensemble EMD, are available in hht. An alternative implementation of ensemble EMD and its complete variant are available in Rlibeemd.
decompose(), and STL decomposition in
stl(). Enhanced STL decomposition is available in stlplus. stR provides Seasonal-Trend decomposition based on Regression. smooth and tsutils implement extended versions of classical decomposition.
ar()in the basic stats package including order selection via the AIC. These models are restricted to be stationary. MTS is an all-purpose toolkit for analyzing multivariate time series including VAR, VARMA, seasonal VARMA, VAR models with exogenous variables, multivariate regression with time series errors, and much more. Possibly non-stationary VAR models are fitted in the mAr package, which also allows VAR models in principal component space. sparsevar allows estimation of sparse VAR and VECM models, bigtime estimates large sparse VAR, VARX and VARMA models, while BigVAR estimates VAR and VARX models with structured lasso penalties and svars implements data-driven structural VARs. Shrinkage estimation methods for VARs are implemented in VARshrink. More elaborate models are provided in package vars, tsDyn,
estVARXls()in dse. Another implementation with bootstrapped prediction intervals is given in VAR.etp. bvartools assists in the set-up of Bayesian VAR models, while BMTAR implements Bayesian Multivariate Threshold AR models with missing data. mfbvar includes tools for estimating mixed-frequency Bayesian VAR models. BVAR provides a toolkit for hierarchical Bayesian VAR models. Factor-augmented VAR (FAVAR) models are estimated by a Bayesian method with FAVAR. BGVAR implements Bayesian Global VAR models. mlVAR provides multi-level vector autoregression. VARsignR (archived) provides routines for identifying structural shocks in VAR models using sign restrictions. gmvarkit estimates Gaussian mixture VAR models. GNAR provides methods for fitting network AR models, while graphicalVAR estimates graphical VAR models. gdpc implements generalized dynamic principal components. pcdpca extends dynamic principal components to periodically correlated multivariate time series. mgm estimates time-varying mixed graphical models and mixed VAR models via regularized regression.
tsibbleformat. They are computed using tsfeatures for a list or matrix of time series in
tsformat. In both packages, many built-in feature functions are included, and users can add their own. Rcatch22 provides fast computation of 22 features identified as particularly useful. theft calculates time series features from various R and Python packages. fsMTS implements feature selection routines for multivariate time series.
tsboot()for time series bootstrapping, including block bootstrap with several variants. blocklength allows for selecting the optimal block-length for a dependent bootstrap.
tsbootstrap()from tseries provides fast stationary and block bootstrapping. Maximum entropy bootstrap for time series is available in meboot. BootPR computes bias-corrected forecasting and bootstrap prediction intervals for autoregressive time series. bootUR implements bootstrap unit root tests.
simulate()in forecast package or
generate()in fable, given a specific model. gratis generates new time series with diverse and controllable characteristics using mixture autoregression models. synthesis generates synthetic time series from commonly used statistical models, including linear, nonlinear and chaotic systems. tssim flexibly simulates daily or monthly time series using seasonal, calendar, and outlier components.
|Core:||fable, feasts, forecast, tseries, tsibble, zoo.|
|Regular:||acp, AER, ARCensReg, ArDec, arfima, ASSA, astsa, autostsm, BayesARIMAX, bayesforecast, BAYSTAR, bentcableAR, BETS, beyondWhittle, bfast, BGVAR, bigtime, BigVAR, biwavelet, blocklength, BMTAR, BNPTSclust, boot, BootPR, bootUR, breakfast, brolgar, bspec, bssm, bsts, bundesbank, BVAR, bvartools, CADFtest, carfima, carx, changepoint, changepoint.geo, changepoint.np, chron, clock, cointReg, collapse, costat, data.table, dataseries, DChaos, dCovTS, depmix, depmixS4, diffusion, disaggR, dLagM, dlm, dlnm, dsa, dse, DTSg, dtts, dtw, dtwclust, dygraphs, dyn, dynlm, EBMAforecast, Ecdat, ecm, ecp, EMD, ensembleBMA, esemifar, expsmooth, fable.prophet, fabletools, factorstochvol, fame, fanplot, FAVAR, fdaACF, FeedbackTS, fGarch, FinTS, FKF, FKF.SP, fma, fNonlinear, ForeCA, ForecastComb, forecastHybrid, forecastML, FoReco, forecTheta, fpcb, fpp2, fpp3, fracdiff, fredr, freqdom, freqdom.fda, fsMTS, ftsa, funtimes, garma, GAS, gdpc, ggdemetra, ggseas, glarma, GlarmaVarSel, GMDH, gmvarkit, GNAR, graphicalVAR, gratis, gravitas, greybox, gsarima, gsignal, gtop, HDTSA, hht, hts, hwwntest, imputeTestbench, imputeTS, IncDTW, influxdbr, InspectChangepoint, itsmr, KFAS, kza, legion, locits, lomb, LongMemoryTS, LSTS, LSWPlib, ltsa, lubridate, MAPA, mAr, mar1s, MARSS, mbsts, mclcar, Mcomp, meboot, mfbvar, mFilter, mgm, mixAR, mlVAR, modeltime, modeltime.ensemble, mondate, mrf, mssm, MSwM, MTS, mtsdi, multDM, MultipleBubbles, multitaper, mvLSW, nanotime, nardl, nets, NGSSEML, NlinTS, nlts, nnfor, nonlinearTseries, nsarfima, NTS, odpc, onlineforecast, opera, otsad, paleoTS, partsm, pastecs, PCA4TS, pcdpca, pcts, pdc, pdfetch, pomp, ProbReco, profoc, prophet, psd, PSF, PTSR, ptw, Quandl, quantspec, Rbeast, Rcatch22, rdbnomics, readabs, regspec, RGENERATE, rhosa, RJDemetra, Rlgt, Rlibeemd, RMAWGEN, robets, robfilter, RobKF, robustarima, roll, RSEIS, Rsfar, Rssa, RTransferEntropy, rts, rucrdtw, rugarch, runner, runstats, rwt, sazedR, scoringRules, scoringutils, sde, seas, season, seasonal, seasonalview, seer, Sim.DiffProc, SLBDD, sleekts, slider, smooth, smoots, sparsevar, spectral, spTimer, statespacer, STFTS, stlplus, stochvol, stR, strucchange, strucchangeRcpp, sugrrants, surveillance, svars, sweep, sym.arma, synthesis, tbrf, Tcomp, tempdisagg, tensorTS, testcorr, tfarima, tframe, theft, thief, Tides, timechange, timeDate, timeSeries, timeseriesdb, timetk, timsac, tis, tpr, trend, TSA, TSANN, tsbox, tsBSS, TSclust, tscount, tsdb, TSdbi, tsdecomp, tsdisagg2, TSdisaggregation, TSdist, tsDyn, TSEntropies, tseriesChaos, tseriesEntropy, tsfeatures, tsfknn, tsibbledata, tsibbletalk, tsintermittent, TSLSTM, tsModel, tsoutliers, tsPI, TSrepr, tsrobprep, tssim, TSstudio, TSTutorial, tsutils, tswge, UComp, ugatsdb, uGMAR, urca, uroot, VAR.etp, VARDetect, vars, VARshrink, WaveletComp, wavelets, waveslim, wavethresh, wavScalogram, wktmo, x12, x13binary, xts, yuima, ZIM, ZINARp, ZRA.|