Skip to contents

gs_design_nph() is a flexible routine to provide a sample size or power for a fixed or group sequential design under various non-proportional hazards assumptions for either single or multiple strata studies. The piecewise exponential distribution allows a simple method to specify a distribtuion and enrollment pattern where the enrollment, failure and dropout rates changes over time.

Usage

gs_design_nph(
  enrollRates = tibble::tibble(Stratum = "All", duration = c(2, 2, 10), rate = c(3, 6,
    9)),
  failRates = tibble::tibble(Stratum = "All", duration = c(3, 100), failRate =
    log(2)/c(9, 18), hr = c(0.9, 0.6), dropoutRate = rep(0.001, 2)),
  ratio = 1,
  alpha = 0.025,
  beta = 0.1,
  analysisTimes = 30,
  IF = c(0.25, 0.75, 1),
  upper = gs_b,
  upar = gsDesign::gsDesign(k = 3, test.type = 1, n.I = c(0.25, 0.75, 1), maxn.IPlan = 1,
    sfu = sfLDOF, sfupar = NULL)$upper$bound,
  lower = gs_b,
  lpar = c(qnorm(0.1), rep(-Inf, length(IF) - 1)),
  r = 18
)

Arguments

enrollRates

Piecewise constant enrollment rates by stratum and time period.

failRates

Piecewise constant control group failure rates, duration for each piecewise constant period, hazard ratio for experimental vs control, and dropout rates by stratum and time period.

ratio

Experimental:Control randomization ratio

alpha

One-sided Type I error

beta

Type II error

analysisTimes

Final calendar time if beta is not NULL

IF

information fraction at planned analyses

upper

Function to produce upper bound

upar

Parameters to pass to upper

lower

Function to produce lower bound

lpar

Parameters to pass to lower

r

Control for grid size; normally leave at default of r=18

Value

A list with 3 tibbles: 1) enrollRates with enrollRates$rate adjusted by sample size calculation and adding N with cumulative enrollment at end of each enrollment rate period, 2) failRates as input, 3) codebounds with a row for each bound and each analysis; rows contain the variables Analysis with analysis number, Z with Z-value bound, Probability with cumulative probability of crossing bound at each analysis under the alternate hypothesis input, theta standardized effect size at each analysis, info cumulative statistical information for theta at each analysis, Time expected timing of analysis, avehr expected average hazard ratio at time of analysis, Events expected events an time of analysis under alternate hypothesis, info0 information under null hypothesis with same expected total events under alternate hypothesis, and N expected enrollment at time of analysis.

Examples

library(dplyr)

# Design
library(dplyr)

x <- gs_design_nph()
# Notice cumulative power is 0.9 (90%)
x
#> $enrollRates
#> # A tibble: 3 × 4
#>   Stratum duration  rate     N
#>   <chr>      <dbl> <dbl> <dbl>
#> 1 All            2  17.7  35.3
#> 2 All            2  35.3 106. 
#> 3 All           10  53.0 636. 
#> 
#> $failRates
#> # A tibble: 2 × 5
#>   Stratum duration failRate    hr dropoutRate
#>   <chr>      <dbl>    <dbl> <dbl>       <dbl>
#> 1 All            3   0.0770   0.9       0.001
#> 2 All          100   0.0385   0.6       0.001
#> 
#> $bounds
#> # A tibble: 6 × 11
#>   Analysis Bound       Z Probability theta  info  Time   AHR Events info0     N
#>      <int> <chr>   <dbl>       <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl>
#> 1        1 Upper    4.33    0.000257 0.186  21.3  10.1 0.830   86.2  21.5  427.
#> 2        2 Upper    2.34    0.563    0.314  63.2  21.1 0.730  258.   64.6  636.
#> 3        3 Upper    2.01    0.900    0.364  84.4  30.0 0.695  345.   86.2  636.
#> 4        1 Lower   -1.28    0.0161   0.186  21.3  10.1 0.830   86.2  21.5  427.
#> 5        2 Lower -Inf       0.0161   0.314  63.2  21.1 0.730  258.   64.6  636.
#> 6        3 Lower -Inf       0.0161   0.364  84.4  30.0 0.695  345.   86.2  636.
#> 
# Check Type I error, non-binding; should be .025 (2.5%)
gs_power_nph(enrollRates = x$enrollRates,
           failRates = x$failRates %>% mutate(hr = 1),
           events = (x$bounds %>% filter(Bound == "Upper"))$Events,
           upar = (x$bounds %>% filter(Bound == "Upper"))$Z,
           lpar = rep(-Inf,3),
           upper = gs_b,
           lower = gs_b
           ) %>% filter(abs(Z) < Inf)
#> # A tibble: 3 × 10
#>   Analysis Bound     Z Probability  Time Events   AHR theta  info info0
#>      <int> <chr> <dbl>       <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1        1 Upper  4.33  0.00000737  9.66   86.2     1     0  21.5  21.5
#> 2        2 Upper  2.34  0.00965    18.8   258.      1     0  64.6  64.6
#> 3        3 Upper  2.01  0.0250     25.6   345.      1     0  86.2  86.2
# Power under proportional hazards, HR = 0.75
gs_power_nph(enrollRates = x$enrollRates,
           failRates = x$failRates %>% mutate(hr = .75),
           events = (x$bounds %>% filter(Bound == "Upper"))$Events,
           upar = (x$bounds %>% filter(Bound == "Upper"))$Z,
           lpar = rep(-Inf,3),
           upper = gs_b,
           lower = gs_b
           ) %>% filter(abs(Z) < Inf)
#> # A tibble: 3 × 10
#>   Analysis Bound     Z Probability  Time Events   AHR theta  info info0
#>      <int> <chr> <dbl>       <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1        1 Upper  4.33     0.00132  10.2   86.2  0.75 0.288  21.2  21.5
#> 2        2 Upper  2.34     0.484    20.8  258.   0.75 0.288  63.8  64.6
#> 3        3 Upper  2.01     0.750    28.7  345.   0.75 0.288  85.3  86.2