Learn R Programming

missForest (version 1.6.1)

nrmse: Normalized root mean squared error

Description

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.

Usage

nrmse(ximp, xmis, xtrue)

Value

A numeric scalar: the normalized root mean squared error.

Arguments

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 ximp and xtrue.

xtrue

Complete data matrix (or data frame). Must be numeric and contain no missing values. Dimensions and column order must match xmis/ximp.

Author

tools:::Rd_package_author("missForest")

Details

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.

References

Oba2003missForest

See Also

mixError, missForest

Examples

Run this code
## 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)

Run the code above in your browser using DataLab