normImp {mlmi} | R Documentation |
Multivariate normal model imputation
Description
This function performs multiple imputation under a multivariate normal model
as described by Schafer (1997), using his norm
package, either with
or without posterior draws.
Usage
normImp(obsData, M = 10, pd = FALSE, steps = 100, rseed)
Arguments
obsData |
The data frame to be imputed. |
M |
Number of imputations to generate. |
pd |
Specify whether to use posterior draws ( |
steps |
If |
rseed |
The value to set the |
Details
This function imputes from a multivariate normal model with unstructured covariance
matrix, as described by Schafer (1997). With pd=FALSE
, all imputed datasets
are generated conditional on the MLE of the model parameter, referred to as maximum
likelihood multiple imputation by von Hippel and Bartlett (2021).
With pd=TRUE
, regular 'proper' multiple imputation
is used, where each imputation is drawn from a distinct value of the model
parameter. Specifically, for each imputation, a single MCMC chain is run,
iterating for steps
iterations.
Imputed datasets can be analysed using withinBetween
,
scoreBased
, or for example the
bootImpute package.
Value
A list of imputed datasets, or if M=1
, just the imputed data frame.
References
Schafer J.L. (1997). Analysis of incomplete multivariate data. Chapman & Hall, Boca Raton, Florida, USA.
von Hippel P.T. and Bartlett J.W. Maximum likelihood multiple imputation: faster, more efficient imputation without posterior draws. Statistical Science 2021; 36(3) 400-420 doi:10.1214/20-STS793.
Examples
#simulate a partially observed dataset from multivariate normal distribution
set.seed(1234)
n <- 100
temp <- MASS::mvrnorm(n=n,mu=rep(0,4),Sigma=diag(4))
#make some values missing
for (i in 1:4) {
temp[(runif(n)<0.25),i] <- NA
}
#impute using normImp
imps <- normImp(data.frame(temp), M=10, pd=FALSE, rseed=4423)