knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(spooky)
spooky forecasts one or more time features with a compact spectral model. It
uses differencing, FFT extrapolation, rolling validation, and jackknife-style
resampling to compare candidate sequence lengths and leave-out values.
Spooky 2.0 has no runtime dependencies beyond base R packages.
The package includes time_features, a small example data set with two numeric
series. The following fits one candidate model and keeps the example fast.
data(time_features) fit <- spooky(time_features, seq_len = 10, lno = 1, n_samp = 1, n_windows = 2, seed = 42) fit fit$best_model$testing_errors head(fit$best_model$preds[[1]])
The history component records the candidate settings and validation errors.
The best_model component contains errors, prediction summaries, and plot
objects for each input feature.
Categorical columns are encoded internally, so no dummy-variable package is needed.
events <- data.frame(state = factor(rep(c("quiet", "active"), 30))) categorical_fit <- spooky(events, seq_len = 2, lno = 1, n_samp = 1, n_windows = 2, seed = 42) categorical_fit$best_model$testing_errors
Set seed to make the random candidate search reproducible. For a larger
search, provide ranges for seq_len and lno, and increase n_samp.
fit <- spooky(time_features, seq_len = c(5, 30), lno = c(1, 10), n_samp = 30, n_windows = 3, seed = 42)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.