Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

accuracy_stat

Forecasting accuracy measures.


Description

Compute forecasting accuracies. This is very similar ot 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

Nonlinear Time Series Models with Regime Switching

v10-1.2
GPL (>= 2)
Authors
Antonio Fabio Di Narzo [aut], Jose Luis Aznarte [ctb], Matthieu Stigler [aut], Ho Tsung-wu [cre]
Initial release
2020-02-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.