Learn R Programming

fieldRS (version 0.2.3)

mape: mape

Description

Mean Absolute Percent Error (MAPE).

Usage

mape(x, na.rm = TRUE)

Arguments

x

A vector of class numeric.

na.rm

Logical. Should the NA values be excluded. Default is TRUE.

Value

A numeric element.

Details

Estimates the Mean Absolute Percent Error (MAPE) for a given vector. The MAPE compares the individual values against their mean and translates the mean of the differences into a percent deviation from the mean of the vector. The MAPE is estimated as: $$100 / length(x) * sum(abs((x-mean(x))/x))$$

See Also

relative.freq ccLabel

Examples

Run this code
# NOT RUN {
{

x <- c(0.1, 0.3, 0.4, 0.1, 0.2, 0.6)
m <- mape(x)

}
# }

Run the code above in your browser using DataLab