Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/mice.impute.heckprob.R
Imputes univariate binary Missing Not At Random (MNAR) outcome using the bivariate probit sample selection model.
1 | mice.impute.heckprob(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 binary MNAR outcome using the bivariate probit sample selection model. This imputation model requires defining a selection and an outcome equation for the bivariate probit model. The imputation algorithm consists of the following steps:
Fit the bivariate probit model and compute the posterior distribution of parameters
Draw imputation parameters from their posterior distributions
Draw imputed values from their predictive distribution
A vector of length nmis
with imputations (0 or 1).
Jacques-Emmanuel Galimard and Matthieu Resche-Rigon
Galimard, J.E., Chevret, S., Curis, E., and Resche-Rigon, M. (2018). Heckman imputation models for binary or continuous MNAR missing outcomes and MAR missing predictors. BMC Medical Research Methodology (In press).
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 39 40 41 42 | # Import dataset with a suspected MNAR mechanism
require("GJRM")
require(mvtnorm)
require(pbivnorm)
data("hiv")
# We select only one region (lusuka) and 5 variables
lusuka <- hiv[hiv$region==5,c("hiv", "age", "marital", "condom", "smoke")]
# Categorical variables have to be recoded as factor
lusuka$hiv <- as.factor(lusuka$hiv)
# Specify a selection (missing data mechanism) and an outcome equation (analyse model)
# Generate an empty matrix
JointModelEq <- generate_JointModelEq(data=lusuka,varMNAR = "hiv")
# Fill in with 1 for variable included in equations
JointModelEq[,"hiv_var_sel"] <- c(0,1,1,1,1)
JointModelEq[,"hiv_var_out"] <- c(0,1,1,1,0)
# Generation of argument for MNAR imputation model in "mice()" function
arg <- MNARargument(data=lusuka,varMNAR="hiv",JointModelEq=JointModelEq)
# Imputation using mice() function
# Values returned have to be included in the "mice()" function as argument:
## Not run: imputation <- mice(data = arg$data_mod,
method = arg$method,
predictorMatrix = arg$predictorMatrix,
JointModelEq=arg$JointModelEq,
control=arg$control,
maxit=1,m=5)
# Because of missing data only on one variable, fix maxit=1
# Estimation on each imputed dataset and pooling
analysis <- with(imputation,glm(hiv~age+condom+marital,family=binomial(link="probit")))
result <- pool(analysis)
summary(result)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.