Learn R Programming

miceMNAR (version 1.0.2)

mice.impute.hecknorm: Imputation by Heckman's model for continuous outcome with Missing Not At Random mechanism using one-step estimator

Description

Imputes univariate missing continuous outcome using Heckman's model with a one-step maximum likelihood estimator.

Usage

mice.impute.hecknorm(y, ry, x, JointModelEq, control, ...)

Arguments

y

Incomplete data vector of length n.

ry

Vector of missing data pattern of length n (FALSE=missing, TRUE=observed).

x

Matrix (n x p) of complete covariates.

JointModelEq

Output JointModelEq provided by MNARargument() function.

control

Output control provided by MNARargument() function.

Other named arguments.

Value

A vector of length nmis with imputations.

Details

Imputation of continuous MNAR outcome using Heckman's model. This imputation model requires to define a selection and an outcome equation for the imputation model. The imputation algorithm consists of the following steps:

  1. Fit the one-step Heckman's model and compute the posterior distribution of parameters

  2. Draw imputation parameters from their posterior distribution

  3. Draw imputed values from their predictive distribution

References

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).

See Also

miceMNAR

Examples

Run this code
# NOT RUN {
require("GJRM")
require(mvtnorm)

# 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)

# }
# NOT RUN {
imputation2 <- mice(data = arg$data_mod,
                 method = arg$method,
                 predictorMatrix = arg$predictorMatrix,
                 JointModelEq=arg$JointModelEq,
                 control=arg$control,
                 maxit=1,m=5)

analysis2 <- with(imputation,lm(Y~X1+X2+X3))
result2 <- pool(analysis2)
summary(result2)
# }

Run the code above in your browser using DataLab