powered by
Predicted values based on a KNN model for time series forecasting.
# S3 method for knnForecast predict(object, h, ...)
a knnForecast object with the prediction and information about the KNN model, see the documentation of knn_forecasting
knnForecast
knn_forecasting
for the structure of knnForecast objects.
a knnForecast object obtained by a call to the knn_forecasting function.
an integer. The forecasting horizon.
further arguments passed to or from other methods.
If the models uses the MIMO strategy for multiple-step ahead prediction, the forecasting horizon is fixed to the model forecasting horizon.
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
Run the code above in your browser using DataLab