calc_mse_from_identity_line: Calculate the mean squared error from the identity line.

View source: R/calc_mse_from_identity_line.R

calc_mse_from_identity_lineR Documentation

Calculate the mean squared error from the identity line.

Description

Calculate the mean squared error from the identity line (i.e. the line y = x). If the estimated values are equal to the true values, the MSE is zero.

Usage

calc_mse_from_identity_line(true_values, estimated_values)

Arguments

true_values

the true values

estimated_values

the estimated values

Value

the mean squared error from the identity line

Author(s)

Richèl J.C. Bilderbeek

See Also

use calc_nmse_from_identity_line to calculate the normalized mean square error from the identity line

Examples

true_values_degrees <- seq(1, 360)
estimated_values_degrees <- true_values_degrees + stats::runif(n = 360)
mse_degrees <- calc_mse_from_identity_line(
  true_values = true_values_degrees,
  estimated_values = estimated_values_degrees
)
mse_degrees

# Convert degrees to radians
true_values_radians <- 2.0 * pi * true_values_degrees / 360
estimated_values_radians <- 2.0 * pi * estimated_values_degrees / 360
mse_radians <- calc_mse_from_identity_line(
  true_values = true_values_radians,
  estimated_values = estimated_values_radians
)
mse_radians

# mse_degrees and mse_radians differ, due to their different scales,
# use 'calc_nmse_from_identity_line' to normalize the scale first

richelbilderbeek/gcaer documentation built on March 25, 2024, 3:08 p.m.