GenImputation: Generate Stochastic Imputation

View source: R/09_Imputation.R

GenImputationR Documentation

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)

Arguments

fit

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

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.

Examples

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)

MGMM documentation built on Feb. 27, 2026, 1:07 a.m.