Mediation analysis function for binary outcome and binary mediator.
mediate_binaY_binaM(
data,
outcome = "Y",
mediator = "M",
exposure = "X",
covariateY = c("X1", "X2"),
covariateM = c("X1", "X2"),
x0 = 0,
x1 = 1,
cY = c(0, 0),
cM = c(0, 0)
)
A dataset.
The outcome variable.
The mediator variable.
The exposure variable.
A vector of confounders in the outcome regression.
A vector of confounders in the mediator regression.
The baseline exposure level.
The new exposure level.
conditional levels of covariateY
conditional levels of covariateM
A list containing NIE, NDE and MP point and interval estimates.