# Sample Size Calculation Under Non-Proportional Hazards

#### 12/15/2021

This R Markdown document illustrates the sample size calculation for a delayed effect model using the lrsamplesize function from lrstat and verifies the result using the simulation tool.

Suppose that the survival distribution of the control group is exponential with a median survival time of 13 months. The survival distribution of the active treatment group is piecewise exponential with the same hazard rate as the control group for the first 6 months and with a hazard ratio of 0.58 afterwards. The accrual has a ramp-up period of 9 months to reach 26 patients per months thereafter, and the total duration of the enrollment is 22 months. In addition, the annual drop rate is 5% for each treatment group.

We would like to know the total number of events needed to achieve 80% power for a two-stage group sequential trial with O’Brien-Fleming spending function and with the interim analysis to be conducted after observing 80% of the target total number of events. First we load the lrstat package:

library(lrstat)

We use the lrsamplesize function to obtain the follow-up time and the target number of events.

lrsamplesize(beta = 0.2, kMax = 2,
informationRates = c(0.8, 1),
alpha = 0.025, typeAlphaSpending = "sfOF",
accrualTime = seq(0, 9),
accrualIntensity = c(26/9*seq(1, 9), 26),
piecewiseSurvivalTime = c(0, 6),
lambda2 = rep(log(2)/13, 2),
lambda1 = c(log(2)/13, 0.58*log(2)/13),
gamma1 = -log(1-0.05)/12,
gamma2 = -log(1-0.05)/12,
accrualDuration = 22, followupTime = NA)\$resultsUnderH1
##
## Group-sequential trial with 2 stages
## Overall power: 0.802, overall significance level (1-sided): 0.025
## Maximum # events: 316, expected # events: 287.4
## Maximum # dropouts: 29.9, expected # dropouts: 26.9
## Maximum # subjects: 468, expected # subjects: 468
## Total study duration: 41.7, expected study duration: 37
## Accrual duration: 22, follow-up duration: 19.7, fixed follow-up: FALSE
##
##                              Stage 1 Stage 2
## Information rate             0.801   1.000
## Efficacy boundary (Z-scale)  2.249   2.025
## Cumulative rejection         0.455   0.802
## Cumulative alpha spent       0.0122  0.0250
## Number of events             253.0   316.0
## Number of dropouts           23.2    29.9
## Number of subjects           468.0   468.0
## Analysis time                31.5    41.7
## Efficacy boundary (HR-scale) 0.752   0.795
## Efficacy boundary (p-scale)  0.0122  0.0214
## Information                  63.01   78.21
## HR                           0.764   0.723

Thus we need to observe 316 events with 468 subjects, and the maximum study duration is 41.7 months with an expected study duration of 37 months.

To verify this requirement, we resort to the lrsim function.

lrsim(kMax = 2, criticalValues = c(2.250, 2.025),
accrualTime = seq(0, 9),
accrualIntensity = c(26/9*seq(1, 9), 26),
piecewiseSurvivalTime = c(0, 6),
lambda2 = rep(log(2)/13, 2),
lambda1 = c(log(2)/13, 0.58*log(2)/13),
gamma1 = -log(1-0.05)/12,
gamma2 = -log(1-0.05)/12,
accrualDuration = 22,
plannedEvents = c(253, 316),
maxNumberOfIterations = 10000, seed = 314159)
##
## Group-sequential trial with 2 stages
## Overall power: 0.8
## Expected # events: 287.3
## Expected # dropouts: 26.8
## Expected # subjects: 468
## Expected study duration: 36.9
## Accrual duration: 22, fixed follow-up: FALSE
##
##                      Stage 1 Stage 2
## Cumulative rejection 0.456   0.800
## Cumulative futility  0.000   0.200
## Number of events     253.0   316.0
## Number of dropouts   23.2    29.9
## Number of subjects   468.0   468.0
## Analysis time        31.5    41.6

The simulation results confirm the analytic calculations.