Predict function for fastTS object
# S3 method for fastTS
predict(
object,
n_ahead = 1,
X_test,
y_test,
cumulative = FALSE,
forecast_ahead = FALSE,
return_intermediate = FALSE,
...
)a vector of predictions, or a matrix of 1- through n_ahead predictions.
an fastTS object
the look-ahead period for predictions
a matrix exogenous features for future predictions (optional)
the test series for future predictions (optional)
cumulative (rolling) sums of 1-, 2-, 3-, ..., k-step-ahead predictions.
returns forecasted values for end of training series
if TRUE, returns the intermediate predictions between the 1st and n_ahead predictions, as data frame.
currently unused
The `y_test` argument must be supplied if predictions 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.
Forecasts for the first `n_ahead` observations after the training set can be obtained by setting `forecast_ahead` to TRUE, which will return the forecasted values at the end of the training data. it produces the 1-step-ahead prediction, the 2-step-ahead prediction, ... through the `n_ahead`-step prediction. The `cumulative` argument is similar but will return the cumulative (rolling) sums of 1-, 2-, 3=, ..., `n_ahead`-step-ahead predictions.
data("LakeHuron")
fit_LH <- fastTS(LakeHuron)
predict(fit_LH)
Run the code above in your browser using DataLab