Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

guess

Impute by (educated) guessing


Description

This function use some primitive methods, including mean imputation, median imputation, random guess, or majority imputation (only for categorical variables), to impute a missing data matrix.

Usage

guess(x, type = "mean")

Arguments

x

a matrix or data frame

type

is the guessing type, including "mean" for mean imputation, "median" for median imputation, "random" for random guess, and "majority" for majority imputation for categorical variables.

Examples

data(parkinson)
# introduce some random missing values
missdata <- SimIm(parkinson, 0.1)
# impute by mean imputation
impdata <- guess(missdata)
# caculate the NRMSE
Rmse(impdata, missdata, parkinson, norm = TRUE)
# by random guessing, the NRMSE should be much bigger
impdata2 <- guess(missdata, "random")
Rmse(impdata2, missdata, parkinson, norm = TRUE)

imputeR

A General Multivariate Imputation Framework

v2.2
GPL-3
Authors
Steffen Moritz [aut, cre] (<https://orcid.org/0000-0002-0085-1804>), Lingbing Feng [aut], Gen Nowak [ctb], Alan. H. Welsh [ctb], Terry. J. O'Neill [ctb]
Initial release
2020-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.