zioutbinmed {mzipmed}R Documentation

Mediation Analysis for Zero-Inflated Count Outcomes using MZIP with binary mediators

Description

This function incorporates the MZIP model into the counterfactual approach to mediation analysis as proposed by Vanderweele when the outcome is a Zero-Inflated count variable for cases with binary mediators using a logistic regression mediator model. Standard Errors for direct and indirect effects are computed using delta method or bootstrapping. Note: This function assumes that the outcome is continuous and all exposure, mediator, outcome, and confounder variables have the same sample size. Binary variables must be dummy coded prior. See vignette for information on how to use offset command zioff.

Usage

zioutbinmed(
  outcome,
  mediator,
  exposure,
  confounder = NULL,
  n = 1000,
  X = 1,
  Xstar = 0,
  C = NULL,
  error = "Delta",
  robust = FALSE,
  zioff = NULL
)

Arguments

outcome

is the zero-inflated count outcome variable

mediator

is the binary mediator variable, currently only 1 mediator variable is allowed

exposure

is the primary exposure being considered, only 1 is allowed

confounder

is a vector of confounder variables. If no confounder variables are needed then confounder is set to NULL. If more than 1 confounder is being considered then use the cbind function, e.g. cbind(var1,var2)

n

is the number of repetition if bootstrapped errors are used. Default is 1000

X

is the theoretical value for the exposure variable to be set at. The default is to 1

Xstar

is the theoretical value for the exposure variable to be compared to X. The default is 0, so direct, indirect, and proportion mediated values will be for a 1 unit increase in the exposure variable.

C

is a vector for theoretical values of each confounder. If left out the default will be set to the mean of each confounder giving marginal effects

error

='Delta' for delta method standard errors and ='Boot' for bootstrap. Default is delta method

robust

indicates if a robust covariance matrix should be used for MZIP in delta method derivations. Default is FALSE.

zioff

(optional) use to specify an offset variable within the MZIP outcome model.

Value

The function will return a list of 12 elements. GLM is the logistic model regressing the exposure and covariates on the continuous mediator
MZIP is the results of regressing the exposure, covariates, and mediator on the outcome using the MZIP model
RRNDE is the incidence rate ratio of the direct effect
RRNIE is the incidence rate ratio of the indirect effect.
logRRNDEse is the standard error for the log rate ratio of NDE
RRNDEci is the 95% confidence interval for the direct effect rate ratio
logRRNIEse is the standard error for the indirect effect log rate ratio
RRNIEci is the 95% confidence interval for the indirect effect rate ratio
RRTE is the total effect rate ratio
logRRTEse is the standard error for the total effect log rate ratio
RRTECI is the confidence interval for the total effect rate ratio
PM is the proportion mediated

Examples

    #Example using delta method
    ziout=zioutbinmed(outcome=mzipmed_data$ziY2,mediator=mzipmed_data$binM,
                   exposure=mzipmed_data$X,confounder=cbind(mzipmed_data$C1,
                   mzipmed_data$C2),error="Delta",robust=FALSE,X=1,Xstar=0,zioff=NULL)
## Not run: 
    #Example using bootstrapping with 10 iterations
    ziout2=zioutbinmed(outcome=mzipmed_data$ziY2,mediator=mzipmed_data$binM,
                   exposure=mzipmed_data$X,confounder=cbind(mzipmed_data$C1,
                   mzipmed_data$C2),error="Boot",n=10,C=c(0,0.5),zioff=NULL)
   
## End(Not run)

[Package mzipmed version 1.4.0 Index]