Learn R Programming

BETS (version 0.4.9)

predict: Get the predicted values of a model and visualize it

Description

This function is built upon forecast. Besides the model predictions, it returns an accuracy measure table (calculated by the accuracy function) and a graph showing the original series, the predicted values and the actual values.

Usage

predict(..., actual = NULL, main = "", ylab = "", xlim = NULL,
  style = "dygraphs", unnorm = NULL, legend.pos = "topright", knit = F)

Arguments

...

arguments passed on to forecast. If the model is a neural network, these arguments will be passed on to grnn.test.

actual

A numeric vector. The actual values (to be compared with predicted values).

main

A character. The name of the prediction plot.

ylab

A character. The Y axis label.

xlim

A numeric vector. The limits of the X axis.

style

A character. Can be either 'dygraphs' (the dygraph function will be use to make the plot, which is going to be HTML based) or 'normal' (standard R functions will be used to make the plot)

unnorm

A numeric vector. If predictions must be unnormalized, set the first element of this vector to the mean and the second, to the standard deviation.

legend.pos

A character. The position of the legend. Possible values are standard R plot values, i.e., "topright', "bottomleft', etc.

knit

A boolean. Set this parameter to TRUE if

Value

Besides the prediction plot, this function returns an object whose fields are:

  • accuracy: An object returned by accuracy. It is a table containing several accuracy measures

  • predictions: A numeric vector containing the predicted values.