Learn R Programming

srlTS (version 0.1.1)

predict.srlTS: Predict function for srlTS object

Description

Predict function for srlTS object

Usage

# S3 method for srlTS
predict(object, n_ahead = 1, X_test, y_test, cumulative = 0, ...)

Value

a vector of predictions

Arguments

object

an srlTS object

n_ahead

number of times ahead to predict by iteration

X_test

a matrix exogenous features

y_test

the test series; needed for future predictions (optional; see details)

cumulative

should cumulative (rolling) sums be returned (integer indicating number of times to sum)

...

currently unused

Details

The `y_test` argument must be supplied if forecasts are desired or if `n_ahead` < `nrow(X_test)`. This is because in order to obtain 1-step forecast for, say, the 10th observation in the test data set, the 9th observation of `y_test` is required. The length of `y_test` will determine how many forecasts to produce. In order to get true forecasts for the first 30 observations after the training set, one must (currently) produce the set of 1-step, 2-step, 3-step, ..., 30-step ahead predictions.

Examples

Run this code
data("LakeHuron")
fit_LH <- srlTS(LakeHuron)
predict(fit_LH)

Run the code above in your browser using DataLab