Merck / gsdmvn

The goal of gsdmvn is to enable group sequential trial design for time-to-event endpoints under non-proportional hazards assumptions.
http://merck.github.io/gsdmvn/
GNU General Public License v3.0
3 stars 5 forks source link

gs_info_wlr: fix AHR calculation #37

Closed elong0527 closed 2 years ago

elong0527 commented 2 years ago

Fix the calculation of AHR. Now the evaluation is the same as gs_info_ahr for imbalanced design.

Example code:

library(dplyr)
library(gsDesign2)
devtools::load_all()

enrollRates<-tibble::tibble(Stratum="All",duration=6,rate=1)

failRates<-tibble::tibble(Stratum="All",period=1:2,duration=c(4,20),
                          failRate=c(0.05,0.2)/12,
                          hr=c(0.75, 0.5),
                          dropoutRate=c(0.1,0.2)/12)

studyDuration<-sum(failRates$duration)

W1<-gs_design_wlr(enrollRates = enrollRates,
                  failRates = failRates,
                  analysisTimes = studyDuration,
                  ratio=1,
                  upar = qnorm(.975),
                  lpar = qnorm(.975))$bounds 

W2<-gs_design_wlr(enrollRates = enrollRates,
                  failRates = failRates,
                  analysisTimes = studyDuration,
                  ratio=2,
                  upar = qnorm(.975),
                  lpar = qnorm(.975))$bounds 

Output:

> W1
# A tibble: 1 × 11
  Analysis Bound  Time     N Events     Z Probability   AHR theta  info info0
     <dbl> <chr> <dbl> <dbl>  <dbl> <dbl>       <dbl> <dbl> <dbl> <dbl> <dbl>
1        1 Upper    24  586.   101.  1.96         0.9 0.517 0.644  25.1  25.4
> W2
# A tibble: 1 × 11
  Analysis Bound  Time     N Events     Z Probability   AHR theta  info info0
     <dbl> <chr> <dbl> <dbl>  <dbl> <dbl>       <dbl> <dbl> <dbl> <dbl> <dbl>
1        1 Upper    24  517.   80.4  1.96         0.9 0.518 0.720  17.5  22.5