Sitemap

๐—ฆ๐˜‚๐—ฟ๐˜ƒ๐—ถ๐˜ƒ๐—ฎ๐—น ๐—ฃ๐— ๐—™ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ถ๐—ป๐—ผ๐—บ๐—ถ๐˜ข๐—น ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐˜€ ๐—ถ๐—ป ๐‘› ๐—–๐—น๐—ถ๐—ป๐—ถ๐—ฐ๐—ฎ๐—น ๐—ง๐—ฟ๐—ถ๐—ฎ๐—น๐˜€

4 min read2 days ago

--

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.

--

--