AI & ML

Predictive Health Economics Modeling for Stage II OSCC

· 5 min read
Patient-Centric Health Economics: A Minimalist Modeling Approach

This article was originally published on R Works and shared via R-bloggers.

Most health economics models are engineered to serve the interests of payers—government healthcare systems or private insurers. While researchers like Ioannidis & Garber (2011) and Tai et al. (2016) have long advocated for a patient-centric perspective, few such models reach maturity. This gap is largely structural: data privacy barriers and a lack of clear financial incentives make it difficult to justify the resource-intensive work required to map individual patient trajectories.

In this post, I investigate whether we can bypass the need for massive, hyper-detailed data sets to achieve the primary goals of patient-focused modeling. I introduce a lightweight cohort model, designed as a minimum viable product (MVP), to help clinicians and patients visualize potential treatment pathways and outcomes. Using Stage II oral squamous cell carcinoma (OSCC) as a case study, I compare surgical intervention against definitive radiation therapy.

Disclaimer: This analysis is an educational proof of concept and not a formal medical advisory. No medical experts were consulted in its development. For technical execution, I utilized Posit Assistant within the RStudio IDE, powered by Claude Sonnet 4.6. While highly efficient for code generation, the assistant’s penchant for hallucinating references during literature searches served as a recurring reminder that LLMs are tools for augmentation, not authority.

The Modeling Framework

I conceptualize the recovery process for OSCC as a stochastic progression through distinct health states. By applying an eight-state, continuous-time Markov chain (CTMC), we treat the duration and sequence of a patient's journey as random variables. The model relies on transition probabilities and mean state-sojourn times derived from medical literature, though these parameters are easily tunable for clinicians who wish to reflect their own localized experience or patient observations.

The workflow follows a two-step process: first, we use the CTMC to generate a synthetic cohort of patients based on variables like age and tumor size. Second, we apply EQ-5D values to this synthetic data to estimate quality-adjusted life years (QALYs), providing a quantitative bridge between clinical state and patient experience.

CTMC State Transition Diagram for Stage II OSCC

The diagram above illustrates the eight health states defined for this model, ranging from initial treatment modalities to recurrence and the terminal absorbing state. By abstracting the clinical path into these categories, we can simulate the complex trade-offs inherent in choosing between surgical intervention and radiation, particularly for patients where surgery is not an option.

For those looking to build their own patient-facing models, the simulation is driven by two user-defined components: the jump chain probabilities (the likelihood of transitioning to a specific state upon leaving the current one) and the mean sojourn times (the average duration spent in a state). By externalizing these inputs in the code, the model remains modular, allowing users to override literature-derived defaults with clinical judgment as needed.

To establish a credible Continuous-Time Markov Chain (CTMC) generator, we define a transition probability matrix (jump_P) that mirrors current clinical literature. By applying these jump probabilities alongside patient-specific mean sojourn times, we derive the base generator matrix, Q_base, which dictates the rate of state transitions for the simulation.

Show underlying CTMC configuration
# Jump chain transitions derived from standard clinical benchmarks:
# Surgery (S1): 25% PORT (Tassone et al. 2023), 15% POCRT, 1.5% mortality (Nathan et al. 2025)
# Definitive RT (S2): 65% locoregional control (Studer et al. 2007)
# Surveillance (S3): 15.5% recurrence risk (Ord 2006)
# Salvage (S7): 43% OS success (Lee et al. 2024)

The model architecture relies on state-specific "dwell times" that reflect realistic clinical delays. For instance, the Post-Operative Surveillance state (S3) is set to a mean of 22 months, while the peri-operative mortality risk (S8) was adjusted downward to 1.5% to align with observed NSQIP data, correcting for earlier, overly aggressive estimates. Transitions are calculated as Q[i, j] = jump_P[i, j] / mean_sojourn[i], ensuring the rate of movement is mathematically grounded in observed clinical timelines.

Transition Probability Matrix

The matrix below defines the likelihood of shifting between clinical states, conditioned on the initial transition trigger:

       S3    S4    S5    S6    S7    S8
S1   0.585 0.250 0.150 0.000 0.000 0.015
S2   0.000 0.000 0.000 0.650 0.280 0.070
S3   0.000 0.000 0.000 0.740 0.180 0.080
S4   0.000 0.000 0.000 0.670 0.230 0.100
S5   0.000 0.000 0.000 0.600 0.300 0.100
S6   0.000 0.000 0.000 0.000 0.750 0.250
S7   0.000 0.000 0.000 0.430 0.000 0.570
Sojourn Constraints

Dwell times (in months) define the intensity of the process, with total rates representing the hazard of exiting a specific clinical state:

  • Surgery (S1): 1.5mo (0.667 rate)
  • Surveillance (S3): 22.0mo (0.045 rate)
  • NED (S6): 120.0mo (0.008 rate)

Synthetic Data Construction

Beyond baseline rates, the simulation introduces patient-level heterogeneity. The make_Q function applies exponential scaling factors to represent the influence of age and tumor size on recurrence and mortality outcomes. Specifically, the model assumes a 2.5% increase in mortality risk per year of age over 60, and an 18% increase in recurrence probability for every centimeter of tumor size beyond the 3cm baseline.

The following routine iterates through the patient population, generating longitudinal paths. Each trajectory uses sim_ctmc to determine state changes until reaching the terminal state (S8) or the defined study limit. To mimic real-world clinical documentation, observation times are jittered, creating a sparse longitudinal panel dataset.

View synthetic data generation logic
# Covariate adjustments in the generator:
# age_eff: exp(0.025 * (age_i - 60))
# size_eff: exp(0.180 * (tumor_size_i - 3.0))
# Resulting data saved to: OSCC_HE_Synthetic_Data.csv

The resulting dataset, oscc2_data, captures both state transitions and the associated patient covariates, providing a high-fidelity synthetic foundation for downstream survival analysis.

Cohort Composition

To establish a baseline for this simulation, we analyzed a dataset comprising 10,634 individual state transitions across 1,000 distinct patients. The distribution of patient status—ranging from initial surgical intervention to terminal events—is detailed below. Notably, mortality reached 37% within this synthetic population, with the data heavily weighted toward post-operative surveillance and status-free monitoring.

Code: Cohort State Summary
# Aggregate longitudinal state visits
trt_counts <- table(treatment)
died <- oscc2_data |>
dplyr::filter(state == 8) |>
dplyr::distinct(id) |>
nrow()
# Generate summary table
as.data.frame(table(State = oscc2_data$state_label)) |>
gt() |>
tab_options(table.font.size = px(12)) |>
cols_label(State = "State", Freq = "Observations") |>
tab_source_note(md(paste0(
"**Dataset:** ", nrow(oscc2_data), " observations; ",
N_PATIENTS, " patients"
))) |>
tab_source_note(md(paste0(
"**Treatment:** Surgery = ", trt_counts["Surgery"],
"; DefinitiveRT = ", trt_counts["DefinitiveRT"]
))) |>
tab_source_note(md(paste0(
"**Mortality:** ", died, " / ", N_PATIENTS,
" patients reached Death (",
round(100 * died / N_PATIENTS, 1), "%)"
)))
State Observations
AdjuvantChemoRT_POCRT228
AdjuvantRT_PORT333
Death370
DefinitiveRT570
LR_Recurrence767
NED4407
PostOpSurveillance2381
Surgery1578

Individual Patient Progression

The following snapshot illustrates the state-transition history for a single representative patient. The timeline demonstrates a clean progression from primary surgical intervention through surveillance phases, ultimately arriving at a status of No Evidence of Disease (NED).

Code: View patient ID 1 path
oscc2_data[oscc2_data$id == 1, c("id", "time", "state", "state_label", "treatment", "age", "tumor_size_cm", "DOI_mm")]

Comparative Survival Analysis

Outcome Curves

Kaplan-Meier survival estimates for our two treatment modalities indicate a performance gap, with the surgical arm demonstrating a superior five-year survival rate of roughly 73% compared to the 65% observed in the definitive radiotherapy cohort. While both groups maintain robust survival probabilities, these curves serve as a primary indicator of clinical trajectory divergence.

To test the validity of these synthetic outputs, we mapped three external clinical benchmarks onto our model. These markers function as anchor points rather than formal validations, yet they confirm the model’s trajectory sits within a clinically plausible range:

  • Siegel et al. (2024): Our surgery arm aligns with the ~77% absolute five-year OS derived from adjusting SEER relative survival data for age-related background mortality.
  • Hosni et al. (2019): We compared our three-year outcomes against their 71% (95% CI 67–75%) observation from the Princess Margaret Cancer Centre adjuvant PORT cohort.
  • Sher et al. (2011): The definitive RT curve was assessed against their reported 63% two-year OS finding for localized IMRT patients.
Kaplan-Meier visualization
# KM estimation logic
km_input <- oscc2_data |>
dplyr::group_by(id, treatment) |>
dplyr::summarise(time = max(time), event = as.integer(any(state == 8)), .groups = "drop")
km_fit_2arm <- survfit(Surv(time, event) ~ treatment, data = km_input)
# ... plotting logic using ggsurvplot ...

Data Dissection: The Limitations of Subgroup Analysis

Translating survival data into actionable clinical intelligence requires more than just plotting curves; it demands a sober assessment of statistical power. The provided R implementation uses ggplot2 and broom to stratify Stage II OSCC patients by age (split at 62) and tumor size (split at 3 cm), yielding a granular view of patient outcomes across Surgery and Definitive RT cohorts.

KM curves stratified by age × tumour size
library(broom)
library(ggplot2)
library(dplyr)
# ── One row per patient with covariate categories ─────────────────────────────
# Age split at 62 (simulation mean); tumour size split at 3 cm (Stage II midpoint)
km_cov <- oscc2_data |>
dplyr::group_by(id, treatment) |>
dplyr::summarise(
time = max(time),
event = as.integer(any(state == 8)),
age = first(age),
tumor_size_cm = first(tumor_size_cm),
.groups = "drop"
) |>
dplyr::mutate(
age_grp = factor(ifelse(age < 62, "Age < 62", "Age ≥ 62"),
levels = c("Age < 62", "Age ≥ 62")),
size_grp = factor(ifelse(tumor_size_cm < 3.0, "Tumour < 3 cm", "Tumour ≥ 3 cm"),
levels = c("Tumour < 3 cm", "Tumour ≥ 3 cm")),
covariate_group = factor(
interaction(age_grp, size_grp, sep = ", "),
levels = c(
"Age < 62, Tumour < 3 cm",
"Age < 62, Tumour ≥ 3 cm",
"Age ≥ 62, Tumour < 3 cm",
"Age ≥ 62, Tumour ≥ 3 cm"
)
)
)
pal4 <- c("#2166AC", "#92C5DE", "#D6604D", "#B2182B")
labs4 <- c("Age < 62, Tumour < 3 cm",
"Age < 62, Tumour ≥ 3 cm",
"Age ≥ 62, Tumour < 3 cm",
"Age ≥ 62, Tumour ≥ 3 cm")
# ── Tidy survival estimates per arm ──────────────────────────────────────────
tidy_arm <- function(arm, data) {
df <- dplyr::filter(data, treatment == arm)
fit <- survfit(Surv(time, event) ~ covariate_group, data = df)
broom::tidy(fit, conf.int = FALSE) |>
dplyr::mutate(
treatment = arm,
covariate_group = factor(
sub("covariate_group=", "", strata),
levels = levels(data$covariate_group)
)
)
}
surv_tidy <- dplyr::bind_rows(
tidy_arm("Surgery", km_cov),
tidy_arm("DefinitiveRT", km_cov)
) |>
dplyr::mutate(treatment = factor(treatment,
levels = c("Surgery", "DefinitiveRT"),
labels = c("Surgery Arm", "Definitive RT Arm")))
# ── Two-panel KM plot ─────────────────────────────────────────────────────────
ggplot(surv_tidy, aes(x = time, y = estimate,
colour = covariate_group,
group = covariate_group)) +
geom_step(linewidth = 0.8) +
facet_wrap(~treatment, ncol = 2) +
scale_colour_manual(values = pal4, labels = labs4) +
scale_y_continuous(labels = scales::percent_format(accuracy = 1),
limits = c(0, 1), breaks = seq(0, 1, 0.25)) +
scale_x_continuous(limits = c(0, 60), breaks = seq(0, 60, 12)) +
labs(
x = "Time (months)",
y = "Survival probability",
colour = "Age / Tumour Size",
title = "Overall Survival by Age and Tumour Size — Stage II OSCC"
) +
theme_bw(base_size = 11) +
theme(
legend.position = "bottom",
legend.direction = "horizontal",
legend.text = element_text(size = 9),
legend.title = element_text(size = 10, face = "bold"),
strip.text = element_text(size = 11, face = "bold"),
plot.title = element_text(size = 12, face = "bold")
) +
guides(colour = guide_legend(nrow = 2, byrow = TRUE))

In the surgery cohort (n=794), age emerges as the primary differentiator for survival. However, the picture shifts for the Definitive RT arm (n=206). Here, the limited sample size introduces noise, manifest in wide confidence intervals and erratic steps. While the point estimates range from 51% to 69%, treat these figures as indicators of variance rather than definitive clinical benchmarks. Cross-arm comparisons remain statistically treacherous given the thin data spread in the RT group.

Defining Progression-Free Survival

To maintain rigor, we define progression-free survival (PFS) as the interval from the start of treatment until the occurrence of either locoregional recurrence (state S7) or death (S8). If a patient reaches the 60-month threshold without either event, they are effectively censored from further analysis.

Source: Joseph Rickert · www.r-bloggers.com