View source: R/ts_deterministic.R
| ts_deterministic | R Documentation |
Forecast a univariate series using a deterministic law of formation instead of a statistical learner.
ts_deterministic(
mode = c("periodic", "persist"),
period = NULL,
context_size = NULL
)
mode |
Character. Deterministic mode. Supported values are
|
period |
Optional integer. Required when |
context_size |
Optional integer. Number of most recent values used to identify the next state in a periodic cycle. When omitted, the smallest non-ambiguous context is inferred from the learned cycle. |
ts_deterministic() defines a small family of rule-based predictors that
can operate either on raw time series or on sliding-window inputs.
The current deterministic modes are:
"periodic": repeat a learned cycle of fixed length
"persist": repeat the most recent observed value
This family is useful for variables whose future behavior is structurally determined, such as:
day-of-week codes
weekend indicators
fixed operational calendars
slowly changing auxiliary variables
Because the forecasting rule is deterministic, the same object can be used in two contexts:
direct raw-series prediction, in the lineage of ts_arima()
sliding-window prediction, in the lineage of ts_regsw
In other words, ts_deterministic() unifies both views for cases where the
predictive mechanism is a rule, not a learner over lagged attributes.
A ts_deterministic object.
series <- c(4, 5, 6, 7, 1, 2, 3)
model <- ts_deterministic("periodic", period = 7)
model <- daltoolbox::fit(model, x = series)
predict(model, steps_ahead = 5)
sw <- ts_data(series, sw = 4)
io <- ts_projection(sw)
model <- daltoolbox::fit(ts_deterministic("persist"), io$input, io$output)
predict(model, io$input[1:2, ], steps_ahead = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.