Skip to contents

Packages a gmm_imputation as a mice::mids object so that an arbitrary model estimand can be fitted and pooled with the established mice workflow. The joint Gaussian-mixture imputations – including the multimodal and heteroscedastic shapes a univariate imputer cannot produce – flow through unchanged; mice supplies with(), mice::pool(), and the pooled diagnostics.

Usage

as_mids(object)

Arguments

object

A gmm_imputation.

Value

A mice::mids object with m imputations.

See also

Examples

set.seed(1)
x1 <- rnorm(150); x2 <- x1 + rnorm(150)
x2[runif(150) < 0.3] <- NA
imp <- gmm_impute(cbind(x1, x2), N = 1L, m = 10L, seed = 1L)
if (requireNamespace("mice", quietly = TRUE)) {
  fit <- with(as_mids(imp), lm(x2 ~ x1))
  summary(mice::pool(fit))
}
#>          term   estimate  std.error statistic        df      p.value
#> 1 (Intercept) 0.01909702 0.09597906 0.1989707  71.05456 8.428539e-01
#> 2          x1 0.89798425 0.09967653 9.0089838 111.29150 6.668483e-15