Author: Xinyi Song (songx12@uci.edu), John Dziak (dziakj1@gmail.com), Tianchen Qian (t.qian@uci.edu)
Date: 2026-01-24

# Standardized Proximal Effect Size in MRTAnalysis

#### Xinyi Song (songx12@uci.edu), John Dziak (dziakj1@gmail.com), Tianchen Qian (t.qian@uci.edu)

#### 2026-01-24

# 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 Luers and others (2019) 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:

- a participant id,
- a continuous proximal outcome,
- a treatment indicator (binary),
- a decision point index,
- a randomization probability,
- and an availability indicator.

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)
    #>     id decision_point availability prob_treatment treatment covariate1
    #> 1 1001              1            0         0.0000         0    0.62076
    #> 2 1001              2            1         0.4997         0   -0.07169
    #> 3 1001              3            0         0.0000         0    0.47687
    #> 4 1001              4            0         0.0000         0   -0.49603
    #> 5 1001              5            1         0.3578         0   -0.71909
    #> 6 1001              6            0         0.0000         0   -1.03928
    #>   covariate2 treatment_effect sigma  outcome
    #> 1    0.03564          0.00000     1  1.09423
    #> 2    0.11610          0.04082     1  1.79715
    #> 3   -0.07892          0.08163     1  0.30206
    #> 4   -0.27361          0.12245     1  0.33421
    #> 5   -0.75106          0.16327     1 -0.09467
    #> 6    0.05537          0.20408     1  0.97451

## 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)
    #>   time beta_hat  s_hat beta_sm  s_sm estimate     lower  upper
    #> 1    1 -0.12483 1.1385 0.05883 1.090  0.05396 -0.218023 0.3026
    #> 2    2  0.19453 1.0019 0.10218 1.108  0.09226 -0.107800 0.2949
    #> 3    3  0.35603 1.1896 0.14478 1.123  0.12890 -0.046402 0.2888
    #> 4    4  0.08961 0.9933 0.18764 1.137  0.16505 -0.004002 0.2923
    #> 5    5  0.24938 1.2536 0.22957 1.148  0.19993  0.020610 0.3485
    #> 6    6  0.27749 1.2622 0.26572 1.160  0.22910  0.040336 0.3878

The returned object is a data frame with:

- `time` — decision point
- `beta_hat` — raw (unsmoothed) estimated excursion effect
- `s_hat` — raw (unsmoothed) estimated outcome scale
- `beta_sm` — smoothed excursion effect (equals `beta_hat` if `smooth = FALSE`)
- `s_sm` — smoothed outcome scale (equals `s_hat` if `smooth = FALSE`)
- `estimate` — standardized effect `beta_sm / s_sm`
- `lower`, `upper` — bootstrap confidence bounds (present when `do_bootstrap = TRUE`)

A simple numerical summary:

    summary(ans_ci)
    #>
    #> Call:
    #> 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)
    #>
    #> Participants: 100
    #> Decision points: 50
    #> Smoothing: LOESS (span = 0.25, degree = 1)
    #> Bootstrap: 100 replications; alpha = 0.05
    #>
    #> Standardized effect summary:
    #>     Mean Median     Min Time_at_Min   Max Time_at_Max
    #> 1 0.9037 0.9811 0.05396           1 1.489          45
    #>
    #> Bootstrap CI summary:
    #>   Mean CI Width Median CI Width Pct CI Excludes 0
    #> 1        0.3801          0.3659                92

## 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)

Luers, B., Klasnja, P. and Murphy, S. (2019). Standardized effect sizes for preventive mobile health interventions in micro-randomized trials. Prevention Science 20, 100–109.