ds.mediate: Causal Mediation Analysis

View source: R/ds.mediate.R

ds.mediateR Documentation

Causal Mediation Analysis

Description

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

Usage

ds.mediate(
  model.m = NULL,
  model.y = NULL,
  treat = NULL,
  mediator = NULL,
  boot = FALSE,
  conf.level = 0.95,
  robustSE = FALSE,
  sims = 1000,
  seed = NULL,
  newobj = NULL,
  datasources = NULL
)

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. Default is to return the 2.5 and 97.5 percentiles of the simulated quantities.

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.

datasources

a list of DSConnection-class objects obtained after login. If the datasources argument is not specified the default set of connections will be used: see datashield.connections_default.

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.

Value

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

Author(s)

Demetris Avraam, for DataSHIELD Development Team


datashield/dsMediationClient documentation built on June 15, 2022, 12:19 p.m.