accuracy_stat: Forecasting accuracy measures.

View source: R/accuracy.R

accuracy_statR 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 pred_roll

...

Not used currently.

true

If object is just a matrix or data-frame, true values to be compared to should be supplied

w

Optional. For objects of class pred_roll containing multiple variables, user can specify the way to aggregate the specific x-step-ahead into the ‘all’ category

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))




tsDyn documentation built on Feb. 16, 2023, 6:57 p.m.