Skip to content

Repository files navigation

CausalTargeted.jl

DOI Docs License: MIT

CausalTargeted implements cross-fitted targeted estimators for continuous and longitudinal exposures: longitudinal modified treatment policies (LMTP), interventional mediation (TE / NDE / NIE under MTP), positivity diagnostics, nested Monte Carlo stability checks, and omitted-confounder sensitivity. Defaults favour small-to-moderate sample sizes. Identification is delegated to CausalDynamics.jl.

Design principles: DESIGN.md · NAMING.md · BOUNDARIES.md · ecosystem

On the Julia General registry (Pkg.add("CausalTargeted")). Requires Julia 1.12+. Hard dependency CausalDynamics.jl. Registry tracking: REGISTRATION.md.

Installation

using Pkg
Pkg.add("CausalTargeted")
using CausalTargeted

Development tip of main (before a new version hits General):

Pkg.add(url="https://github.com/SimonAB/CausalTargeted.jl.git")

From the CDCS monorepo:

Pkg.develop(path="packages/CausalTargeted.jl")

CausalDynamics is resolved from General (or from packages/CausalDynamics.jl when both are developed in CDCS).

Quick start

using CausalTargeted, CausalDynamics

df, _ = simulate_linear_mtp(200)
opts = recommend_run_options(size(df, 1); engine = :lmtp)
grid = run_lmtp_grid(
    df, :A, :Y;
    baseline = [:W],
    deltas = [-0.5, 0.0, 0.5],
    folds = opts.folds,
    learners_outcome = opts.learners_outcome,
    learners_trt = opts.learners_trt,
    parallel = opts.parallel,
    positivity = opts.positivity,
)

Ecosystem

Package Role
CausalDynamics.jl Graphs, identify, IdentificationResult
CausalTargeted Nuisances, LMTP / mediation grids, certificates, small-n profiles
DAGMakie.jl DAG figures (optional)
Application repos Cohort data, registries, concordance (thin)

Compared with R and Python

Need This package Familiar elsewhere
LMTP / MTP δ-grids Yes R lmtp, Python Ananke
Interventional mediation (TE/NDE/NIE) Yes R crumble / tmle3
Consumes upstream ID certificate Unique Partial (separate packages)
Small-n Super Learner profiles Yes sl3 + glue

Choose this when Julia-native LMTP/mediation should carry CausalDynamics certificates. Prefer lmtp / Ananke for an existing R or Python end-to-end pipeline. (DoubleML is related Neyman-orthogonal tooling, not LMTP parity.)

Full matrices: ECOSYSTEM_COMPARISON.md · Documenter comparison.

Optional Super Learner candidates

Default grid library is lean (:glm, :mean). Use RICH_SL_LEARNERS when you want interactions / elastic-net / EvoTrees; load the matching weakdeps first:

using CausalTargeted
using MLJ, MLJLinearModels  # :glmnet_* and :mlj_*
using EvoTrees              # :evotree, :evotree_deep

fit_super_learner(X, y; learners = (:glm, :mlj_ridge, :mlj_lasso, :mean))

using MLJFlux  # activates CausalTargetedMLJFluxExt (also needs MLJ)
fit_super_learner(X, y; learners = (:glm, :mlj_mlp, :mean))

Features are column-standardised for MLJ fits (leading intercept of ones is dropped). Neural learners are never included in SMALL_N_SL_LEARNERS / adaptive_learners.

Related packages

This package covers continuous MTP / LMTP and interventional mediation. For point-treatment CM / ATE / AIE, prefer TMLE.jl. Graphs and identification live upstream in CausalDynamics (prepare_for_tmle bridges to TMLE.jl).

Package Role
TMLE.jl Point-treatment CM / ATE / AIE (TMLE, OSE, C-TMLE)
CausalDynamics.jl Graphs and identification certificates (required upstream)
DAGMakie.jl DAG figures for causal diagrams
CausalTables.jl SCM-aware tables; often paired with TMLE.jl
CausalInference.jl Structure learning and classical graphical criteria

R analogues for the continuous / mediation slice (lmtp, crumble) are conceptual parity, not API identity; see NAMING.md.

Documentation

Build Documenter pages locally:

julia --project=docs -e 'using Pkg; Pkg.instantiate()'
julia --project=docs docs/make.jl

Core citations

Full list in References. Highlights:

  • Díaz, Williams, Hoffman & Schenck (2023). Nonparametric causal effects based on longitudinal modified treatment policies. JASA. doi:10.1080/01621459.2021.1955691
  • Díaz & Hejazi (2020). Causal mediation analysis for stochastic interventions. JRSS-B. doi:10.1111/rssb.12362
  • Liu, Williams, Rudolph & Díaz (2024). General targeted machine learning for modern causal mediation analysis. arXiv:2408.14620
  • van der Laan & Rose (2011). Targeted Learning. Springer
  • Cinelli & Hazlett (2020). Making sense of sensitivity. JRSS-B. doi:10.1111/rssb.12348

Acknowledgements

Part of the Causal Dynamics for Complex Systems (CDCS) project. Maintainer: Simon A. Babayan.

License

MIT License — see LICENSE.

Citation

See CITATION.cff or:

@software{causaltargeted2026,
  author = {Babayan, Simon A.},
  title  = {CausalTargeted.jl: Cross-fitted LMTP and interventional mediation},
  year   = {2026},
  doi    = {10.5281/zenodo.21703329},
  url    = {https://github.com/SimonAB/CausalTargeted.jl}
}

About

Cross-fitted LMTP and interventional mediation for continuous exposures; identification via CausalDynamics.jl

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages