Learn R Programming

MGMM (version 1.0.1.3)

GenImputation: Generate Stochastic Imputation

Description

Generates a single stochastic imputation of the data from a fitted GMM. Observed values are unchanged; missing values are drawn from the conditional distribution given the observed data (or from the marginal distribution for fully missing rows). For multiple imputation, call this function repeatedly and combine results using CombineMIs.

Usage

GenImputation(fit)

Value

Numeric matrix with the same dimensions as fit@Data, with missing values imputed. If the fitted data have no missing values, returns the original data unchanged.

Arguments

fit

Fitted model of class mvn or mix (e.g. from FitGMM).

Examples

Run this code
set.seed(100)

# Generate data and introduce missingness.
data <- rGMM(n = 25, d = 2, k = 1)
data[1, 1] <- NA
data[2, 2] <- NA
data[3, ] <- NA 

# Fit GMM.
fit <- FitGMM(data)

# Generate imputation.
imputed <- GenImputation(fit)

Run the code above in your browser using DataLab