mae: Mean Absolute Error

View source: R/variance_functions.R

maeR Documentation

Mean Absolute Error

Description

mae is a function that allows the calculation of the mean absolute error (MAE) for a vector of numbers.

Usage

mae(x, expected)

Arguments

x

numeric vector.

expected

expectation, given the model, for each value of x.

Value

Based on the assumed underlying model, the estimated MAE given the observed data in x.

See Also

Other Model Error Functions: rmsd()

Examples

# Examples
set.seed(1234)
x <- rnorm(100)
mean(x)
mae(x, mean(x))
# Observed Data (Red Porgy data set)
data(RedPorgy)
x <- na.exclude(RedPorgy[, 1])
mae(x = x, expected = mean(x))

ballengerj/FishyR documentation built on June 17, 2022, 10:33 p.m.