plot_example: Plot an example used in a prediction of a grnnForecast object

View source: R/plotting.R

plot_exampleR Documentation

Plot an example used in a prediction of a grnnForecast object

Description

This function is useful to see how the forecast has been computed. An ordinal specifying the order of the weight has to be supplied and the function plots the training pattern associated with that ordinal.

Usage

plot_example(forecast, position, h = 1)

Arguments

forecast

The grnnForecast object.

position

An integer. It is an ordinal number indicating what training pattern to plot. For instance, if position is 1 it means that the training pattern with the greatest weight should be plotted. If position is 2 the training pattern with the second greatest weight is plotted and so on.

h

An integer. This value is only useful when the recursive strategy is being used. It indicates the forecasting horizon

Value

A ggplot object representing an example used in the prediction.

Examples

pred <- grnn_forecasting(USAccDeaths, h = 12, lags = 1:12, sigma = 50)
library(ggplot2)
plot_example(pred, 1)

tsfgrnn documentation built on March 31, 2023, 8:20 p.m.