A comprehensive R Shiny application for Phase 2 single-arm oncology trial visualization, analysis, and go/no-go decision-making.
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.
- 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
- 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
- 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
-
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
# Required R packages
install.packages(c(
"shiny",
"bslib",
"dplyr",
"ggplot2",
"plotly",
"survival",
"survminer",
"binom"
))# Set working directory to oncology_phase2_app folder
setwd("path/to/oncology_phase2_app")
# Run the app
shiny::runApp()cd path/to/oncology_phase2_app
R -e "shiny::runApp()"library(rsconnect)
rsconnect::deployApp("path/to/oncology_phase2_app")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
The application uses simulated data that mimics realistic Phase 2 oncology trials:
- Age, Sex, ECOG performance status
- Baseline tumor size
- Biomarker status (positive/negative)
- Best % change from baseline (RECIST 1.1)
- Response category: CR, PR, SD, PD
- Duration on treatment (weeks)
- Ongoing treatment flag
- Progression-Free Survival (PFS) time and event
- Overall Survival (OS) time and event
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
- Wilson score interval (preferred over Wald for proportions)
- More accurate coverage, especially for small samples and extreme proportions
- 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
- Start with normal approximation
- Refine using exact binomial probabilities
- Find minimum n such that:
- Type I error ≤ α under H0
- Power ≥ (1-β) under H1
- Kaplan-Meier estimator for survival curves
- Log-rank test for comparing groups
- Median survival with 95% CI using Brookmeyer-Crowley method
- Visualize and communicate trial results to stakeholders
- Perform exploratory subgroup analyses
- Generate publication-quality figures
- Calculate required sample sizes for trial planning
- Perform exact hypothesis tests for go/no-go decisions
- Evaluate trial results against pre-specified criteria
- Make evidence-based Phase 2 to Phase 3 transition decisions
- Identify promising patient subpopulations
- Assess probability of success for dose/schedule selection
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
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
Potential additions for production use:
- Upload real data: CSV/Excel import functionality
- Advanced designs: Simon's optimal/minimax with exact implementation
- Bayesian methods: Posterior probabilities, predictive probabilities
- Time-to-event endpoints: PFS-based designs (exponential test)
- Export reports: Automated PDF/Word generation
- Multi-arm trials: Extension to randomized Phase 2 designs
- 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.
- Chang W, et al. (2023). shiny: Web Application Framework for R. https://CRAN.R-project.org/package=shiny
- Therneau T. (2023). survival: Survival Analysis. https://CRAN.R-project.org/package=survival
- Kassambara A, et al. (2021). survminer: Drawing Survival Curves using 'ggplot2'. https://CRAN.R-project.org/package=survminer
- Dorai-Raj S. (2022). binom: Binomial Confidence Intervals For Several Parameterizations. https://CRAN.R-project.org/package=binom
This is a demonstration application created for educational and portfolio purposes.
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