accuracy_stat {tsDyn} | R Documentation |
Forecasting accuracy measures.
Description
Compute forecasting accuracies. This is very similar to the
accuracy
method form forecast.
Usage
accuracy_stat(object, ...)
## Default S3 method:
accuracy_stat(object, true, ...)
## S3 method for class 'pred_roll'
accuracy_stat(object, w, ...)
Arguments
object |
A data-frame, matrix, or object of class |
... |
Not used currently. |
true |
If |
w |
Optional. For objects of class |
Details
The function works either for a simple data.frame or for objects
pred_roll
. For simple data.frames, the argument true
, i.e. a
data frame containing the true values, has to be provided. For
pred_roll
objects, the true values are contained in the object, so no
need (nor possibility) to provide the true values.
Value
A data-frame containing the forecasting accuracy measures.
Author(s)
Matthieu Stigler
Examples
## univariate:
mod_ar <- linear(lynx[1:100], m=1)
mod_ar_pred <- predict_rolling(mod_ar, newdata=lynx[101:114])
accuracy_stat(object=mod_ar_pred$pred, true=mod_ar_pred$true)
## multivariate
data(barry)
mod_var <- lineVar(barry, lag=1)
mod_var_pred <-predict_rolling(object=mod_var, nroll=10, n.ahead=1:3)
accuracy_stat(object=mod_var_pred)
accuracy_stat(object=mod_var_pred, w=c(0.7, 0.2, 0.1))