survSampleSize provides an interactive Shiny application for sample size
and power calculation in clinical trials with a survival (time-to-event)
endpoint, under general design conditions.
Two complementary methods are implemented:
- Lu (2021) weighted log-rank method (via the
lrstatpackage), supporting non-proportional hazards, delayed treatment effects (DTE), unequal allocation, dropout, non-inferiority testing, and Fleming-Harrington weighted log-rank statistics. - Freedman (1982) classic method (via the
powerSurvEpipackage) for the proportional-hazards setting.
The app also displays theoretical survival curves and a calendar-time event-prediction timeline, and offers a side-by-side comparison of the two methods.
Install from CRAN:
install.packages("survSampleSize")Or install the development version:
# install.packages("remotes")
remotes::install_github("wettlinmalfa629-hue/survSampleSize")The interactive app relies on several packages declared in Suggests.
Install them with:
install.packages(c(
"lrstat", "powerSurvEpi", "DT", "ggplot2", "bslib", "plotly"
))Launch the application with:
library(survSampleSize)
run_app()This opens the Shiny app in your default browser. From there you can:
- Choose a calculation method (Lu 2021 or Freedman 1982) and direction (solve for sample size N given power, or solve for power given N).
- Set the statistical design parameters (alpha, power, test type, allocation ratio, non-inferiority margin).
- Set the time parameters (accrual duration, follow-up time).
- Set the survival and effect-size parameters (control median survival, target hazard ratio, delayed-effect time, dropout rate, accrual rate).
- Click Calculate to view the results, survival curves, event-prediction timeline, and a method comparison.
- Freedman, L. S. (1982). Tables of the number of patients required in clinical trials using the log-rank test. Statistics in Medicine, 1(2), 121-129. doi:10.1002/sim.4780010204
- Lu, K. (2021). Sample size calculation for logrank test and prediction of number of events over time. Pharmaceutical Statistics, 20(2), 229-244. doi:10.1002/pst.2069