Skip to contents

Overview

The fastTS package efficiently fits long, high-frequency time series with complex seasonality, even with a high-dimensional exogenous feature set. It implements the sparsity-ranked lasso (and similar methods) for time series data.

Originally described in Peterson and Cavanaugh (2022) in the context of variable selection with interactions and/or polynomials, ranked sparsity is a philosophy of variable selection in the presence of prior informational asymmetry.

This package implements such methods for fast fitting of time series data with complex seasonality or exogenous features. More information is included in Peterson and Cavanaugh (2024). The basic premise is to utilize the sparsity-ranked lasso (or similar) to be less skeptical of more recent lags, and suspected seasonal relationships.

Please cite fastTS as:

Peterson R. A. & Cavanaugh J. E. (2024). Fast, effective, and coherent time series modelling using the sparsity-ranked lasso. Statistical Modelling. doi:10.1177/1471082X231225307

Installation

You can install the development version of fastTS like so:

# install.packages("remotes")
remotes::install_github("PetersonR/fastTS")

Or, install from CRAN with:

Example

This is a basic example with the sunspot monthly series.

library(fastTS)

data("sunspot.month")
fit <- fastTS(sunspot.month)

fit
#> An endogenous PACF-based fastTS model.
#> 
#>  PF_gamma AICc_d  BIC_d
#>      0.00  24.92  38.93
#>      0.25   7.88    *0*
#>      0.50    *0*   0.48
#>      1.00  69.15   35.7
#>      2.00 221.33 131.01
#>      4.00 434.49 332.77
#>      8.00 434.49 332.77
#>     16.00 434.49 332.77
#> 
#> AICc_d and BIC_d are the difference from the minimum; *0* is best.
#> 
#> - Best AICc model: 23 active terms
#> - Best BIC  model: 14 active terms
#> 
#> Test-set prediction accuracy (20% held-out test set)
#>          rmse       rsq      mae
#> AICc 15.94153 0.8920102 11.85384
#> BIC  16.04978 0.8905385 11.99382