Last updated on 2019-02-12 by Rob J Hyndman
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 also a considerable overlap between the tools for time series and those in the Econometrics and Finance task views. 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.
Basics
"ts"
that can represent regularly spaced time series (using numeric time stamps). Hence, it is particularly well-suited for annual, monthly, quarterly data, etc.
ma
from forecast, and rollmean
from zoo. The latter also provides a general function rollapply
, along with other specific rolling statistics functions.
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.
Fast rolling and expanding window regressions are provided by rollRegres.
plot()
applied to ts
objects.
(Partial) autocorrelation functions plots are implemented in acf()
and pacf()
. Alternative versions are provided by Acf()
and Pacf()
in forecast, along with a combination display using tsdisplay()
.
SDD provides more general serial dependence diagrams, while dCovTS computes and plots the distance covariance and correlation functions of time series.
Seasonal displays are obtained using monthplot()
in stats and seasonplot
in forecast.
Wats implements wrap-around time series graphics.
Some facilities for ggplot2 graphics are provided in forecast including autoplot()
, ggAcf()
, ggPacf()
, ggseasonplot()
and ggsubseriesplot
.
ggseas provides additional ggplot2 graphics for seasonally adjusted series and rolling statistics.
ggTimeSeries provides further visualizations including calendar heat maps, while
calendar plots are implemented in sugrrants.
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.
Times and Dates
"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.
"yearmon"
and "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.
dates()
, 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.
"POSIXct"
and "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.
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.
Time Series Classes
"ts"
is the basic class for regularly spaced time series using numeric time stamps.
"ts"
.
Coercion from and to "zoo"
is available for all other classes mentioned in this section.
"POSIXct"
time stamps, intended especially for financial applications. These include
"irts"
from tseries,
and "fts"
from fts.
"timeSeries"
in timeSeries (previously: fSeries) implements time series with "timeDate"
time stamps.
"tis"
in tis implements time series with "ti"
time stamps.
Forecasting and Univariate Modeling
HoltWinters()
in stats provides some basic models with partial optimization,
ets()
from the forecast package provides 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.
The MAPA package combines exponential smoothing models at different levels of temporal aggregation to improve forecast accuracy.
thetaf
function from the forecast package.
An alternative and extended implementation is provided in forecTheta.
ar()
in stats (with model selection) and FitAR for subset AR models.
arima()
in stats is the basic function for ARIMA, SARIMA, ARIMAX, and subset ARIMA models.
It is enhanced in the forecast package via the function Arima()
along with auto.arima()
for automatic order selection.
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.
FitARMA implements a fast MLE algorithm for ARMA models.
Package gsarima contains functionality for Generalized SARIMA time series simulation.
Robust ARIMA modeling is provided in the robustarima package.
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.
arimax
function in the TSA package, and the arfima
function in the arfima package.
tsoutliers
and tsclean
functions in the forecast package provide some simple heuristic methods for identifying and correcting outliers.
anomalize provides some additional outlier detection methods in a tidy data framework.
StructTS()
in stats, and in stsm and stsm.class.
KFKSDS provides a naive implementation of the Kalman filter and smoothers for univariate state space models.
Bayesian structural time series models are implemented in bsts
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.
There are many more GARCH packages described in the Finance task view.
Box.test()
in the stats package.
Additional tests are given by portes and WeightedPortTest.
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 forecast.
Distributional forecast evaluation using scoring rules is available in scoringRules.
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.
Frequency analysis
spectrum()
in the stats package, including the periodogram, smoothed periodogram and AR estimates.
Bayesian spectral inference is provided by bspec 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.
fourier
function.
Decomposition and Filtering
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.
Seasonality
decompose()
, and STL decomposition in stl()
.
Enhanced STL decomposition is available in stlplus.
stR provides Seasonal-Trend decomposition based on Regression.
Stationarity, Unit Roots, and Cointegration
Nonlinear Time Series Analysis
Entropy
Dynamic Regression Models
Multivariate Time Series Models
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.
Automated VAR models and networks are available in autovarCore.
More elaborate models are provided in package vars, tsDyn, estVARXls()
in dse.
Another implementation with bootstrapped prediction intervals is given in VAR.etp.
mlVAR provides multi-level vector autoregression.
VARsignR 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.
onlineVAR implements online fitting of time-adaptive lasso VARs.
mgm estimates time-varying mixed graphical models and mixed VAR models via regularized regression.
Analysis of large groups of time series
Functional time series
Continuous time models
Resampling
tsboot()
for time series bootstrapping, including block bootstrap with several variants.
tsbootstrap()
from tseries provides fast stationary and block bootstrapping.
Maximum entropy bootstrap for time series is available in meboot.
timesboot computes the bootstrap CI for the sample ACF and periodogram.
BootPR computes bias-corrected forecasting and bootstrap prediction intervals for autoregressive time series.
Time Series Data
Miscellaneous
2 years ago by Fernanda L. Schumacher
Fitting Univariate Censored Linear Regression Model with Autoregressive Errors
4 months ago by JQ Veenstra
Fractional ARIMA (and Other Long Memory) Time Series Modeling
8 months ago by Ando Emerencia
Automated Vector Autoregression Models and Networks
5 years ago by Edward M.H. Lin
On Bayesian analysis of Threshold autoregressive model (BAYSTAR)
4 years ago by Grace Chiu
Bent-Cable Regression for Independent Data or Autoregressive Time Series
a month ago by Will Nicholson
Dimension Reduction Methods for Multivariate Time Series
4 years ago by David Alejandro Martell Juarez
A Bayesian Nonparametric Algorithm for Time Series Clustering
5 years ago by Jae H. Kim
Bootstrap Prediction Intervals and Bias-Corrected Forecasting
6 years ago by Sophie Achard
Basic wavelet analysis of multivariate time series with a visualisation and parametrisation using graph theory.
3 months ago by Jouni Helske
Bayesian Inference of Non-Linear and Non-Gaussian State Space Models
2 years ago by Claudio Lupi
A Package to Perform Covariate Augmented Dickey-Fuller Unit Root Tests
25 days ago by Kisung You
Continuous-Time Fractionally Integrated ARMA Process for Irregularly Spaced Long-Memory Time Series Data
3 months ago by Daniel Grose
Changepoint Analysis for Multivariate Time Series
3 years ago by Philipp Aschersleben
Parameter Estimation and Inference in a Cointegrating Regression
5 years ago by Fan Yang
Extract and plot common trends from a cointegration system. Calculate P-value for Johansen Statistics.
2 years ago by Maria Pitsillou
Distance Covariance and Correlation for Time Series Analysis
6 months ago by Ingmar Visser
Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
6 years ago by A. I. McLeod
Optimal deseasonalization for geophysical time series using AR fitting
4 months ago by Haydar Demirhan
Time Series Regression Models with Distributed Lag Models
8 months ago by Giovanni Petris
Bayesian and Likelihood Analysis of Dynamic Linear Models
5 months ago by Alexis Sarda
Time Series Clustering Along with Optimizations for the Dynamic Time Warping Distance
7 months ago by Petr Shevtsov
Interface to 'Dygraphs' Interactive Time Series Charting Library
5 years ago by Vasilis Dakos
Early Warning Signals Toolbox for Detecting Critical Transitions in Timeseries
a year ago by Wenyu Zhang
Non-Parametric Multiple Change-Point Analysis of Multivariate Data
a year ago by Chris Fraley
Probabilistic Forecasting using Ensembles and Bayesian Model Averaging
4 years ago by Rob J Hyndman
Data Sets from "Forecasting with Exponential Smoothing"
16 days ago by Gregor Kastner
Bayesian Estimation of (Sparse) Latent Factor Stochastic Volatility Models
3 years ago by Guy J. Abel
Visualisation of Sequential Probability Distributions Using Fan Charts
16 days ago by Tobias Setz
Rmetrics - Autoregressive Conditional Heteroskedastic Modelling
2 years ago by Rob J Hyndman
Data Sets from "Forecasting: Methods and Applications" by Makridakis, Wheelwright & Hyndman (1998)
a year ago by Tobias Setz
Rmetrics - Nonlinear and Chaotic Time Series Modelling
5 days ago by David Shaub
Convenient Functions for Ensemble Time Series Forecasts
10 months ago by Rob Hyndman
Data for "Forecasting: Principles and Practice" (2nd Edition)
6 years ago by Martin Maechler
Fractionally differenced ARIMA aka ARFIMA(p,d,q) models
a year ago by William Constantine
A Fractal Time Series Modeling and Analysis Package
6 years ago by Brian Lee Yung Rowe
Generate fractal time series with non-normal returns distribution
a year ago by Kidzinski L.
Functional Time Series: Dynamic Functional Principal Components
8 months ago by Peter Ellis
'stats' for Seasonal Adjustment on the Fly with 'ggplot2'
5 months ago by Aditya Kothari
Time Series Visualisations Using the Grammar of Graphics
a year ago by William T.M. Dunsmuir
Generalized Linear Autoregressive Moving Average Models
5 months ago by Savi Virolainen
Estimate Gaussian Mixture Vector Autoregressive Model
6 years ago by Olivier Briet
Two functions for Generalized SARIMA time series simulation
4 years ago by Paal O. Westermark
Harmonic Regression to One or more Time Series
3 years ago by Neeraj Bokde
Impute Missing Data in Time Series Data with PSF Based Method
2 years ago by Marcus W. Beck
Test Bench for the Comparison of Imputation Methods
3 years ago by Tengyao Wang
High-Dimensional Changepoint Estimation via Sparse Projection
a year ago by Pavel Senin
Time Series Analysis Toolkit Based on Symbolic Aggregate Dicretization, i.e. SAX
14 days ago by Jouni Helske
Kalman Filter and Smoother for Exponential Family State Space Models
4 years ago by Javier López-de-Lacalle
Kalman Filter, Smoother and Disturbance Smoother
4 years ago by Mustafa Gokce Baydogan
Learned Pattern Similarity and Representation for Time Series
3 months ago by Elizabeth Holmes - NOAA Federal
Multivariate Autoregressive State-Space Modeling
4 months ago by Ruey S. Tsay
All-Purpose Toolkit for Analyzing Multivariate Time Series (MTS) and Estimating Multivariate Volatility Models
7 months ago by Pedro Araujo
Test and Detection of Explosive Behaviors for Time Series
9 months ago by Taha Zaghdoudi
Nonlinear Cointegrating Autoregressive Distributed Lag Model
a year ago by Jakob Messner
Online Fitting of Time-Adaptive Lasso Vector Auto Regression
a year ago by Philippe Grosjean
Package for Analysis of Space-Time Ecological Series
a year ago by Lukasz Kidzinski
Dynamic Principal Components for Periodically Correlated Functional Time Series
a year ago by Abiel Reinhart
Fetch Economic and Financial Time Series Data from Public Sources
2 months ago by Aaron A. King
Statistical Inference for Partially Observed Markov Processes
7 months ago by Esam Mahdi
Portmanteau Tests for Univariate and Multivariate Time. Series Models
4 years ago by Andrew J. Barbour
Adaptive, Sine-Multitaper Power Spectral Density Estimation
2 years ago by Neeraj Bokde
Forecasting of Univariate Time Series Using the Pattern Sequence-Based Forecasting (PSF) Algorithm
2 years ago by Ben Powell
Non-Parametric Bayesian Spectrum Estimation for Multirate Data
2 months ago by Jouni Helske
Ensemble Empirical Mode Decomposition (EEMD) and Its Complete Variant (CEEMDAN)
5 months ago by Benjamin Christoffersen
Fast Rolling and Expanding Window Linear Regression
5 months ago by Simon Behrendt
Measuring Information Flow Between Time Series with Shannon and Renyi Transfer Entropy
7 months ago by Fabian Krueger
Scoring Rules for Parametric and Simulated Distribution Forecasts
3 years ago by Stefano Maria Iacus
Simulation and Inference for Stochastic Differential Equations
4 years ago by Jannis v. Buttlar
Singular Spectrum Analysis (SSA) Tools for Time Series Analysis
16 days ago by Darjus Hosszejni
Efficient Bayesian Inference for Stochastic Volatility (SV) Models
5 years ago by Javier López-de-Lacalle
Class and Methods for Structural Time Series Models
7 months ago by Sebastian Meyer
Temporal and Spatio-Temporal Modeling and Monitoring of Epidemic Phenomena
5 months ago by Vinicius Quintas Souto Maior
Autoregressive and Moving Average Symmetric Models
3 years ago by Christoph Sax
Methods for Temporal Disaggregation and Interpolation of Time Series
7 months ago by Thorsten Pohlert
Non-Parametric Trend Tests and Change-Point Detection
2 years ago by Simone Giannerini
Entropy Based Analysis and Tests for Time Series
2 years ago by Jouni Helske
Improved Prediction Intervals for ARIMA Processes and Structural Time Series
5 years ago by Alberto Lopez Moreno
Fitting and Predict Time Series Interactive Laboratory
3 years ago by Christian Danne
Sign Restrictions, Bayesian, Vector Autoregression Models
20 days ago by Eric Aldrich
Functions for Computing Wavelet Filters, Wavelet Transforms and Multiresolution Analyses
21 days ago by Brandon Whitcher
Basic Wavelet Routines for One-, Two- And Three-Dimensional Signal Processing
7 years ago by Thomas J. Fisher
Weighted Portmanteau Tests for Time Series Goodness-of-fit
a year ago by Alexander Kowarik
Interface to 'X12-ARIMA'/'X13-ARIMA-SEATS' and Structure for Batch Processing of Seasonal Adjustment
2 years ago by Dirk Eddelbuettel
Provide the 'x13ashtml' Seasonal Adjustment Binary
5 months ago by Achim Zeileis
S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations)