Power and Sample Size Calculation for Non-Proportional Hazards
and Beyond
Performs power and sample size calculation for non-proportional hazards model using the Fleming-Harrington family of weighted log-rank tests. The sequentially calculated log-rank test score statistics are assumed to have independent increments as characterized in Anastasios A. Tsiatis (1982) . The mean and variance of log-rank test score statistics are calculated based on Kaifeng Lu (2021) . The boundary crossing probabilities are calculated using the recursive integration algorithm described in Christopher Jennison and Bruce W. Turnbull (2000, ISBN:0849303168). The package can also be used for continuous, binary, and count data. For continuous data, it can handle missing data through mixed-model for repeated measures (MMRM). In crossover designs, it can estimate direct treatment effects while accounting for carryover effects. For binary data, it can design Simon's 2-stage, modified toxicity probability-2 (mTPI-2), and Bayesian optimal interval (BOIN) trials. For count data, it can design group sequential trials for negative binomial endpoints with censoring. Additionally, it facilitates group sequential equivalence trials for all supported data types. Moreover, it can design adaptive group sequential trials for changes in sample size, error spending function, number and spacing or future looks. Finally, it offers various options for adjusted p-values, including graphical and gatekeeping procedures.
lrstat
lrstat provides power and sample size methods for non-proportional hazards
and many other clinical trial designs.
The package is built around weighted log-rank methodology for time-to-event
group sequential designs, with flexible accrual, event/dropout modeling,
error-spending boundaries, and simulation support. It also includes design and
inference tools for continuous, binary, count, and equivalence settings,
including adaptive and multi-arm/multi-stage extensions.
Installation
Install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("kaifenglu/lrstat")
Key Features
- Weighted log-rank design and power under non-proportional hazards using the
Fleming-Harrington class of weights.
- Group sequential design support with Lan-DeMets error spending and boundary
calculations.
- Analytical and simulation-based operating characteristics for power, event
counts, accrual duration, and follow-up duration.
- Support for adaptive group sequential updates (sample size, timing, error
spending, future looks).
- Design modules for continuous, binary, count, and time-to-event endpoints,
including equivalence settings.
- Specialized methods for crossover, repeated measures (MMRM), exact methods,
and multi-arm/multi-stage workflows.
- Built-in datasets and a Shiny interface.
Typical Workflow
- Specify design assumptions: accrual profile, event/dropout hazards,
allocation, number/timing of looks, and spending function.
- Compute design characteristics with weighted log-rank functions such as
lrpower(), lrsamplesize(), getBound(), and related utilities.
- Optionally evaluate robustness via simulation (for example,
lrsim()) and
compare alternative design scenarios.
- Summarize final design choices and explore sensitivity to delayed effects,
accrual changes, or follow-up constraints.
Minimal Time-to-Event Example
The example below computes power for a two-look group sequential trial with a
delayed treatment effect and FH(0,1) weighting.
library(lrstat)
fit <- lrpower(
kMax = 2,
informationRates = c(0.8, 1),
alpha = 0.025,
typeAlphaSpending = "sfOF",
allocationRatioPlanned = 1,
accrualTime = seq(0, 9),
accrualIntensity = c(26 / 9 * seq(1, 9), 26),
piecewiseSurvivalTime = c(0, 6),
lambda1 = c(0.0533, 0.0309),
lambda2 = c(0.0533, 0.0533),
gamma1 = -log(1 - 0.05) / 12,
gamma2 = -log(1 - 0.05) / 12,
accrualDuration = 22,
followupTime = 18,
fixedFollowup = FALSE,
rho1 = 0,
rho2 = 1
)
fit
Additional Design Families
lrstat includes broad design support beyond weighted log-rank settings,
including:
- Continuous endpoints (for example, mean difference/ratio and MMRM-based
designs).
- Binary endpoints (including exact methods and interval-based dose-finding
tools such as mTPI-2 and BOIN helpers).
- Count endpoints (including negative binomial settings with censoring).
- Equivalence and adaptive group sequential variants across supported endpoint
types.
See the reference index for the full function catalog.
Shiny App
Launch the interactive application:
library(lrstat)
runShinyApp_lrstat()
Documentation
Citation
If you use lrstat in analyses, reports, or publications, please cite the
package and relevant methodological references documented in the function help
pages and vignettes.