predict.knnForecast {tsfknn} | R Documentation |
Predict method for KNN models for time series forecasting.
Description
Predicted values based on a KNN model for time series forecasting.
Usage
## S3 method for class 'knnForecast'
predict(object, h, ...)
Arguments
object |
a |
h |
an integer. The forecasting horizon. |
... |
further arguments passed to or from other methods. |
Details
If the models uses the MIMO strategy for multiple-step ahead prediction, the forecasting horizon is fixed to the model forecasting horizon.
Value
a knnForecast
object with the prediction and information
about the KNN model, see the documentation of knn_forecasting
for the structure of knnForecast
objects.
Examples
pred <- knn_forecasting(UKgas, h = 4, k = 1, msas = "recursive")
new_pred <- predict(pred, h = 6)
print(new_pred$prediction)
plot(new_pred) # To see a plot with the forecast
[Package tsfknn version 0.6.0 Index]