Skip to contents

This function computes the root mean square error (RMSE) between a vector of observed values x and simulated values y. rel = FALSE returns the absolute RMSE, rel = TRUE the relative one. If na.rm is TRUE, missing values are omitted before the computation proceeds.

Usage

rmse(x, y, rel = F, na.rm = T)

Arguments

x

a numeric vector containing observed values.

y

a numeric vector containing simulated values.

rel

logical. If TRUE, the relative RMSE is calculated, if FALSE the absolute RMSE is returned.

na.rm

logical. Should missing values be removed?

Author

Zacharias Steinmetz

Examples

rmse(c(0.12,0.59,NA), c(0.15,0.63,1.2))
#> [1] 0.03535534