| mixError | R Documentation |
mixError computes imputation error for mixed-type data given the
imputed matrix (ximp), the original matrix with missing values
(xmis), and the complete ground truth (xtrue). It reports the
normalized root mean squared error (NRMSE) for numeric variables and the
proportion of falsely classified entries (PFC) for factor variables.
mixError(ximp, xmis, xtrue)
ximp |
Imputed data matrix (or data frame) with variables in columns and observations in rows. There must be no missing values. |
xmis |
Data matrix (or data frame) with missing values used to derive the missingness pattern. |
xtrue |
Complete data matrix (or data frame) containing the true values. There must be no missing values. |
A named vector with the imputation error(s):
NRMSE: normalized root mean squared error computed over the
numeric entries that were missing in xmis.
PFC: proportion of falsely classified entries computed over
the factor entries that were missing in xmis.
If only one type (numeric or factor) is present among the missing entries, only the corresponding error is returned.
Columns are treated by their R classes: numeric metrics are computed for
numeric columns and classification metrics for factor
columns. Character columns should be converted to factors beforehand.
This function is used internally by missForest when a complete
matrix xtrue is supplied.
Daniel J. Stekhoven [aut, cre]
StekhovenBuehlmann2012missForest
For the NRMSE notion in imputation benchmarking: \insertRefOba2003missForest
missForest, nrmse
## Mixed-type error computation on iris:
data(iris)
## Introduce missingness:
set.seed(81)
iris.mis <- prodNA(iris, noNA = 0.2)
## Impute:
iris.imp <- missForest(iris.mis)
## Compute the true imputation error:
err.imp <- mixError(iris.imp$ximp, iris.mis, iris)
err.imp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.