Compute the Mean Fractional Error (MFE) of observed and predicted data.
Usage
mfe(obs, pred, use = "everything")
Arguments
- obs
A numeric vector, data.frame or data.table with observation data.
- pred
A numeric vector, data.frame or data.table with model (predicted) data.
- use
An optional character vector giving a method for computing MFE
in the presence of missing values. This must be either everything or complete.obs.
Value
The mean fractional error of input data as a numeric.
Details
The function computes the Mean Fractional Error (MFE) according to EPA formulation:
$$
\mathrm{MFE} = 100 \cdot \sum_{i=1}^{N} \left( \frac{|P_i - O_i|}{0.5(P_i + O_i)} \right)
$$
The MFE thus normalizes the error for each model-observed pair by the average
of the model and observation before taking the average.
Examples
if (FALSE) { # \dontrun{
validationData[, .(mfe = mfe(obs, mod, use = "complete.obs"))]
} # }