This function is similar to R function mediate from the mediation package.

mediateDS(
  model.m,
  model.y,
  treat,
  mediator,
  boot,
  conf.level,
  robustSE,
  sims,
  seed,
  newobj
)

Arguments

model.m

a string character, the name of a fitted model object for mediator.

model.y

a string character, the name of a fitted model object for outcome.

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

mediator

a character string indicating the name of the mediator variable used in the models.

boot

a logical value. if 'FALSE' a quasi-Bayesian approximation is used for confidence intervals; if 'TRUE' nonparametric bootstrap will be used. Default is 'FALSE'.

conf.level

the level of the returned two-sided confidence intervals.

robustSE

a logical value. If 'TRUE', heteroskedasticity-consistent standard errors will be used in quasi-Bayesian simulations. Ignored if 'boot' is 'TRUE' or neither 'model.m' nor 'model.y' has a method for vcovHC in the sandwich package. Default is 'FALSE'.

sims

a number of Monte Carlo draws for nonparametric bootstrap or quasi-Bayesian approximation.

seed

a number of a seed random number generator. Default value is NULL.

newobj

a character string that provides the name for the output object that is stored on the data servers. Default med.out.

Value

a summary table of the object of class 'mediate'.

Details

The function 'mediate' 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.

Author

Demetris Avraam, for DataSHIELD Development Team