Learn R Programming

opera (version 1.1)

loss: Errors suffered by a sequence of predictions

Description

The function loss computes the sequence of instantaneous losses suffered by the predictions in x to predict the observation in y.

Usage

loss(x, y, loss.type = "square")

Arguments

x

A vector of length T containing the sequence of prediction to be evaluated.

y

A vector of length T that contains the observations to be predicted.

loss.type

A string or a list with a component 'name' specifying the loss function considered to evaluate the performance. It can be 'square', 'absolute', 'percentage', or 'pinball'. In the case of the pinball loss, the quantile can be provided by assigning to loss.type a list of two elements:

name

A string defining the name of the loss function (i.e., 'pinball')

tau

A number in [0,1] defining the quantile to be predicted. The default value is 0.5 to predict the median.

Value

A vector of length T containing the sequence of instantaneous losses suffered by the prediction x.