This function computes various loss functions for given realized values of time-series and a collection of forecasts.
Usage
loss(realized,evaluated,loss.type)
Arguments
realized
vector of the real values of the modelled time-series
evaluated
matrix of the forecasts, columns correspond to time index, rows correspond to different models
loss.type
method to compute the loss function, loss.type="SE" will use squared errors, loss.type="AE" will use absolute errors, loss.type="SPE" will use squred proportional error (useful if errors are heteroskedastic), if loss.type will be specified as some numeric, then the function of type exp(loss.type*errors)-1-loss.type*errors will be used (useful when it is more costly to underpredict realized than to overpredict)
Value
matrix with columns corresponding to time index and rows to different models
References
Taylor, S. J., 2005. Asset Price Dynamics, Volatility, and Prediction, Princeton University Press.