Learn R Programming

misspi (version 0.1.1)

evaliq: Evaluate the Imputation Quality

Description

Calculates Root Mean Squared Error (RMSE), Mean Absolute Error (MAE) and Normalized Root Mean Squared Error (NRMSE). It also performs visualization for imputation quality evaluation.

Usage

evaliq(x.true, x.impute, plot = TRUE, interactive = FALSE)

Value

rmse root mean squared error.

mae mean absolute error.

nrmse normalized root mean squared error.

Arguments

x.true

a vector with true values.

x.impute

a vector with estimated values.

plot

a Boolean that indicates whether to plot or not.

interactive

a Boolean that indicates whether to use interactive plot when the plot option is invoked (plot = "TRUE").

Author

Zhongli Jiang jiang548@purdue.edu

See Also

misspi, missar

Examples

Run this code
# A very quick example
n <- 100
x.true <- rnorm(n)
x.est <- x.true
na.idx <- sample(1:n, 20)
x.est[na.idx] <- x.est[na.idx] + rnorm(length(na.idx), sd = 0.1)

# Default plot
er.eval <- evaliq(x.true[na.idx], x.est[na.idx])

# Interactive plot
er.eval <- evaliq(x.true[na.idx], x.est[na.idx], interactive = TRUE)

# Turn off plot
# All of the three case will return the value of error
er.eval <- evaliq(x.true[na.idx], x.est[na.idx], plot = FALSE)
er.eval


# \donttest{
# Real data example
set.seed(0)
data(toxicity, package = "misspi")
toxicity.miss <- missar(toxicity, 0.4, 0.2)
# Please change ncore according to your computer
impute.res <- misspi(toxicity.miss, ncore = 1)
x.imputed <- impute.res$x.imputed

na.idx <- which(is.na(toxicity.miss))
evaliq(toxicity[na.idx], x.imputed[na.idx])
evaliq(toxicity[na.idx], x.imputed[na.idx], interactive = TRUE)# }

Run the code above in your browser using DataLab