Causal mediation analysis
in high dimensions

Estimation and inference for direct and indirect effects with high-dimensional covariates and mediators.

Shi Bo
AmirEmad Ghassami
Debarghya Mukherjee

Department of Mathematics and Statistics
Boston University

TREATMENT → MEDIATOR → OUTCOME

Causal mediation analysis: treatment, mediator and outcomeTreatment A affects outcome Y directly and indirectly through mediator M. Baseline covariates X may affect A, M and Y. X · baseline covariates Indirect Direct ATreatment MMediator YOutcome
Direct and indirect treatment effects, with baseline covariates X.
Effect definitions
DIMELinear Factor ModelNon-linear Factor Model

SOFTWARE DEMONSTRATION

Mediation Workbench

Load a simulation or your own CSV. Assign the variables, describe your measurements, and run an analysis with uncertainty and parameter sensitivity.

Open live application
Factor exampleRECORDED WORKFLOW
All video instructions
  1. Click Load example in the Factor card.

  2. Click Bulk assignment to review the suggested column groups.

  3. Keep the suggested roles and click Confirm variables.

  4. This example has complete data. Review overlap, then click Continue to analysis path.

  5. Select Noisy measurements for this latent-factor example.

  6. Click Linear factor. The app checks the dimensions of X and M.

  7. Click Continue to settings.

  8. Keep the 50% threshold. Click Variance & scree plot to inspect the selected factors.

  9. Click the same heading to collapse the diagnostic.

  10. Click the Bootstrap switch. Keep 20 completed refits for this short demonstration.

  11. Click Sensitivity to latent dimensions to choose a comparison grid.

  12. Click the mediator To field and enter 2: the M grid is 1–2.

  13. Click the covariate From field and enter 2: the X grid is 2–3.

  14. Check 20 bootstrap refits and four grid combinations, then click Run analysis.

  15. 20 bootstrap refits and all four sensitivity combinations completed.

  16. Read the estimates and 95% bootstrap intervals. Download CSV exports these values.

  17. Click NDE to compare the direct effect across factor dimensions.

  18. Click View NDE grid values to expand the estimates behind the heatmap.

LOCAL INSTALLATION

Local installation with an AI assistant

Give the extracted kit to an AI assistant with access to your computer’s files and terminal. It can check your environment, install the dependencies, verify the R package and run the demo.

Download AI setup kit ↓
  1. 01Download & extract

    One kit includes the application, R package, example data, video and setup skill.

  2. 02Give it to your AI

    Open START-HERE.md and copy its request into a local coding assistant, such as Claude Code or Codex, with access to your files and terminal.

  3. 03Run & verify

    The checks run an R example and a real Factor analysis with bootstrap and sensitivity.

Run the workbench on your own computerDownload, install and follow the illustrated walkthrough.

Download the complete workbench, install its dependencies once, and run analyses on your own computer. The download includes the browser interface, R analysis source, Python support and all five simulation datasets.

Windows walkthroughR + PythonFive included datasets
  1. Download and extract the workbench

    Save UHDmedi-local-workbench.zip, right-click the ZIP and choose Extract All. Open the extracted UHDmedi-local-workbench folder. Keep its files together; run the launchers from this folder, outside the ZIP.

    1-Setup.cmdInstall dependencies once
    2-Start-Workbench.cmdStart the workbench whenever you need it
    app/Website, analysis code and example CSVs
    Local-user-guide.htmlThis illustrated guide, available offline
    docs/workbench-demo.mp4The video walkthrough, available offline
  2. Install R and Python

    You need a 64-bit installation of R for Windows and Python 3.11 or 3.12. If both are already installed, continue to the next step. For a new Python installation, enable Add python.exe to PATH. RStudio is optional.

    The setup step needs an internet connection to download R packages and the Python libraries used by MediEncoder. It creates a project-specific environment inside the extracted folder.

  3. Run the one-time setup

    Double-click 1-Setup.cmd and keep the setup window open until it finishes. This installs dependencies for Sparsity, Linear factor, MediEncoder and missing-data handling, and attempts to install the optional multiply robust method.

    Read the final dependency check before closing the window. If the optional multiply robust dependencies are unavailable, the three main methods can still be used when their checks pass. The interface shows which methods are ready.

    Only once per extracted copy. You do not need to repeat setup each time you open the app.
  4. Start your local website

    Double-click 2-Start-Workbench.cmd. Leave its window open while using the workbench. Open http://127.0.0.1:8765/ in your browser if it does not open automatically. The sidebar should report Local R service connected. On the first launch, dependency checks can take a minute; wait for this status before running an analysis.

    Closing the server window stops the local website. Start it again with the same launcher next time. Opening index.html alone displays the interface without starting the analysis service.

    The extracted local workbench, connected to its local R service. Choose the Factor example to begin.
    The extracted local workbench, connected to its local R service. Choose the Factor example to begin.
  5. Follow the Factor example

    This is the same synthetic example used in the video: 300 observations, 400 X measurements and 500 M measurements.

    Data → Variables

    In the Factor card, click Load example. Roles are filled for you: outcome is Y, treatment is A, x_measure_* are X and m_measure_* are M. Leave sample_id ignored. Confirm that control is 0 and treated is 1, then click Confirm variables.

    Preprocessing → Analysis path

    The example is complete, so keep Keep data unchanged. Review the treatment-assignment overlap plot, then click Continue to analysis path. Under What do you observe?, choose Noisy measurements, followed by Linear factor. Click Continue to settings.

    Confirm the outcome, treatment, covariates and mediators before continuing.
    Confirm the outcome, treatment, covariates and mediators before continuing.

    Settings & run

    Keep Cumulative explained variance at 50% and Center and standardize. The example selects two factors for X and two for M. Expand Variance & scree plot to inspect the choice.

    Turn on Bootstrap Uncertainty and set Completed bootstrap replicates to 20 for this walkthrough. To include the video’s four-cell sensitivity grid, turn on Sensitivity to latent dimensions and use the ranges below.

    Small dimension grid for the tutorial
    SettingFromToStep
    Mediator dimensions121
    Covariate dimensions231

    The grid refits four dimension pairs; your primary estimate still uses the two factor counts selected above. Click Run analysis and wait for Completed R analysis.

    The Factor example at the 50% cumulative-variance threshold selects two dimensions for each block.
    The Factor example at the 50% cumulative-variance threshold selects two dimensions for each block.
    A quick demonstration. Twenty bootstrap refits exercise the workflow. Use a larger target for final uncertainty analysis. Runtime depends on your computer and the settings; the video shortens the waiting time.
  6. Read and save your results

    NIE is the natural indirect effect, NDE is the natural direct effect and TE is the total effect. Read their estimates and confidence intervals together. An interval containing zero does not establish that the effect is exactly zero.

    In the sensitivity panel, switch among NIE, NDE and TE to see how the point estimates change with the dimension pair. This checks sensitivity to tuning choices, not to unmeasured confounding.

    Choose Download CSV for the effect table and Download analysis record for the run configuration, results and diagnostics. Save them before starting a new session. If you change the inputs or settings, rerun the analysis to obtain results for the new configuration.

    A completed run reports indirect, direct and total effects with the selected uncertainty estimates.
    A completed run reports indirect, direct and total effects with the selected uncertainty estimates.

Try another example

Choose the interpretation that matches how the data were generated
ExampleYour answerAnalysis path
SparsityObserved covariates and mediatorsSparsity; regularization applies to coefficients of X and M.
FactorNoisy measurementsChoose Linear factor or MediEncoder.
Low-dimensionalObserved covariates and mediatorsMultiply robust, when its optional dependencies are installed.
Sparsity · low-dimensional XObserved covariates and mediatorsSparsity; coefficients of X remain unpenalized.
Factor · low-dimensional XNoisy measurementsX remains observed; only M receives a factor representation.

The last three examples are under More simulation datasets. For Sparsity, enable Sensitivity to balancing constants K₁ and K₂ to obtain a data-checked recommended range automatically. Adjust the two range bars if needed; the grid can contain at most 81 combinations per run. For factor methods, the variance slider offers 10%, 15%, …, 95%, 99%, and Eigenvalue ratio is an alternative dimension-selection rule.

Use your own CSV

Keep one observation per row and unique column names. Choose Choose CSV file, then assign one numeric Y, one binary A, numeric mediator columns M and baseline covariates X. X may contain categorical variables; the analysis service encodes them. Ignore identifiers and unrelated columns. Use Bulk assignment when there are many columns, and check the control/treated labels.

Choose a missing-data approach before continuing. Complete observations removes affected rows; mean/mode or median/mode fills them once; MICE multiple imputation creates several datasets and pools results. Simple imputation does not account for missing-value uncertainty. MICE with the factor methods requires bootstrap uncertainty.

Answer the measurement question based on your study. For observed variables, the app checks dimensions and routes to Sparsity or the multiply robust estimator. For noisy measurements, you choose Linear factor or MediEncoder. Low-dimensional X is retained directly. The treatment-overlap diagnostic is a useful data check; causal interpretation still requires the identification assumptions described in the papers.

If something does not open

The browser cannot reach the local page
Check that the start window is still open, and read its message. If port 8765 is already in use, close your previous workbench window or follow the launcher’s instructions.
A method is unavailable
Review the setup dependency check. Install the missing dependency, then restart the workbench. The local page does not substitute another estimator silently.
The Run button is disabled
Read the message beside the button. Confirm variable roles, complete the measurement question and correct any out-of-range setting or oversized sensitivity grid.
An analysis does not complete
Read its status and download the available diagnostic record. Adjust settings only when the message explains what needs to change; an incomplete computation is not a completed estimate.

The first image shows the extracted workbench running locally. The remaining images are from the recorded demonstration and use the same workflow and controls. Guide prepared October 4, 2026.

Run in your browser. The live application sends analysis data to the hosted R/Python service. Start with a simulation to explore the workflow.

Choose the scientific model. Users describe what their variables represent. The app checks dimensions; it cannot determine the causal assumptions from the data.

RESEARCH OVERVIEW

Research overview

Causal mediation analysis studies how a treatment affects an outcome through intermediate variables. In high-dimensional data, those variables may be directly observed, or they may be latent processes measured through many noisy surrogates. This collection develops three approaches for these settings: sparse regression with multi-step debiasing, linear factor projections, and nonlinear representation learning. Each approach connects a structural model to estimation of a mediation functional and to statistical inference under explicit assumptions. The papers develop the theory, examine finite-sample behavior in simulations, and apply the methods to genomic studies of smoking, depression, and health outcomes. Mediation Workbench brings the analysis workflow into a browser, with examples, variable mapping, uncertainty estimates, and parameter sensitivity.

01 / METHODS

Methods and measurement models

The methods target the same type of mediation functional under different measurement models. They differ in how they represent high-dimensional covariates and mediators.

01

DIRECTLY OBSERVED VARIABLES

DIME

Debiased causal analysis with Interactions for Mediation Estimation in ultra-high dimensions

Many measured variables, with a sparse structure in the regression coefficients.

Regularization and debiasing
02

NOISY MEASUREMENTS · LINEAR

FARMA

Noisy measurements represent latent mediators, with observed or latent covariates.

Factor-based representations
03

NOISY MEASUREMENTS · NONLINEAR

MediEncoder

Nonlinear encoder-decoder models for latent covariate and mediator representations.

Learned latent representations
Comparison of modeling assumptions and estimation strategies
Modeling choiceDIMEFARMAMediEncoder
What is measured?Covariates and mediators directlyNoisy surrogates of latent variablesNoisy surrogates of latent variables
How is dimension handled?Sparse regression coefficientsLinear factor projectionsLearned nonlinear representations
Estimation strategyBalancing and multi-step debiasingFactor projection and cross-fitted regressionCoupled encoders and cross-fitted influence functions
Shared targetA mediation functional, with contrasts yielding natural direct and indirect effects
IN THE WORKBENCH

For observed variables, the app routes to Sparsity when dim(X) + dim(M) > n, and to a low-dimensional multiply robust method otherwise. Low-dimensional X stays unpenalized in Sparsity and observed in the factor methods. These dimension checks do not determine whether your measurements are noisy or validate the modeling assumptions.

02 / CAUSAL MEDIATION

Causal effects and identification

A treatment can change an outcome directly, or indirectly through a mediator. Causal mediation analysis separates these pathways to study how an effect arises.

Identification assumptions

Model and causal target

Select a method to view its structural equations.

FOLLOW THE PATHWAY

Causal mediation analysis: treatment, mediator and outcomeTreatment A affects outcome Y directly and indirectly through mediator M. Baseline covariates X may affect A, M and Y. X · baseline covariates Indirect Direct ATreatment MMediator YOutcome

The total effect combines the direct effect and the effect transmitted through the mediator.

Effects

θ(a,a′)=𝔼[Y(a,M(a′))]

θ(a, a′) is a mean potential outcome. The effects below compare these means.

Select an effect to highlight its formula and pathway.

Notation and identification

Y(a,m) is the outcome under treatment a and mediator value m; M(a′) is the mediator under treatment a′. The mediator of interest is observed in the sparse model and latent in the surrogate models.

Identification requires consistency, treatment and mediator positivity, and the paper’s sequential-exchangeability and cross-world conditions. The factor and representation models also require informative measurements. Cross-fitting separates model fitting from effect evaluation. DIME distinguishes its sample-average target from the population target shown here, whose variance has an additional contribution.

A familiar example. An intervention may improve health partly by changing a biological process. Mediation asks how much of its effect operates through that process.

The high-dimensional challenge. We may observe many candidate mediators, or noisy measurements of a smaller latent system. Different measurement structures call for different methods.

03 / ESTIMATION

Estimation procedures

The procedures below summarize the estimation steps in each manuscript.

Sparse regression, balancing, and debiasing

With many measured covariates and mediators, regularization stabilizes fitting but can introduce bias. The sparse method combines regression with balancing and multi-step correction.

DIME · Figure 1 · Regression, balancing, multi-step debiasing and cross-fitting.

04 / SIMULATIONS

Simulation results

Each tab reports a simulation setting from one paper, including RMSE, interval coverage, and distributional diagnostics where available.

DIME: RMSE and interval coverage

The debiased estimator has lower RMSE than the plug-in estimator at four of the five reported sample sizes in this setting. At n = 250, the plug-in estimator has lower RMSE. The full curve shows both regimes.

p + q = 1,500Noise variance = 1500 replications
DIME simulation: RMSE across sample sizes
Lower RMSE is better. DIME · Table 1 · manuscript p. 21.
View the reported values
Sample size nDebiased RMSEPlug-in RMSE95% coverage¹
2500.44500.245090.8%
5000.17500.372098.0%
7500.16800.321095.0%
1,0000.09700.280098.4%
1,2500.10400.248095.2%

¹ Coverage for DIME; the analytical interval reported in the paper.

Sampling distributions and normal Q–Q diagnostic

A separate low-noise setting makes the regularization bias visible. These distributions use the original 500 simulation draws for n = 750 and p + q = 1,500, with noise scale 0.1. The target is the fixed covariate-conditional mediation functional.

Histogram of scaled estimation errors for the debiased and naive estimators
The histogram compares √n(θ̂ − θ), centered on the same target. Zero marks no estimation error.
Normal Q-Q diagnostic of the debiased estimator from the original simulation
The Q–Q plot compares normal quantiles with the debiased estimator’s scaled errors. Its slope reflects scale; these errors are not divided by their standard errors.
+0.0040Mean bias · debiased
−0.7529Mean bias · naive
500Original simulation draws

The papers use different data-generating processes and effect scales. Absolute RMSE values should be compared within a panel, rather than across the three papers.

05 / APPLICATIONS

Real-data applications

The papers examine mediation in two genomic studies. The variable roles and the interpretation of the mediator differ across the analyses.

TCGA · LUNG CANCER

Smoking, methylation,
and survival.

The sparse analysis treats methylation measurements as directly observed mediators. The outcome is log survival time in days.

738subjects
42covariates
264,797mediators
Smoking statusDNA methylationLog survival
TCGA natural direct, indirect, and total effects with bootstrap 95 percent confidence intervals
DIME · log-survival scale · bootstrap 95% confidence intervals.

The reported indirect-effect interval is below zero, while the direct-effect interval includes zero. These estimates concern the joint methylation pathway under the study’s assumptions.

ADNI · COGNITIVE IMPAIRMENT

Depressive symptoms,
latent pathways, and cognition.

The factor analyses treat methylation as noisy measurements of latent mediators. The outcome is the original ADAS-Cog score.

649subjects
171X measurements
3,206M measurements
Depressive symptomsLatent mediator processesADAS-Cog
ADNI estimates from FARMA and MediEncoder with bootstrap 95 percent confidence intervals
FARMA and MediEncoder · ADAS-Cog scale · bootstrap 95% confidence intervals.

Both reported analyses have positive direct-effect estimates with intervals excluding zero. Their indirect-effect intervals include zero; the results do not establish a nonzero mediated effect in this application.

These are observational analyses under different structural models. Confidence intervals describe statistical uncertainty conditional on those assumptions; they do not by themselves establish a biological mechanism.

06 / PAPERS & CODE

Papers and code

Manuscripts and research implementations for DIME, FARMA, and MediEncoder.

01DIME

Debiased Causal Mediation Analysis in Ultra-High-Dimensional Settings in the Presence of Interaction Effects

Shi Bo · AmirEmad Ghassami · Debarghya Mukherjee

Estimate mediation effects when covariates and mediators are directly observed but their dimensions can exceed the sample size. Sparse regressions, balancing weights, and multi-step debiasing accommodate treatment interactions while supporting inference.

Cite this paper
BibTeX
@article{sparsity2024,
  title = {Debiased Causal Mediation Analysis in Ultra-High-Dimensional Settings in the Presence of Interaction Effects},
  author = {Bo, Shi and Ghassami, AmirEmad and Mukherjee, Debarghya},
  journal = {arXiv preprint arXiv:2412.08827},
  year = {2024},
  url = {https://arxiv.org/abs/2412.08827}
}
02FARMA

Causal Mediation Analysis with High-Dimensional Surrogates: Identification, Estimation and Inference under Latent Factor Models

Himani Yadav · Shi Bo · AmirEmad Ghassami · Debarghya Mukherjee

Study mediation when the variables of interest are latent and observed only through many noisy surrogates. FARMA uses linear factor projections and cross-fitted regressions to estimate the mediation functional, with an identification approximation that improves as surrogate dimensions grow.

Cite this paper
BibTeX
@article{farma2026,
  title = {Causal Mediation Analysis with High-Dimensional Surrogates: Identification, Estimation and Inference under Latent Factor Models},
  author = {Yadav, Himani and Bo, Shi and Ghassami, AmirEmad and Mukherjee, Debarghya},
  journal = {arXiv preprint arXiv:2611.03167},
  year = {2026},
  url = {https://arxiv.org/abs/2611.03167}
}
03MediEncoder

MediEncoder: Nonlinear Representation Learning for High-Dimensional Causal Mediation Analysis

Shi Bo · Debarghya Mukherjee · AmirEmad Ghassami

Learn nonlinear covariate and mediator representations jointly from high-dimensional measurements. A coupled encoder-decoder architecture links treatment and covariate representations to the mediator representation, followed by cross-fitted influence-function estimation.

Cite this paper
BibTeX
@article{mediencoder2026,
  title = {{MediEncoder}: Nonlinear Representation Learning for High-Dimensional Causal Mediation Analysis},
  author = {Bo, Shi and Mukherjee, Debarghya and Ghassami, AmirEmad},
  journal = {arXiv preprint arXiv:2606.30648},
  year = {2026},
  url = {https://arxiv.org/abs/2606.30648}
}
Download all citations