Learn R Programming

MetricsWeighted (version 0.1.0)

mape: Mean absolute percentage error

Description

Weighted mean absolute percentage error of predicted values.

Usage

mape(actual, predicted, w = NULL, clip_small = 0, ...)

Arguments

actual

Observed values.

predicted

Predicted values.

w

Optional case weights.

clip_small

Minimal absolute value in the denominator. Used to avoid divisions by 0.

...

Further arguments passed to weighted_mean.

Value

A numeric vector of length one.

Examples

Run this code
# NOT RUN {
mape(1:10, (1:10)^2)
mape(1:10, (1:10)^2, w = rep(1, 10))
mape(1:10, (1:10)^2, w = 1:10)
# }

Run the code above in your browser using DataLab