nrmse: Normalized Root Mean Squared Error

View source: R/metrics.R

nrmseR Documentation

Normalized Root Mean Squared Error

Description

Given the observed and predicted values of numeric data computes the Normalized Root Mean Squared Error.

Usage

nrmse(observed, predicted, type = "mean", remove_na = TRUE)

Arguments

observed

(numeric) The observed values. It has to have the same length as predicted.

predicted

(numeric) The observed values. It has to have the same length as observed.

type

(character(1)) (case not sensitive) The normalization type to use. The options are "sd", "mean", "maxmin" (or "range") and "iqr" (for more information, see Details section below). "mean" by default.

remove_na

(logical(1)) Should NA values be removed?. TRUE by default.

Details

Normalized Root Mean Squared Error is computed as:

sqrt((1 / N) * sum((observed - predicted)^2)) / norm

where y_i is the observed value of element i, haty_i is the predicted value of element i, N is the total number of elements and Y' is the normalized observed values. You can specify one of the following types of normalization with the type parameter:

  • "sd": Standard deviation.

  • "mean": Mean.

  • "maxmin" or "range": Maximun minus minimum (range).

  • "iqr": Interquantile range (Q3 - Q1).

Value

A single numeric value with the Normalized Root Mean Squared Error.

See Also

Other numeric_metrics: maape(), mae(), mse(), numeric_summary(), pearson(), r2(), rmse(), spearman()

Examples

## Not run: 
set.seed(1)
x <- rnorm(100)
nrmse(x, x)
nrmse(x, x - 1, type = "mean")
nrmse(x, x + 10, type = "iqr")
nrmse(x, x + 10, type = "range")
nrmse(x, x + 10, type = "maxmin")

## End(Not run)


brandon-mosqueda/SKM documentation built on Feb. 8, 2025, 5:24 p.m.