Package: causalMed 0.1.3

Alimu Dayimu

causalMed: Parametric G-Formula for Longitudinal Mediation and Total Effects

Causal mediation analysis for longitudinal data with time-varying exposures, mediators and confounders, covering both interventional (Lin et al. (2017) <doi:10.1002/sim.7426>) and natural (Zheng and van der Laan (2017) <doi:10.1515/jci-2016-0006>) direct and indirect effects. Estimation uses the parametric g-formula (Robins (1986) <doi:10.1016/0270-0255(86)90088-6>), which is also exposed directly so that counterfactual means or risks can be estimated under static, dynamic or time-varying hypothetical interventions.

Authors:Alimu Dayimu [aut, cre], Xingling Guo [aut]

causalMed_0.1.3.tar.gz
causalMed_0.1.3.zip(r-4.7-any)causalMed_0.1.3.zip(r-4.6-any)
causalMed_0.1.3.tar.gz(r-4.7-any)causalMed_0.1.3.tar.gz(r-4.6-any)
causalMed_0.1.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
causalMed/json (API)

# Install 'causalMed' in R:
install.packages('causalMed', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/adayim/causalmed/issues

Pkgdown/docs site:https://adayim.github.io

Datasets:
  • gvhd - Bone marrow transplant data
  • nonsurvivaldata - Example Dataset for a Non-Survival Outcome
  • survivaldata - Example Dataset for a Survival Outcome
  • yamamurodata - Yamamuro et al. (2021) Multi-Mediator Simulation Dataset

On CRAN:

Conda:

3.34 score 11 scripts 5 exports 9 dependencies

Last updated from:910cb66d3b. Checks:6 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK188
source / vignettesOK277
linux-releaseOK185
windows-develOK117
windows-releaseOK100
wasm-releaseOK118

Exports:dyn_intgformulamediationrecodesspec_model

Dependencies:codetoolsdata.tablefuturefuture.applyglobalslistenvnnetparallellyprogressr

Causal Mediation Analysis with causalMed
Introduction | The two estimands | Requirements | Survival data | Single mediator: interventional effects | The interventions | The decomposition | Permutation averaging: n_vw | Other exposure regimes | Multiple mediators: the Yamamuro et al. (2021) simulation | Censoring | Absorbing states with subset | Bootstrap confidence intervals | Natural effects | Targeted estimation | References

Last update: 2026-11-06
Started: 2026-11-06

causalMed and gfoRmula: A Comparative Overview
Overview | Shared foundation | What gfoRmula offers that causalMed does not | What causalMed adds: mediation | Interfaces | Side-by-side estimates | Data preparation | Example 1: Binary end-of-follow-up outcome | Example 2: Survival (time-to-event) outcome | Example 3: Dynamic intervention | Larger Monte Carlo sample | References

Last update: 2026-11-06
Started: 2026-11-06

Estimating Total Effects with the Parametric G-formula
Introduction | Example 1: binary end-of-follow-up outcome | Example 2: survival (time-to-event) outcome | Dynamic (threshold) interventions | Custom covariate distributions | A published example: preventing GvHD (Keil et al. 2014) | Bootstrap Confidence Intervals | Working with Results | Extracting fitted models | Retrieving the simulated data | References

Last update: 2026-11-06
Started: 2026-11-06

Getting Started with causalMed
Introduction | Data | Specifying models | Lagged and derived variables | Quick start: total effects with gformula() | Quick start: mediation with mediation() | Parallel bootstrap | Causal assumptions | References

Last update: 2026-11-06
Started: 2026-11-06