Examples
The do() Operator
Contrast conditioning P(Y|X=x) with intervening P(Y|do(X=x)), then master the full do() API — ATE, CATE, ATT/ATU, contrast arithmetic, and predictive propagation.
Custom Priors
Refine prior distributions using an iterative inspect-check-refine workflow with prior predictive checks.
Custom Transforms
Define domain-specific nonlinearities with estimable parameters and use them in the pathmc DSL.
Model-Based Data Simulation
Generate synthetic datasets from a pathmc model with known parameter values using pathmc.simulate().
Nonparametric Smooths with HSGP
Fit a flexible 1-D nonparametric smooth with the hsgp() term — a Hilbert Space Gaussian Process approximation — and intervene on it with do().
Treatment Effects with Non-Linear Models
Why coefficients ≠ ATE in logistic models, AME vs MEM, g-computation for binary outcomes, and mixed-family models.
Counterfactuals: From Population to Individual
Interventions tell us what happens on average when we force a change. Counterfactuals answer a different question: what would have happened to this specific person under different circumstances?
Mediation Analysis
Estimate direct and indirect effects through mediators — from a single pathway to correlated parallel mediators and latent variables with sparse measurements.
Moderation (Effect Modification)
Model treatment effect heterogeneity using interaction terms — the effect of X on Y depends on context Z.
Causal Identification
Check adjustment sets, detect collider bias, and verify identifiability from the DAG — including the birth-weight paradox and the front-door criterion for unmeasured confounding.
Falsifying a Whole DAG
Grade an entire DAG against a permuted-baseline test: does it break its conditional-independence promises, and is it even informative enough to be falsified?
Testing Your DAG Against Data
Enumerate implied conditional independences and test whether your structural assumptions hold before fitting.
Placebo Refutation
Swap the treatment for a permuted copy and re-fit: a sound pipeline must report no effect. When it reports one anyway, the estimate was never yours to keep.
Sensitivity to Unmeasured Confounding
How robust is your causal estimate? Quantify how strong an unmeasured confounder would need to be to overturn your conclusion.
The House: Which Nodes Must You Adjust For?
A LinkedIn causal-inference puzzle worked end to end in pathmc — read the unique valid adjustment set straight off the DAG, then confirm that adjusting for a confounder helps while adjusting for sinks of the mediator or the outcome wrecks the estimate.
Difference-in-Differences
Estimate treatment effects by comparing changes over time between treated and control groups using panel mode.
Panel Data Models
From cross-sectional snapshots to temporal dynamics — compare cross-sectional and panel DAGs, model AR(1) persistence with lag(Y), and run time-forward interventions with adstock transforms.
Dynamic Pricing Across Regions
Estimate true price elasticity from observational data, accounting for confounding and regional heterogeneity.
Media Mix Models
Build MMMs of increasing complexity: adstock and saturation transforms, marketing funnel mediation, and hierarchical geo-varying effects.
MMM with Latent Brand Awareness
Model brand awareness as a latent AR(1) mediator — first deterministic, then constrained by sparse brand-tracking surveys.
SaaS Conversion Funnel
Model a multi-stage conversion funnel as a causal chain to find which stage has the highest leverage on paid conversion.
Vaccine Efficacy and Surrogate Endpoints
Assess whether a biomarker is a valid surrogate endpoint for clinical outcomes using mediation analysis.
Interventional Contrasts
Draw-wise contrasts (diff, ratio, lift) vs conditional covariates, unit-level distributions, and agreement with ate() on a Bernoulli outcome.
Conditional Predictions
Response-scale predictions on a covariate grid with posterior HDI bands, associational vs interventional queries, and structural vs adjustment estimators.
Local Slopes on the Response Scale
Finite-difference slopes on the probability scale for a Bernoulli GLM with interaction, dydx vs eyex, and the adjustment-covariate warning.