Compute Root Mean Square Error (RMSE) with Normalization Options (untested)
Source:R/compute_rmse.R
compute_rmse.Rd
This function calculates the Root Mean Square Error (RMSE) between two numeric vectors (signals) and offers options for normalizing the RMSE.
Arguments
- observed
A numeric vector of observed values (true values).
- predicted
A numeric vector of predicted values (model values).
- normalise
A character string specifying the normalization method. Options are "none", "max", "min", "range", "median", "mean" or "sd". Default is "none".
Examples
# Example observed and predicted signals
observed <- c(1.0, 2.0, 3.0, 4.0, 5.0)
predicted <- c(1.1, 2.1, 2.9, 4.2, 5.0)
# Compute RMSE without normalization
rmse_no_norm <- compute_rmse(observed, predicted, normalise = "none")
print(rmse_no_norm)
#> [1] 0.1183216
# Compute RMSE normalised by the max value of the observed signal
rmse_max <- compute_rmse(observed, predicted, normalise = "max")
print(rmse_max)
#> [1] 0.02366432