Skip to content

SelinaSong0412/MOGTree

Repository files navigation

MOGTree

MOGTree

MOGTree implements the multi-objective gain tree (MOG-Tree) workflow for learning patient subgroups with distinct treatment-outcome contrast profiles. The package centers on four core steps:

  1. fit a tree partition with DTRtree();
  2. assign new subjects to terminal nodes with predict_leaf.DTR();
  3. estimate propensity scores with M.propen() and outcome regressions with Reg.mu();
  4. summarize leaf-specific treatment preferences across a grid of outcome weights with mus.AIPW().

The current implementation matches the functions used in the repository’s simulation studies. In particular, the tree fit returns the subgroup structure, and the weight-specific treatment summaries are built from the AIPW estimates.

Installation

# install.packages("remotes")
remotes::install_github("SelinaSong0412/MOGTree")

For local development from the repository root:

devtools::install(".")

Minimal workflow

library(MOGTree)

set.seed(1)
n <- 120
X1 <- rnorm(n)
X2 <- rnorm(n)
H <- data.frame(X1 = X1, X2 = X2)
A <- sample(1:4, n, replace = TRUE)

group <- ifelse(X1 <= 0, 1, 2)
base_y1 <- rbind(
  c(1.2, 0.4, -0.1, -0.4),
  c(-0.2, 0.3, 0.8, 1.1)
)
base_y2 <- rbind(
  c(0.1, 0.7, 1.0, 0.6),
  c(1.1, 0.8, 0.2, -0.1)
)

Y1_cf <- matrix(NA_real_, n, 4)
Y2_cf <- matrix(NA_real_, n, 4)
for (i in seq_len(n)) {
  Y1_cf[i, ] <- base_y1[group[i], ] + 0.2 * X2[i] + rnorm(4, sd = 0.15)
  Y2_cf[i, ] <- base_y2[group[i], ] - 0.1 * X2[i] + rnorm(4, sd = 0.15)
}

Y1_obs <- Y1_cf[cbind(seq_len(n), A)]
Y2_obs <- Y2_cf[cbind(seq_len(n), A)]

w <- seq(0, 1, by = 0.25)
tree_fit <- DTRtree(
  Ys = cbind(Y1_obs, Y2_obs),
  A = A,
  H = H,
  depth = 2,
  minsplit = 15,
  w_vec = cbind(w, 1 - w),
  weight_combine = "mean",
  lambda = 0.01
)

leaf_id <- predict_leaf.DTR(tree_fit, H)
table(leaf_id)

pi_hat <- M.propen(A, H)
mu1_reg <- Reg.mu(Y1_obs, A, H)$mus.reg
mu2_reg <- Reg.mu(Y2_obs, A, H)$mus.reg
mu1_hat <- mus.AIPW(Y1_obs, A, pi_hat, mu1_reg)
mu2_hat <- mus.AIPW(Y2_obs, A, pi_hat, mu2_reg)

one_leaf <- sort(unique(leaf_id))[1]
idx <- leaf_id == one_leaf

sapply(w, function(weight) {
  weighted_mean <- colMeans(weight * mu1_hat[idx, ] + (1 - weight) * mu2_hat[idx, ])
  which.max(weighted_mean)
})
tree_fit

Main functions

  • DTRtree() builds the MOG-Tree partition using a weight-aggregated gain criterion.
  • predict_leaf.DTR() maps new covariate profiles to terminal nodes.
  • M.propen() estimates multinomial propensity scores.
  • Reg.mu() estimates treatment-specific outcome regressions.
  • mus.AIPW() combines the propensity and regression models into an augmented inverse probability weighted estimator.

Learn more

The package vignette walks through the same workflow with a small reproducible example:

  • vignette("example", package = "MOGTree")

About

Fits multi-objective gain trees (MOG-Trees) that partition patients into subgroups with distinct treatment-outcome contrast profiles (TOCP).

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages