MyNixOS website logo
Description

Causal Mediation Analysis with Diagnostics and Sensitivity Analysis.

Provides tools for causal mediation analysis with continuous treatments using inverse probability weighting (IPW). Estimates natural direct and indirect effects over a user-defined treatment grid and supports flexible dose-response mediation analysis. Includes diagnostic procedures for assessing covariate balance in both treatment and mediator models using standardized mean differences. Implements pathway-specific extensions of the impact threshold for a confounding variable (ITCV; Frank, 2000 <doi:10.1177/0049124100029002001>) adapted to mediation settings. Provides joint sensitivity analysis combining E-values (VanderWeele and Ding, 2017 <doi:10.7326/M16-2607>) and violations of sequential ignorability (Imai, Keele, and Yamamoto, 2010 <doi:10.1214/10-STS321>). Additional utilities include visualization of dose-response mediation functions, robustness profiles, fragility summaries, and formatted outputs for applied research. Supports clustered data structures and multiple outcome families.

RobustMediate

Robust causal mediation analysis with embedded diagnostics, dose-response curves, pathway-specific sensitivity (medITCV), and a novel bivariate sensitivity contour.

What it does

FunctionWhat it gives you
robustmediate()Fit treatment / mediator / outcome models, compute IPW weights, NDE/NIE/TE curves with bootstrap CIs, and the full sensitivity surface in one call
plot_balance()Dual love plot: covariate balance before/after weighting for both pathways simultaneously
plot_mediation()Dose-response curves of NDE, NIE, TE with pointwise confidence bands
plot_sensitivity()Novel 2-D robustness map: E-value x Imai rho — does not exist elsewhere in R
sensitivity_meditcv()Pathway-specific mediation ITCV (medITCV) for a-path and b-path
plot_meditcv()Robustness corridor plot for each pathway
sensitivity_meditcv_profile()Minimum robustness principle + bottleneck identification
plot_meditcv_profile()Fragility profile as confounding impact increases
fragility_table()Publication-ready pathway decomposition table
diagnose()Formatted report with a paste-ready Results paragraph

Installation

# Development version from GitHub
# install.packages("pak")
pak::pkg_install("causalfragility-lab/RobustMediate")

Quick start

library(RobustMediate)

fit <- robustmediate(
  treatment_formula = X ~ Z1 + Z2,
  mediator_formula  = M ~ X + Z1 + Z2,
  outcome_formula   = Y ~ X + M + Z1 + Z2,
  data = mydata,
  R    = 500
)

plot_balance(fit)                        # love plot
plot_mediation(fit)                      # NDE / NIE dose-response curve
plot_sensitivity(fit)                    # E-value x rho contour
plot(fit, type = "meditcv")             # medITCV robustness corridor
plot(fit, type = "meditcv_profile")     # fragility profile
fragility_table(fit)                     # pathway decomposition
diagnose(fit)                            # paste into Results section

Why this package?

  • EValue plots E-values only
  • mediation plots rho sensitivity only
  • cobalt / WeightIt do love plots for treatment only

RobustMediate combines all three into one coherent workflow tailored to continuous-treatment mediation, and adds:

  • The joint E-value x rho contour that exists nowhere else in R
  • Pathway-specific medITCV (mediation ITCV) extending Frank (2000) to mediation
  • Minimum robustness principle and bottleneck identification for indirect effects

References

  • Frank, K. A. (2000). Impact of a confounding variable on a regression coefficient. Sociological Methods & Research, 29(2), 147-194.
  • VanderWeele, T. J. & Ding, P. (2017). Sensitivity analysis in observational research: Introducing the E-value. Annals of Internal Medicine, 167(4), 268-274.
  • Imai, K., Keele, L., & Yamamoto, T. (2010). Identification, inference and sensitivity analysis for causal mediation effects. Statistical Science, 25(1), 51-71.

Contributing

Bug reports and feature requests via GitHub Issues.

License

MIT.

Metadata

Version

0.1.1

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows