misim {clarify}R Documentation

Simulate model coefficients after multiple imputation


misim() simulates model parameters from multivariate normal or t distributions after multiple imputation that are then used by sim_apply() to calculate quantities of interest.


misim(fitlist, n = 1000, vcov = NULL, coefs = NULL, dist = NULL)



a list of model fits, one for each imputed dataset, or a mira object (the output of a call to with() applied to a mids object in mice).


the number of simulations to run for each imputed dataset; default is 1000. More is always better but resulting calculations will take longer.


a square covariance matrix of the coefficient covariance estimates, a function to use to extract it from fit, or a list thereof with an element for each imputed dataset. By default, uses stats::vcov() or insight::get_varcov() if that doesn't work.


a vector of coefficient estimates, a function to use to extract it from fit, or a list thereof with an element for each imputed dataset. By default, uses stats::coef() or insight::get_parameters() if that doesn't work.


a character vector containing the name of the multivariate distribution(s) to use to draw simulated coefficients. Should be one of "normal" (multivariate normal distribution) or "t_{#}" (multivariate t distribution), where ⁠{#}⁠ corresponds to the desired degrees of freedom (e.g., "t_100"). If NULL, the right distributions to use will be determined based on heuristics; see sim() for details.


misim() essentially combines multiple sim() calls applied to a list of model fits, each fit in an imputed dataset, into a single combined pool of simulated coefficients. When simulation-based inference is to be used with multiply imputed data, many imputations are required; see Zhou and Reiter (2010).


A clarify_misim object, which inherits from clarify_sim and has the following components:


a matrix containing the simulated coefficients with a column for each coefficient and a row for each simulation for each imputation


a matrix containing the original coefficients extracted from fitlist or supplied to coefs, with a row per imputation.


the list of model fits supplied to fitlist


a identifier of which imputed dataset each set of simulated coefficients corresponds to.

The "dist" attribute contains "normal" if the coefficients were sampled from a multivariate normal distribution and "t({df})" if sampled from a multivariate t distribution. The "clarify_hash" attribute contains a unique hash generated by rlang::hash().


Zhou, X., & Reiter, J. P. (2010). A Note on Bayesian Inference After Multiple Imputation. The American Statistician, 64(2), 159–163. doi:10.1198/tast.2010.09109

See Also


data("africa", package = "Amelia")

# Multiple imputation using Amelia
a.out <- Amelia::amelia(x = africa, m = 10,
                        cs = "country",
                        ts = "year", logs = "gdp_pc",
                        p2s = 0)

fits <- with(a.out, lm(gdp_pc ~ infl * trade))

# Simulate coefficients
s <- misim(fits)

[Package clarify version 0.2.1 Index]