srlTS

Codecov test coverage R-CMD-check CRAN status

Overview

The Sparsity-Ranked Lasso (SRL) for Time Series implemented in srlTS efficiently fits long, high-frequency time series with complex seasonality, even with a high-dimensional exogenous feature set.

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.

In time series data with complex seasonality or exogenous features; see Peterson and Cavanaugh (2023+), which also describes this package in greater detail. The basic premise is to utilize the sparsity-ranked lasso to be less skeptical of more recent lags, and suspected seasonal relationships.

Installation

You can install the development version of srlTS like so:

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

Or, install from CRAN with:

install.packages("srlTS")

Example

This is a basic example.

library(srlTS)

y <- cumsum(rnorm(100))
fit <- srlTS(y, gamma = c(0, .5))

fit
#>  PF_gamma best_AICc best_BIC
#>       0.0  209.9610 216.3429
#>       0.5  208.1509 214.5327
#> 
#> Test-set prediction accuracy
#>         rmse       rsq      mae
#> AIC 1.518106 0.9478941 1.286608
#> BIC 1.518106 0.9478941 1.286608

Learn more

To learn more and to see this methodology in action, see: