The
function loss
computes the sequence of instantaneous losses suffered
by the predictions in x
to predict the observation in y
.
loss(x, y, loss.type = "square")
A vector of length T
containing the sequence of prediction to be evaluated.
A vector of length T
that
contains the observations to be predicted.
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:
A string defining the name of the loss function (i.e., 'pinball')
A number in [0,1]
defining the quantile to be predicted. The default value is 0.5 to predict the median.
A vector of length T
containing the sequence of
instantaneous losses suffered by the prediction x
.