Standardized Proximal Effect Size in MRTAnalysis

knitr::opts_chunk$set(
  collapse = TRUE,
  comment  = "#>"
)
library(MRTAnalysis)

Introduction

This vignette introduces the standardized proximal effect size estimator for continuous proximal outcomes implemented in calculate_mrt_effect_size(). The method generalizes the standardized effect size in @luers2019standardized by allowing adjustment for baseline and time-varying covariates to improve efficiency. The goal is to estimate the time-varying proximal causal excursion effect on a standardized scale, and optionally smooth the estimate over decision points.

Data Structure

The input data are in long format, with one row per participant-by-decision point. The data set must include:

Optional time-varying covariates can be included and specified through the covariates argument.

Example Data

We use the built-in example data data_example_for_standardized_effect to illustrate usage.

Load the example MRT dataset

data("data_example_for_standardized_effect")
dat <- data_example_for_standardized_effect
head(dat)

Estimate the Standardized Effect

We estimate the effect with a modest number of bootstrap replications (100) for speed. For stable confidence intervals, use at least 1000 replications. By default, the function applies LOESS smoothing over decision points; you can disable this by setting smooth = FALSE, or tune the smoother via loess_span and loess_degree.

ans_ci <- calculate_mrt_effect_size(
  data         = dat,
  id           = "id",
  outcome      = "outcome",
  treatment    = "treatment",
  time         = "decision_point",
  rand_prob    = "prob_treatment",
  availability = "availability",
  covariates   = "covariate1",
  do_bootstrap = TRUE,
  boot_replications = 100
)

head(ans_ci)

The returned object is a data frame with:

A simple numerical summary:

summary(ans_ci)

Optional: Increase Bootstrap Replications

To improve CI stability, increase the number of bootstrap replications. For example:

ans_ci <- calculate_mrt_effect_size(
  data         = dat,
  id           = "id",
  outcome      = "outcome",
  treatment    = "treatment",
  time         = "decision_point",
  rand_prob    = "prob_treatment",
  availability = "availability",
  covariates   = "covariate1",
  do_bootstrap = TRUE,
  boot_replications = 1000
)

Plot the Estimated Effect

The plot below shows the standardized effect estimate with bootstrap confidence bounds.

plot(ans_ci)


Try the MRTAnalysis package in your browser

Any scripts or data that you put into this service are public.

MRTAnalysis documentation built on Jan. 24, 2026, 5:07 p.m.