multimediate: multimediate

View source: R/multimediate.R

multimediateR Documentation

multimediate

Description

'multimediate' is used to estimate various quantities for causal mediation analysis, including average causal mediation effects (indirect effect), average direct effects, proportions mediated, and total effect, in presence of multiple mediators uncausally related. With a binary outcome, 'multimediate' also estimates average causal mediation effects on OR scale and logOR scale. with a survival outcome, 'multimediate' also estimates average causal mediation effects on cases per person-year scale.

Usage

multimediate(
  lmodel.m,
  correlated = FALSE,
  model.y,
  treat,
  treat.value = 1,
  control.value = 0,
  J = 1000,
  conf.level = 0.95,
  fun = mean,
  data = NULL,
  peryr = 1e+05
)

Arguments

lmodel.m

list of fitted models object for mediators. Can be of class 'lm', 'polr','glm'.

correlated

a logical value. if 'FALSE' a identity matrix is used for the matrix of correlation of mediators; if 'TRUE' matrix of correlation is estimated. Default is 'FALSE'.

model.y

a fitted model object for the outcome. Can be of class 'lm', 'polr','glm' or 'aalen'.

treat

a character string indicating the name of the treatment variable used in the models. The treatment can be either binary (integer or a two-valued factor) or continuous (numeric).

treat.value

value of the treatment variable used as the treatment condition. Default is 1.

control.value

value of the treatment variable used as the control condition. Default is 0.

J

number of Monte Carlo draws for quasi-Bayesian approximation.

conf.level

level of the returned two-sided confidence intervals. Default is to return the 2.5 and 97.5 percentiles of the simulated quantities.

fun

the function used to compute the point estimate of the effects of interest from its empirical distribution. The function mean or median can be used. Default is the function mean.

data

dataset with all variables used in the mediator and outcome models

peryr

the number of person-years to multiply the additive estimator to obtain results in scale of cases per person-years (only applicable to the survival outcome)

Value

multimediate returns an object of class "mm", a list that contains the components listed below. The function summary (i.e., summary.mm) can be used to obtain a table of the results.


AllanJe/multimediate documentation built on July 25, 2024, 12:14 p.m.