rmse: Root Mean Squared Error

View source: R/metrics.R

rmseR Documentation

Root Mean Squared Error

Description

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

Usage

rmse(observed, predicted, 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.

remove_na

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

Details

Root Mean Squared Error is computed as:

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

where y_i is the observed value of element i, haty_i is the predicted value of element i and N is the total number of elements.

Value

A single numeric value with the Root Mean Squared Error.

See Also

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

Examples

## Not run: 
rmse(1, 1)
rmse(1, 0)
rmse(c(1, 2, NA, 4), c(1, NA, 3, 4))

set.seed(1)
x <- rnorm(100)
rmse(x, x)
rmse(x, x - 1)
rmse(x, x + 10)

## End(Not run)


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