Skip to contents

(Normalized) root mean square error

Calculate the (normalized) root-mean-square-error of two vectors.

Usage

rmse(a, b)

nrmse(a, b, normer = "sd")

Arguments

a, b

numeric vectors of same length to be compared

normer

a character string defining the type of normalization to be applied. Can be one of

mean

the arithmetic mean of a

sd

the standard deviation of a (default).

range

the difference between the range of a

IQR

the difference between the interquantile range of a

Value

The (normalised) rmse of the provided vector.

Examples


set.seed(42)
a <- c(1, 2, 3, 4)
b <- a * rnorm(4, 1, 0.1)
rmse(a, b)
#> [1] 0.1639365
nrmse(a, b, normer = "sd")
#> [1] 0.1269846
nrmse(a, b, normer = "mean")
#> [1] 0.06557458