miceadds (version 3.2-48)

mice.impute.smcfcs: Substantive Model Compatible Multiple Imputation (Single Level)

Description

Computes substantive model compatible multiple imputation (Bartlett et al., 2015; Bartlett & Morris, 2015). Several regression functions are allowed (see dep_type).

Usage

mice.impute.smcfcs(y, ry, x, wy=NULL, sm, dep_type="norm", sm_type="norm",
       fac_sd_proposal=1, mh_iter=20, ...)

Arguments

y

Incomplete data vector of length n

ry

Vector of missing data pattern (FALSE -- missing, TRUE -- observed)

x

Matrix (n x p) of complete covariates.

wy

Logical vector indicating positions where imputations should be conducted.

sm

Formula for substantive model.

dep_type

Distribution type for variable which is imputed. Possible choices are "norm" (normal distribution), "lognorm" (lognormal distribution), "yj" (Yeo-Johnson distribution, see mdmb::yjt_regression), "bc" (Box-Cox distribution, see mdmb::bct_regression), "logistic" (logistic distribution).

sm_type

Distribution type for dependent variable in substantive model. One of the distribution mentioned in dep_type can be chosen.

fac_sd_proposal

Starting value for factor of standard deviation in Metropolis-Hastings sampling.

mh_iter

Number iterations in Metropolis-Hasting sampling

Further arguments to be passed

Value

A vector of length nmis=sum(!ry) with imputed values.

Details

Imputed values are drawn based on a Metropolis-Hastings sampling algorithm in which the standard deviation of the proposal distribution is adaptively tuned.

References

Bartlett, J. W., & Morris, T. P. (2015). Multiple imputation of covariates by substantive-model compatible fully conditional specification. Stata Journal, 15(2), 437-456.

Bartlett, J. W., Seaman, S. R., White, I. R., Carpenter, J. R., & Alzheimer's Disease Neuroimaging Initiative (2015). Multiple imputation of covariates by fully conditional specification: Accommodating the substantive model. Statistical Methods in Medical Research, 24(4), 462-487. http://dx.doi.org/10.1177/0962280214521348

See Also

See the smcfcs package for an alternative implementation of substantive model multiple imputation in a fully conditional specification approach.

Examples

Run this code
# NOT RUN {
#############################################################################
# EXAMPLE 1: Substantive model with interaction effects
#############################################################################

library(mice)
library(mdmb)

#--- simulate data
set.seed(98)
N <- 1000
x <- stats::rnorm(N)
z <- 0.5*x + stats::rnorm(N, sd=.7)
y <- stats::rnorm(N, mean=.3*x - .2*z + .7*x*z, sd=1 )
dat <- data.frame(x,z,y)
dat[ seq(1,N,3), c("x","y") ] <- NA


#--- define imputation methods
imp <- mice::mice(dat, maxit=0)
method <- imp$method
method["x"] <- "smcfcs"

# define substantive model
sm <- y ~ x*z
# define formulas for imputation models
formulas <- as.list( rep("",ncol(dat)))
names(formulas) <- colnames(dat)
formulas[["x"]] <- x ~ z
formulas[["y"]] <- sm
formulas[["z"]] <- z ~ 1

#- Yeo-Johnson distribution for x
dep_type <- list()
dep_type$x <- "yj"

#-- do imputation
imp <- mice::mice(dat, method=method, sm=sm, formulas=formulas, m=1, maxit=10,
                   dep_type=dep_type)
summary(imp)
# }

Run the code above in your browser using DataLab