Giter Club home page Giter Club logo

bsp2020-mediator's Introduction

Best Statistical Practices 2020: mediator

Jordan Creed

๐Ÿ“บ View Slides

๐Ÿ“† February 28th, 2020

๐Ÿ“ Moffitt Cancer Center, Tampa, FL

โญ Abstract

Background: A mediation analysis examines the extent to which the causal relationship between an exposure and outcome operates through an intermediate variable, known as a mediator. A recently developed counterfactual framing of mediation analysis โ€” referred to as causal mediation analysis โ€” extends traditional methods by allowing exposure-mediator interactions and appropriately decomposing the total effect into direct and indirect effects. Current software implementations for causal mediation analysis are available as SAS and SPSS macros by Valeri and VanderWeele. Within R, the package mediation (Tingley et al.) provides a subset of similar functions, but uses a different estimation approach and set of terminology which are less familiar to public health researchers. We present the R package mediator, which provides point estimates and confidence intervals for statistics of interest in a causal mediation analysis. These include the controlled direct effect (CDE), natural direct and indirect effects (NDE and NIE), total effect (TE), and proportion mediated (PM). The package allows the user to specify whether an interaction between the exposure and mediator is assumed to exist. In addition to offering the first R implementation of causal mediation analysis as described by VanderWeele (2015), our implementation offers substantial performance enhancements over existing SAS/SPSS macros.

Usage: The package was developed using R v 3.6.1 and is currently available on GitHub. Installation and loading is accomplished with devtools::install_github("gerkelab/mediator"); library(mediator).The mediator package allows for binary and continuous exposures, mediators and outcomes, as well assurvival outcomes. Use of the package is centered around the mediator() function. Minimum inputs for functionality include the analytic data set (data =), generlized linear model specifications for the outcome and mediator (out.model = and med.model =), and the treatment variable (treat =). Additional options include setting the exposure level (a =), the compared exposure level (a_star =), the level of the mediator (m =), and the number of bootstrap replications for calculating confidence intervals (boot_rep =). Fixed levels of the mediator are used for calculating CDE, hence, there are as many potential values for the CDE as there are levels of the mediator. By default the function calculates parametric confidence intervals using the Delta method, but user specification of nonzero bootstrap replicates automatically changes the method of confidence interval estimation to bootstrap. The function returns a tibble with the CDE, NDE, NIE, TE, and PM, along with 95% confidence intervals. Returned effects are estimated at either the mean value (continuous) or the most common value (categorical) of covariates which are not the mediator or exposure variables.

Conclusion: The mediator R package provides an efficient mechanism for conducting causal mediation analyses and a useful tool in reproducible epidemiologic research.

bsp2020-mediator's People

Contributors

jhcreed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.