| tslagutils | R Documentation |
Utility object that groups helper functions used to select lag subsets for sliding-window predictors.
tslagutils()
These helpers are organized by the type of evidence they use to choose lags.
Positional mappings
lag_recent() keeps the most recent lags and reproduces the package's
original behavior.
lag_even() spreads the selected lags evenly across the available window.
lag_geom() emphasizes recent lags while still sampling older history on
a geometric scale.
Correlation-driven mappings
lag_acf() ranks lags by the absolute autocorrelation of the reconstructed
training series.
lag_pacf() ranks lags by the absolute partial autocorrelation.
lag_peaks() keeps local maxima of the ACF or PACF profile to avoid
selecting many redundant neighboring lags.
lag_seasonal() prioritizes multiples of an estimated or user-provided
seasonal period.
lag_acf_seasonal() and lag_pacf_seasonal() combine seasonal lags with
correlation-based completion.
lag_blocks() expands neighborhoods around the strongest correlation peaks.
Supervised mappings
lag_mi() ranks lags by discretized mutual information with the target.
lag_mrmr() greedily maximizes relevance to the target while reducing
redundancy among already selected lags.
The mutual-information criteria use quantile discretization and therefore provide deterministic approximations suitable for lightweight dependency-free lag selection inside the package.
A tslagutils object exposing the helper functions.
Box GEP, Jenkins GM, Reinsel GC, Ljung GM (2015). Time Series Analysis: Forecasting and Control. Fifth Edition. Wiley.
Hyndman RJ, Athanasopoulos G (2021). Forecasting: Principles and Practice. Third Edition. OTexts. https://otexts.com/fpp3/
Peng H, Long F, Ding C (2005). Feature selection based on mutual information criteria of max-dependency, max-relevance, and min-redundancy. IEEE Transactions on Pattern Analysis and Machine Intelligence, 27(8), 1226-1238. doi:10.1109/TPAMI.2005.159
Leites J, Cerqueira V, Soares C (2024). Selecting time lags for time series forecasting: an empirical study. arXiv:2405.11237.
utils <- tslagutils()
# Positional baselines
utils$lag_recent(total = 9, input_size = 4)
utils$lag_even(total = 9, input_size = 4)
# Reconstruct a raw series from sliding windows and aligned outputs
data(tsd)
ts <- ts_data(tsd$y, 10)
io <- ts_projection(ts)
series <- utils$reconstruct_series(io$input, io$output)
head(series)
# Correlation profile over available lags
utils$score_acf(series, lag_max = 9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.