Dynamic treatment regimes

Modified

June 26, 2024

Recall that interventions where the output of the function depends only on covariates are referred to as dynamic interventions or dynamic treatment regimes. Let’s learn how to estimate the effects of dynamic treatment regimes using lmtp.

Simulated BMI Data

A dataset named bmi has been loaded into R in the background.


  • The data, from the DynTxRegime package, are simulated to reflect a two-stage RCT (\(A\) = {A1, A2}) that studied the effect of meal replacement (MR) shakes versus a calorie deficit (CD) diet on adolescent obesity.

  • Baseline variables include gender, race, and parent BMI.

  • Time-varying covariates include BMI collected at stage 1 (baselineBMI) and stage 2 (month4BMI). The primary outcome is BMI at 12 months (month12BMI).

  • There is no censoring.

Characteristic Stage 1, CD Stage 1, MR
Stage 2, CD1 Stage 2, MR1 Stage 2, CD1 Stage 2, MR1
gender 24 (46%) 32 (56%) 34 (64%) 20 (42%)
race 23 (44%) 41 (72%) 24 (45%) 27 (56%)
parentBMI 32.9 (28.9, 38.3) 32.9 (29.5, 36.4) 32.6 (29.2, 40.4) 30.9 (28.7, 35.3)
baselineBMI 37.9 (35.8, 41.0) 37.3 (35.4, 42.4) 37.1 (34.7, 39.3) 36.6 (35.1, 39.0)
month4BMI 35.5 (33.3, 37.4) 34.9 (32.0, 38.5) 36.1 (32.2, 39.3) 34.9 (31.5, 37.7)
month12BMI 35.6 (33.3, 37.5) 34.9 (32.1, 38.5) 36.2 (32.1, 39.3) 35.0 (31.5, 37.7)
1 n (%); Median (IQR)

Problem 1

Write a shift function that assigns meal replacement to all observations at time 1, but only meal replacement at time 2 to those observations whose 4-month BMI is greater than 30.

\[ \dd_t(a_t, h_t, \epsilon_t) = \begin{cases} \text{Meal replacement} &\text{ if } t = 1 \\ \text{Meal replacement} &\text{ if } t = 2 \text{ and } \text{4-month BMI} > 30 \\ \text{Calorie deficit} &\text{ otherwise.} \end{cases} \]

Practice

Solution

d_dtr <- function(data, trt) {
  if (trt == "A1") return(rep("MR", nrow(data)))
  
  ifelse(data$month4BMI > 30, "MR", "CD")
}

Let’s estimate the effect of the dynamic treatment regime on the 12-month BMI using lmtp with the SDR estimator.

Problem 2

Suppose we are interested in comparing the dynamic treatment regime to a static treatment regime where all patients receive meal replacement at both time points. Using the SDR estimator, estimate the effect of this static intervention.

Practice

Solution

fit_MR <- lmtp_sdr(
  data = bmi, 
  trt = c("A1", "A2"), 
  outcome = "month12BMI", 
  baseline = c("gender", "race", "parentBMI"), 
  time_vary = list("baselineBMI", "month4BMI"),
  shift = \(data, trt) rep("MR", nrow(data)), 
  outcome_type = "continuous",
  folds = 1,
  learners_trt = "SL.glm", 
  learners_outcome = c("SL.mean", "SL.glm", "SL.gam")
)

Let’s also estimate the effect of an intervention where all patients receive a calorie deficit diet at both time points.

Finally, let’s compare the dynamic treatment regime and the always receive meal replacement intervention to the always receive a calorie deficit intervention.

References

Dı́az, Iván, Nicholas Williams, Katherine L Hoffman, and Edward J Schenck. 2023. “Nonparametric Causal Effects Based on Longitudinal Modified Treatment Policies.” Journal of the American Statistical Association 118 (542): 846–57.
Hoffman, Katherine L., Diego Salazar-Barreto, Nicholas Williams, Kara E. Rudolph, and Ivan Diaz. 2024. “Studying Continuous, Time-Varying, and/or Complex Exposures Using Longitudinal Modified Treatment Policies.” https://arxiv.org/abs/2304.09460.
Holloway, S. T., E. B. Laber, K. A. Linn, B. Zhang, M. Davidian, and A. A. Tsiatis. 2023. DynTxRegime: Methods for Estimating Optimal Dynamic Treatment Regimes. https://CRAN.R-project.org/package=DynTxRegime.