๐ฆ๐๐ฟ๐๐ถ๐๐ฎ๐น ๐ฃ๐ ๐ ๐ณ๐ผ๐ฟ ๐๐ถ๐ป๐ผ๐บ๐ถ๐ข๐น ๐๐๐ฒ๐ป๐๐ ๐ถ๐ป ๐ ๐๐น๐ถ๐ป๐ถ๐ฐ๐ฎ๐น ๐ง๐ฟ๐ถ๐ฎ๐น๐
In clinical trials and biostatistical research, primary endpoints frequently involve binary outcomes โ such as tumor response versus non-response, patient survival status at fixed milestone horizons (e.g., 1-year overall survival), or the occurrence of dose-limiting toxicities (DLTs). When evaluating a cohort of ๐ independent patients, continuous time-to-event methods are often discretized into milestone evaluations or multi-stage trial designs. Under these conditions, the foundational statistical engine shifts from continuous probability density functions (PDFs) to the Binomial Probability Mass Function (PMF) and its associated Discrete Survival Function.
Let us exlore the mathematical formulation of binomial survival frameworks, derives discrete hazard rates, examines clinical trial designs governed by binomial distributions using Python, R and SAS.
๐ญ. ๐ ๐ฎ๐๐ต๐ฒ๐บ๐ฎ๐๐ถ๐ฐ๐ฎ๐น ๐๐ผ๐๐ป๐ฑ๐ฎ๐๐ถ๐ผ๐ป๐: ๐๐ถ๐ป๐ผ๐บ๐ถ๐ฎ๐น ๐ฃ๐ ๐, ๐๐๐, ๐ฎ๐ป๐ฑ ๐ฆ๐๐ฟ๐๐ถ๐๐ฎ๐น
Let ๐ represent the random variable denoting the total number of successes (e.g., patient survivals or treatment responses) observed in ๐ independent clinical trials, where each trial has a success probability ๐. The Binomial Probability Mass Function (PMF) defines the exact probability of observing precisely ๐ successes:
๐(๐ = ๐) = C(๐, ๐) ยท ๐แต ยท (1 โ ๐)โฟโปแต, ๐ = 0, 1, 2, โฆ, ๐
Where C(๐, ๐) = ๐! / [๐!(๐ โ ๐)!] is the binomial coefficient. In survival analysis contexts, researchers are frequently interested in the Cumulative Distribution Function (CDF) โ representing the probability of observing ๐ or fewer successes โ and its complement, the Discrete Survival Function (Reliability Function), which denotes the probability of observing at least ๐ successes:
๐น(๐) = ๐(๐ โค ๐) = โแตขโโแต C(๐, ๐) ยท ๐โฑ ยท (1 โ ๐)โฟโปโฑ ๐(๐) = ๐(๐ โฅ ๐) = 1 โ ๐น(๐ โ 1) = โแตขโ๐โฟ C(๐, ๐) ยท ๐โฑ ยท (1 โ ๐)โฟโปโฑ
The Discrete Hazard Rate
Analogous to continuous hazard functions in Cox proportional hazards models, the discrete hazard rate โ(๐) measures the conditional probability that the process terminates or achieves an event exactly at state ๐, given that it has survived up to state ๐:
โ(๐) = ๐(๐ = ๐ โฃ ๐ โฅ ๐) = ๐(๐ = ๐) / ๐(๐)
โโโโโโโโโโโโโโโโโโโโ
๐ฎ. ๐๐น๐ถ๐ป๐ถ๐ฐ๐ฎ๐น ๐ง๐ฟ๐ถ๐ฎ๐น ๐๐ฝ๐ฝ๐น๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐
Discrete binomial survival frameworks govern several critical methodologies in clinical research: โข Milestone Survival Analysis: In oncology trials, overall survival is frequently evaluated at fixed landmark times (e.g., 1-year or 3-year progression-free survival). When patient accrual is complete and follow-up is uniform, the number of surviving patients follows a binomial distribution Bin(๐, ๐). โข Simonโs Two-Stage Phase II Designs: Phase II oncology trials utilize binomial survival thresholds to evaluate early-stage efficacy. Stage 1 treats ๐โ patients; if fewer than ๐โ responses are observed, the trial terminates for futility. The exact binomial PMF calculates the exact Type I and Type II error rates under null response probabilities ๐โ and target response probabilities ๐โ. โข Safety Monitoring and Adverse Event Bounds: Monitoring dose-limiting toxicities (DLTs) in Phase I dose-escalation trials relies on exact binomial confidence bounds (such as Clopper-Pearson intervals) to ensure toxicity rates do not exceed safety thresholds (e.g., 33%).
Get Vinaitheerthan Renganathanโs stories inย yourย inbox
Join Medium for free to get updates fromย thisย writer.
๐ฏ. ๐ฆ๐ผ๐ณ๐๐๐ฎ๐ฟ๐ฒ ๐๐บ๐ฝ๐น๐ฒ๐บ๐ฒ๐ป๐๐ฎ๐๐ถ๐ผ๐ป ๐ถ๐ป ๐ฃ๐๐๐ต๐ผ๐ป ๐ฎ๐ป๐ฑ ๐ฅ
Python Implementation (Using scipy.stats.binom)
Python
import numpy as np
import scipy.stats as stats# Parameters: n = 50 patients, true underlying response probability p = 0.60
n = 50
p = 0.60# 1. Compute Binomial PMF for exact successes k
k_values = np.arange(0, n + 1)
pmf_values = stats.binom.pmf(k_values, n, p)# 2. Compute Discrete Survival Function S(k) = P(X >= k)
survival_values = stats.binom.sf(k_values - 1, n, p)# 3. Exact Clopper-Pearson 95% Confidence Interval for observed successes k = 32
k_obs = 32
ci_low, ci_high = stats.binomtest(k_obs, n).proportion_ci(confidence_level=0.95, method='exact')print(f"Observed Successes: {k_obs}/{n} ({k_obs/n:.2%})")
print(f"Exact 95% Clopper-Pearson CI: [{ci_low:.4f}, {ci_high:.4f}]")
print(f"Survival Probability S(32) = P(X >= 32): {survival_values[32]:.4f}")
R Implementation (Using Base Stats Package)
R
# Parameters: n = 50 patients, p = 0.60
n <- 50
p <- 0.60# 1. Compute Binomial PMF and Survival Function S(k) = P(X >= k)
k_values <- 0:n
pmf_values <- dbinom(k_values, size = n, prob = p)
survival_values <- 1 - pbinom(k_values - 1, size = n, prob = p)# 2. Exact Clopper-Pearson Confidence Interval for k = 32 successes
k_obs <- 32
exact_test <- binom.test(k_obs, n, conf.level = 0.95)print(exact_test)
cat("Survival Probability S(32):", survival_values[33], "\n")
SAS Implementation
/* 1. COMPUTE BINOMIAL PMF, CDF, AND DISCRETE SURVIVAL FUNCTION */
/****************************************************************/
data binomial_survival;
/* Trial Parameters: n = 50 patients, true response probability p = 0.60 */
n = 50;
p = 0.60;
do k = 0 to n;
/* Probability Mass Function P(X = k) */
pmf = pdf(โBinomialโ, k, p, n);
/* Cumulative Distribution Function P(X <= k) */
cdf = cdf(โBinomialโ, k, p, n);
/* Discrete Survival Function S(k) = P(X >= k) = 1 โ P(X <= k โ 1) */
if k = 0 then survival = 1.0;
else survival = 1.0 โ cdf(โBinomialโ, k โ 1, p, n);
output;
end;
run;
/* Print results around the expected mean (np = 30) */
proc print data=binomial_survival(where=(k between 25 and 40));
var k pmf cdf survival;
title โBinomial PMF and Discrete Survival Function (n=50, p=0.60)โ;
run;
/****************************************************************/
/* 2. EXACT CLOPPER-PEARSON CONFIDENCE INTERVALS (PROC FREQ) */
/****************************************************************/
/* Suppose we observed k_obs = 32 successes out of n = 50 patients */
data clinical_trial_summary;
input response $ count;
datalines;
Success 32
Failure 18
;
run;
proc freq data=clinical_trial_summary order=data;
weight count;
tables response / binomial(exact cl=clopperpearson);
exact binomial;
title โExact Clopper-Pearson 95% Confidence Interval for Response Rateโ;
run;
โโโโโโโโโโโโโโโโโโโโ
๐ฐ. ๐๐ฒ๐๐ ๐ฃ๐ฟ๐ฎ๐ฐ๐๐ถ๐ฐ๐ฒ๐ ๐ณ๐ผ๐ฟ ๐๐ฝ๐ฝ๐น๐ถ๐ฒ๐ฑ ๐๐ถ๐ผ๐๐๐ฎ๐๐ถ๐๐๐ถ๐ฐ๐ถ๐ฎ๐ป๐
- Account for Censoring in Fixed Horizons: If patients drop out prior to the milestone window without experiencing the event, standard binomial models will overestimate failure rates unless adjusted via censoring-weights (e.g., Kaplan-Meier binomial effective sample size corrections).
- Exact vs. Asymptotic Intervals: For small sample sizes (๐ < 30) or extreme response probabilities (๐ < 0.10 or ๐ > 0.90), Wald asymptotic normal intervals produce inaccurate coverage. Always rely on exact Clopper-Pearson or Wilson score intervals.
- Multiplicity Adjustments: When evaluating multiple milestone timepoints across interim monitoring looks, apply appropriate alpha-spending boundaries (such as OโBrien-Fleming or Pocock) to control family-wise error rates.




