`nrmse`

is a function that allows the user to calculate the normalized root
mean square error (NRMSE) as absolute value between predicted
and observed values using different type of normalization methods.
It further allows the NRMSE calculation on the scale of the untransformed
indicator, which is advisable for a comparison across indicators.

nrmse(
pred,
obs,
method = "sd",
transformation = "none",
trans_function = "none"
)

## Arguments

pred |
A vector of predicted values. |

obs |
A vector of observed values. |

method |
A character string indicating the value to be used for the normalization of the RMSE.
The default is the standard deviation. Alternatively, you can choose the `"mean"` ,
`"maxmin"` (difference between the maximum and minimum observed values) or `"iq"`
(interquartile) |

transformation |
The type of transformation applied to the observations
prior to the analysis. Choose one of the following: `"none"` (default), `"sqrt"` ,
`"4thrt"` (fourth root),
`"log"` (natural logarithm), `"log10"` (common, i.e. base 10, logarithm),
`"log2"` (binary logarithm), `"log1p"` (i.e. log(1+x)),
`"arcsine"` (if data is proportional, NOT percentage) or `"other"` . |

trans_function |
If `transformation` is set to "`"other"` , the function
for the back-transformation needs to be defined here as character string (simply the inverse of
the original transformation), e.g. "5^x" if observations log(x, base = 5) transformed or
"exp(x) - 0.001" if observations log(x + 0.001) transformed. Default is `"none"` . |

## Value

The function returns a single NRMSE value (expressed as absolute value). In case the
number of positions with non-missing values in both pred and obs is less then 2, NA is returned
with a message.

## Details

The for most common normalization methods are implemented here:

- the **mean**: NRMSE = RMSE / mean(obs)
- the **standard deviation**: NRMSE = RMSE / sd(obs)
- the **difference between maximum and minimum**: NRMSE = RMSE / (max(obs)-min(obs)
- the **interquartile range**; NRMSE = RMSE / (Q1-Q3), i.e. the
difference between the 25th and 75th percentile of observations

Missing values in obs and pred are removed before the computation proceeds, and
only those positions with non-missing values in both pred and obs are considered in the
computation.

## See also

## Examples

#> [1] 0.8429272

# Calculating the iq-based NRMSE for log(x+0.001) transformed data
nrmse(pred, obs, method = "iq", transformation = "other", trans_function = "exp(x)-0.001")

#> [1] 1.153703