Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/mice.impute.hecknorm2step.R
Imputes univariate continuous Missing Not At Random (MNAR) outcome using Heckman's model with a two-step estimator.
1 | mice.impute.hecknorm2step(y, ry, x, JointModelEq, control, ...)
|
y |
Incomplete data vector of length |
ry |
Vector of missing data pattern of length |
x |
Matrix (n x p) of complete covariates. |
JointModelEq |
Output |
control |
Output |
... |
Other named arguments. |
Imputation of continuous MNAR outcome using two-step Heckman's model (Galimard, 2016). This imputation model requires to define a selection and an outcome equation. The imputation algorithm consists of the following steps:
Compute Inverse Mill's Ratio (IMR) from the selection equation probit model
Include IMR as predictor in the imputation model
Draw imputation parameters using approximate proper imputation for the linear model and adding the Heckman variance correction as detailed in Galimard et al (2016)
Draw imputed values from their predictive distribution
A vector of length nmis
with imputations.
mice.impute.hecknorm()
should be preferred as mice.impute.hecknorm2step()
. Accordingly, for continuous outcome, mice.impute.hecknorm()
is a default. However, it is possible to modify the method
argument by hand.
Jacques-Emmanuel Galimard and Matthieu Resche-Rigon
Galimard, J.-E., Chevret, S., Protopopescu, C., and Resche-Rigon, M. (2016) A multiple imputation approach for MNAR mechanisms compatible with Heckman's model. Statistics In Medicine, 35: 2907-2920. doi:10.1002/sim.6902.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | require("GJRM")
require(mvtnorm)
require(sampleSelection)
# Generation of a simulated dataset with MNAR mechanism on a continuous outcome
X1 <- rnorm(500,0,1)
X2 <- rbinom(500,1,0.5)
X3 <- rnorm(500,1,0.5)
errors <- rmvnorm(500,mean=c(0,0),sigma=matrix(c(1,0.3,0.3,1),nrow=2,byrow=TRUE))
Y <- X1+X2+errors[,1]
Ry <- ifelse(0.66+1*X1-0.5*X2+X3+errors[,2]>0,1,0)
Y[Ry==0] <- NA
simul_data <- data.frame(Y,X1,X2,X3)
JointModelEq <- generate_JointModelEq(data=simul_data,varMNAR = "Y")
JointModelEq[,"Y_var_sel"] <- c(0,1,1,1)
JointModelEq[,"Y_var_out"] <- c(0,1,1,0)
arg <- MNARargument(data=simul_data,varMNAR="Y",JointModelEq=JointModelEq)
arg$method["Y"] <- "hecknorm2step"
## Not run: imputation3 <- mice(data = arg$data_mod,
method = arg$method,
predictorMatrix = arg$predictorMatrix,
JointModelEq=arg$JointModelEq,
control=arg$control,
maxit=1,m=5)
analysis3 <- with(imputation3,lm(Y~X1+X2+X3))
result3 <- pool(analysis3)
summary(result3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.