binoutzimed {mzipmed}R Documentation

Mediation Analysis for Zero-Inflated Count Mediators using MZIP (Binary or Count Outcome)

Description

This function incorporates the MZIP model into the counterfactual approach to mediation analysis as proposed by Vanderweele when the mediator is a Zero-Inflated count variable for cases with binary or count outcome using a Poisson regression with robust standard errors. 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. A Poisson regression with robust standard errors were used to obtain direct and indirect effect estimates on a risk ratio scale because odds ratios are a non-collapsible measure which can cause issues in a mediation framework (see Vanderweele 2016). A logistic-regression can be specified for rare outcomes.

Usage

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

Arguments

outcome

is the binary or count outcome variable

mediator

is the zero-inflated 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)

C

is a vector for theoretical values of each confounder. By default each each value of C will be the mean value of each confounder.

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.

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 mediator model. Note: Mediator/Offset is used in the outcome model

rare

set to TRUE of the outcome is rare and a logistic-regression should be used instead. Default is FALSE using robust Poisson model

OFF

is an offset is specified a fixed value of the offset variable is required for computation of effects. By default the mean is used.

Value

The function will return a list of 12 elements. GLM is the results of regressing the mediator+exposure+confounder on the outcome using a Poisson model with robust standard errors
MZIP is the results of regressing the exposure and confounders on the mediator using the MZIP model
RRNDE is the risk ratio of the direct effect
RRNIE is the risk ratio of the indirect effect.
logRRNDEse is the standard error for the log risk ratio of NDE
RRNDEci is the 95% confidence interval for the direct effect risk ratio
logRRNIEse is the standard error for the indirect effect log risk ratio
RRNIEci is the 95% confidence interval for the indirect effect risk ratio
RRTE is the total effect risk ratio
logRRTEse is the standard error for the total effect log risk ratio
RRTECI is the confidence interval for the total effect risk ratio
PM is the proportion mediated

Examples

    #Example with delta method
    zimed=binoutzimed(outcome=mzipmed_data$binY,mediator=mzipmed_data$ziM,
                     exposure=mzipmed_data$X,confounder=cbind(mzipmed_data$C1,
                     mzipmed_data$C2),error="Delta",robust=FALSE,X=1,Xstar=0,
                     zioff=NULL,OFF=NULL,rare=FALSE)

    #Example using bootstrapping, 10 iterations are used for succinctness
    zimed2=binoutzimed(outcome=mzipmed_data$binY,mediator=mzipmed_data$ziM,
                   exposure=mzipmed_data$X,confounder=cbind(mzipmed_data$C1,
                   mzipmed_data$C2),error="Boot",n=10,C=c(0,0.5))

[Package mzipmed version 1.4.0 Index]