| nrmse | R Documentation |
nrmse computes the normalized root mean squared error (NRMSE)
for a given complete data matrix xtrue, an imputed matrix
ximp, and the corresponding matrix with missing values xmis.
nrmse(ximp, xmis, xtrue)
ximp |
Imputed data matrix (or data frame) with variables in columns and observations in rows. Must be numeric and contain no missing values. |
xmis |
Data matrix (or data frame) with the original missing values. Its
dimensions and column order must match |
xtrue |
Complete data matrix (or data frame). Must be numeric and contain no
missing values. Dimensions and column order must match |
The NRMSE is computed over the entries that were missing in xmis
and are numeric in xtrue / ximp, using
\mathrm{NRMSE} = \sqrt{\frac{\mathrm{mean}\{(X_{\mathrm{true}} - X_{\mathrm{imp}})^2\}}
{\mathrm{var}(X_{\mathrm{true}})}}\,,
where \mathrm{mean} and \mathrm{var} are the empirical mean
and variance computed over the continuous missing entries only.
This measure is intended for continuous data; for categorical or mixed-type
data, see mixError.
A numeric scalar: the normalized root mean squared error.
This function is used internally by mixError.
Daniel J. Stekhoven [aut, cre]
Oba2003missForest
mixError, missForest
## Simple numeric example
set.seed(1)
xtrue <- matrix(rnorm(100), ncol = 5)
xmis <- xtrue
xmis[sample(length(xmis), 10)] <- NA
ximp <- xmis
ximp[is.na(ximp)] <- rowMeans(ximp, na.rm = TRUE)[row(ximp)[is.na(ximp)]]
nrmse(ximp, xmis, xtrue)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.