Learn R Programming

VarSelLCM (version 2.1.3.1)

VarSelImputation: Imputation of missing values

Description

This function permits imputation of missing values in a dataset by using mixture model. Two methods can be used for imputation:

  • posterior mean (method="postmean")

  • sampling from the full conditionnal distribution (method="sampling")

Usage

VarSelImputation(obj, newdata, method = "postmean")

Arguments

obj

an instance of '>VSLCMresults which defines the model used for imputation.

newdata

data.frame Dataset containing the missing values to impute.

method

character definiting the method of imputation: "postmean" or "sampling"

Examples

Run this code
# NOT RUN {
# Data loading
data("heart")

# Clustering en 2 classes
results <- VarSelCluster(heart[,-13], 2)

# Data where missing values will be imputed
newdata <- heart[1:2,-13]
newdata[1,1] <- NA
newdata[2,2] <- NA

# Imputation
VarSelImputation(results, newdata)

# }

Run the code above in your browser using DataLab