autoplot.knnForecast {tsfknn}R Documentation

Create a ggplot object from a knnForecast object

Description

It uses a knnForecast object to create a ggplot object that plots a time series and its forecast using KNN regression.

Usage

## S3 method for class 'knnForecast'
autoplot(object, ...)

Arguments

object

An object of class knnForecast.

...

additional parameter, see details.

Details

Commonly used parameters are:

Value

The ggplot object representing a plotting with the forecast.

Examples

pred <- knn_forecasting(USAccDeaths, h = 12, lags = 1:12, k = 2)
library(ggplot2)
autoplot(pred)
autoplot(pred, highlight = "neighbors")

[Package tsfknn version 0.6.0 Index]