Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phase 2 Oncology Response Analyzer

A comprehensive R Shiny application for Phase 2 single-arm oncology trial visualization, analysis, and go/no-go decision-making.

Overview

This application provides interactive tools for analyzing tumor response data, survival outcomes, and making evidence-based decisions for Phase 2 to Phase 3 transitions in oncology clinical trials.

Features

1. Tumor Response Waterfall Plot

  • Best % change from baseline in target lesions (RECIST 1.1 criteria)
  • Color-coded by response category (CR, PR, SD, PD)
  • Reference lines at -30% (PR threshold) and +20% (PD threshold)
  • Interactive hover tooltips with patient details
  • Ongoing treatment indicators
  • Biomarker status overlay
  • Sortable by % change, duration, or biomarker

2. Kaplan-Meier Survival Analysis

  • Progression-Free Survival (PFS) and Overall Survival (OS) curves
  • Stratification by response category, biomarker status, age, sex
  • Risk tables showing number at risk over time
  • Median survival times with 95% confidence intervals
  • Log-rank test p-values for group comparisons
  • Side-by-side PFS and OS visualization option

3. Forest Plot - Subgroup Analysis

  • Overall Response Rate (ORR) or Disease Control Rate (DCR) by subgroup
  • Wilson score 95% confidence intervals
  • Subgroups: Age, Sex, Biomarker, Baseline tumor burden, ECOG status
  • Point estimates sized by sample size
  • Visual reference line for overall rate

4. Sample Size & Decision Calculator

  • Sample size calculation using exact binomial test

    • User-configurable null (p0) and alternative (p1) response rates
    • Adjustable Type I error (α) and power (1-β)
    • Returns required sample size and critical decision value
  • Go/No-Go decision analysis

    • Real-time exact binomial test based on observed data
    • Visual decision boundary plot
    • Confidence intervals for observed response rate
    • Clear recommendations: "Go to Phase 3" or "Do not proceed"
  • Simon's Two-Stage Design (optional)

    • Early futility stopping rules
    • Optimal design to minimize expected sample size under H0

Installation & Setup

Prerequisites

# Required R packages
install.packages(c(
  "shiny",
  "bslib",
  "dplyr",
  "ggplot2",
  "plotly",
  "survival",
  "survminer",
  "binom"
))

Running the Application

Option 1: From RStudio

# Set working directory to oncology_phase2_app folder
setwd("path/to/oncology_phase2_app")

# Run the app
shiny::runApp()

Option 2: From Command Line

cd path/to/oncology_phase2_app
R -e "shiny::runApp()"

Option 3: Deploying to shinyapps.io

library(rsconnect)
rsconnect::deployApp("path/to/oncology_phase2_app")

Project Structure

oncology_phase2_app/
├── app.R                          # Main application file
├── global.R                       # Global setup, data loading
├── README.md                      # This file
├── modules/
│   ├── waterfall_module.R        # Waterfall plot module
│   ├── kaplan_meier_module.R     # Survival analysis module
│   ├── forest_plot_module.R      # Subgroup analysis module
│   └── sample_size_module.R      # Statistical calculator module
├── utils/
│   ├── oncology_data_sim.R       # Simulated data generator
│   └── stats_utils.R             # Statistical utility functions
└── www/
    └── oncology.css               # Custom CSS styling

Data

The application uses simulated data that mimics realistic Phase 2 oncology trials:

Patient Demographics

  • Age, Sex, ECOG performance status
  • Baseline tumor size
  • Biomarker status (positive/negative)

Tumor Response Data

  • Best % change from baseline (RECIST 1.1)
  • Response category: CR, PR, SD, PD
  • Duration on treatment (weeks)
  • Ongoing treatment flag

Survival Data

  • Progression-Free Survival (PFS) time and event
  • Overall Survival (OS) time and event

Data Generation

The generate_oncology_data() function creates 80 patients by default with realistic:

  • Response distributions influenced by biomarker status
  • Survival times correlated with response
  • Subgroup variations

Statistical Methods

Response Rate Confidence Intervals

  • Wilson score interval (preferred over Wald for proportions)
  • More accurate coverage, especially for small samples and extreme proportions

Hypothesis Testing

  • Exact binomial test for single proportion
  • H0: p ≤ p0 (uninteresting response rate)
  • H1: p > p1 (target response rate)
  • One-sided test appropriate for Phase 2 go/no-go decisions

Sample Size Calculation

  1. Start with normal approximation
  2. Refine using exact binomial probabilities
  3. Find minimum n such that:
    • Type I error ≤ α under H0
    • Power ≥ (1-β) under H1

Survival Analysis

  • Kaplan-Meier estimator for survival curves
  • Log-rank test for comparing groups
  • Median survival with 95% CI using Brookmeyer-Crowley method

Use Cases

For Clinical Data Scientists

  • Visualize and communicate trial results to stakeholders
  • Perform exploratory subgroup analyses
  • Generate publication-quality figures

For Biostatisticians

  • Calculate required sample sizes for trial planning
  • Perform exact hypothesis tests for go/no-go decisions
  • Evaluate trial results against pre-specified criteria

For Clinical Development Teams

  • Make evidence-based Phase 2 to Phase 3 transition decisions
  • Identify promising patient subpopulations
  • Assess probability of success for dose/schedule selection

For Interview Preparation

This application demonstrates:

  • Domain expertise: Oncology trials, RECIST criteria, Phase 2 design
  • Statistical rigor: Exact tests, survival analysis, power calculations
  • Software engineering: Modular Shiny architecture, reusable components
  • Data visualization: Publication-quality plots, interactive dashboards
  • Decision support: Real-world tools for trial management

Key Insights from Example Data

Using the simulated data (n=80, seed=42):

  • ORR: ~38-42% (varies by seed)
  • DCR: ~70-75%
  • Median PFS: ~8-12 months
  • Median OS: ~18-24 months
  • Biomarker effect: ~20-30% ORR difference between positive vs negative

Future Enhancements

Potential additions for production use:

  1. Upload real data: CSV/Excel import functionality
  2. Advanced designs: Simon's optimal/minimax with exact implementation
  3. Bayesian methods: Posterior probabilities, predictive probabilities
  4. Time-to-event endpoints: PFS-based designs (exponential test)
  5. Export reports: Automated PDF/Word generation
  6. Multi-arm trials: Extension to randomized Phase 2 designs

References

Statistical Methods

  • Simon R. (1989). Optimal two-stage designs for phase II clinical trials. Controlled Clinical Trials, 10(1), 1-10.
  • Brown LD, Cai TT, DasGupta A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101-133.
  • Eisenhauer EA, et al. (2009). New response evaluation criteria in solid tumours (RECIST 1.1). European Journal of Cancer, 45(2), 228-247.

R Packages

License

This is a demonstration application created for educational and portfolio purposes.

Contact

For questions or collaborations, please reach out via the main repository.


Version: 1.0.0 Last Updated: 2025 Built with: R Shiny, survival, survminer, binom, ggplot2, plotly, Bootstrap 5

About

R Shiny dashboard for Phase 2 oncology trials: RECIST waterfall plots, Kaplan-Meier curves, subgroup analysis, and go/no-go decision tools with sample size calculations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages