About this code

The MRTAnalysis R package provides functions to analyze micro-randomized trials. It supports:

  • Primary analyses for proximal outcomes.
  • New functionality to estimate distal (end-of-study) effects.
  • Experimental functionality for mediated distal effects (under review).

Version 0.3.0 (September 9, 2025) adds distal excursion effect modeling and a research implementation for mediated distal effects.

How can a behavioral scientist use this code?

Researchers can use MRTAnalysis to:

  • Estimate marginal and moderated causal excursion effects on proximal outcomes (continuous or binary).
  • Estimate distal causal excursion effects (DCEE)—how micro-randomized interventions delivered at different study times impact an end-of-study outcome.
    • Example: In HeartSteps V1, activity suggestions early in the study had stronger effects on end-of-study activity than later ones.
  • (Research/preview) Explore mediated causal excursion effects (MCEE) to separate long-term effects into direct and indirect (via short-term behavior) pathways.

What method does this code implement?

  • Proximal (immediate) effects
    • Continuous outcomes: Weighted, Centered Least Squares (wcls()) (Boruvka et al. (2018) doi:10.1080/01621459.2017.1305274)
    • Binary outcomes: Estimator for Marginal Excursion Effect (emee(), emee2()). (Qian et al. (2021) doi:10.1093/biomet/asaa070)
  • Distal (end-of-study) effects
    • Distal Causal Excursion Effect: dcee() implements a two-stage estimator (supports parametric or ML learners, with optional cross-fitting).
    • See the vignette Continuous Distal Outcomes for worked examples.
  • Mediated distal effects (under review)
    • MCEE: mcee() estimates natural direct and indirect excursion effects for continuous distal outcomes.
    • This is a research feature; the paper is currently under review.

Note: MRTAnalysis now supports proximal and distal effects. It still does not implement “lagged/delayed proximal” effects as a separate estimand class.

Availability and installation

Install the current CRAN release (≥ v0.3.0) with:
install.packages(“MRTAnalysis”)
Package docs and vignettes include examples for wcls(), emee(), dcee(), and mcee(). The development source is on GitHub.

Related References

DCEE (distal effects):

Qian, T. Distal Causal Excursion Effects: Modeling Long-Term Effects of Time-Varying Treatments in MRTs. (Accepted at Biometrics; preprint on arXiv).

MCEE (mediation; under review):

Qian, T. Dynamic Causal Mediation Analysis for Intensive Longitudinal Data. arXiv:2506.20027.

A review paper for MRT which illustrates the primary analysis methods for MRT with continuous proximal outcome:

Qian, Tianchen, Ashley E. Walton, Linda M. Collins, Predrag Klasnja, Stephanie T. Lanza, Inbal Nahum-Shani, Mashfiqui Rabbi et al. “The microrandomized trial for developing digital interventions: Experimental design and data analysis considerations.” Psychological methods (2022).

The original paper that describes the WCLS method for continuous outcome:

Boruvka, Audrey, Daniel Almirall, Katie Witkiewitz, and Susan A. Murphy. “Assessing time-varying causal effect moderation in mobile health.” Journal of the American Statistical Association 113, no. 523 (2018): 1112-1121.

The original paper that describes the EMEE method for binary outcome:

Qian, Tianchen, Hyesun Yoo, Predrag Klasnja, Daniel Almirall, and Susan A. Murphy. “Estimating time-varying causal excursion effects in mobile health with binary outcomes.” Biometrika 108, no. 3 (2021): 507-527.

Sorry, no content found.

Join the d3center Mailing List

Keep up to date with the latest news, events, software releases, learning modules, and resources from the d3center.