Learn R Programming

tsfgrnn (version 1.0.5)

plot_example: 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)

Value

A ggplot object representing an example used in the prediction.

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

Examples

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

Run the code above in your browser using DataLab