mase: MASE

Description Usage Arguments Value Note Examples

Description

Calculates the Mean Absolute Scaled Error(MASE) between x and the target. This is intended to be used for measuring the accuracy of a time series forecast, since it reports the error in the context of the naive forecast (random walk for non-seasonal, or a seasonal naive otherwise).

Usage

1
mase(x, target, m = 1, na.rm = FALSE)

Arguments

x

numeric vector; the forecast to evaluate.

target

numeric vector; the target values.

m

atomic integer; the seasonal period. Defaults to 1 if non-seasonal.

na.rm

logical; should NAs be removed before calculation?

Value

An atomic numeric vector containing the calculated MASE.

Note

This will return Inf when the last length(x) - m values in target are all the same.

Examples

1
2
3
4
5
6
## Not run: mase(c(1, 2, 3))            #> Error: different lengths (3, 0)
mase(c(1, 2, 3), c(1, 4, 4))          #> 0.66667
mase(c(1, 2, NA, 4), c(2, 2, 5, NA))  #> NA
mase(c(1, 2, 3, NA, 4),
     c(2, 2, 5, NA, NA),
     na.rm = TRUE)                    #> 0.66667

max-graham/metrics documentation built on May 5, 2019, 5:53 p.m.