@@ -279,4 +279,76 @@ gs_update_ahr(x = x, alpha = 0.05)
279279# > 1 0.6495177
280280# > 2 1.0000000
281281# >
282+
283+ # ------------------------------------------------- #
284+ # Two-sided asymmetric stratified design,
285+ # beta-spending with non-binding lower bound
286+ # ------------------------------------------------- #
287+ enroll_rate <- define_enroll_rate(stratum = c(" A" , " B" ), duration = c(12 , 12 ), rate = c(1 , 1 ))
288+
289+ # We assumme there are 2 strata, "A" and "B".
290+ # For each stratum, there are delayed effect for the first 3 months.
291+ # After the delayed effect, the HR is 0.8 for stratum A and 0.5 for stratum B.
292+ fail_rate <- define_fail_rate(stratum = c(" A" , " A" , " B" , " B" ),
293+ duration = c(3 , Inf , 3 , Inf ),
294+ fail_rate = log(2 ) / c(9 , 9 , 9 , 15 ),
295+ hr = c(1 , 0.8 , 1 , 0.5 ),
296+ dropout_rate = rep(0.001 , 4 ))
297+
298+ # The original design assumes there are 2 IAs and 1 FA cutting by calendar time.
299+ # The efficacy testing is conducted at IA2 and FA.
300+ # The futility testing is conducted at IA1.
301+ x <- gs_design_ahr(enroll_rate = enroll_rate ,
302+ fail_rate = fail_rate ,
303+ alpha = 0.0125 ,
304+ beta = 0.1 ,
305+ analysis = c(20 , 28 , 36 ),
306+ upper = " gs_spending_bound" ,
307+ upar = list (sf = " sfLDOF" , total_spend = 0.0125 ),
308+ lower = " gs_spending_bound" ,
309+ lpar = list (sf = " sfHSD" , total_spend = 0.1 , param = - 8 ),
310+ test_upper = c(FALSE , TRUE , TRUE ),
311+ test_lower = c(TRUE , FALSE , FALSE )) | > to_integer()
312+
313+ # At time of analysis
314+ # For IA1,
315+ # - There are 70 events observed during the delayed effect period for stratum A.
316+ # - There are 150 events observed after the delayed effect period for stratum A.
317+ # - There are 75 events observed during the delayed effect period for stratum B.
318+ # - There are 90 events observed after the delayed effect period for stratum B.
319+ # For IA2,
320+ # - There are 75 events observed during the delayed effect period for stratum A.
321+ # - There are 210 events observed after the delayed effect period for stratum A.
322+ # - There are 76 events observed during the delayed effect period for stratum B.
323+ # - There are 136 events observed after the delayed effect period for stratum B.
324+ # For FA,
325+ # - There are 77 events observed during the delayed effect period for stratum A.
326+ # - There are 245 events observed after the delayed effect period for stratum A.
327+ # - There are 77 events observed during the delayed effect period for stratum B.
328+ # - There are 170 events observed after the delayed effect period for stratum B.
329+ event_tbl <- data.frame (analysis = c(1 , 1 , 1 , 1 ,
330+ 2 , 2 , 2 , 2 ,
331+ 3 , 3 , 3 , 3 ),
332+ stratum = c(" A" , " A" , " B" , " B" , # IA1
333+ " A" , " A" , " B" , " B" , # IA2
334+ " A" , " A" , " B" , " B" ),# FA
335+ # event per interval per stratum at IA1
336+ event = c(70 , 150 , 75 , 90 ,
337+ # event per interval per stratum at IA2
338+ 75 , 210 , 76 , 136 ,
339+ # event per interval per stratum at FA
340+ 77 , 245 , 77 , 170 ))
341+ observed_event <- (event_tbl | > dplyr :: group_by(analysis ) | > dplyr :: summarize(x = sum(event )))$ x
342+
343+ ustime <- pmin(x $ analysis $ event ,
344+ observed_event ) / x $ analysis $ event [3 ]
345+ ustime [3 ] <- 1
346+ lstime <- ustime
347+
348+ xu <- gs_update_ahr(x = x ,
349+ alpha = 0.015 ,
350+ ustime = ustime ,
351+ lstime = lstime ,
352+ event_tbl = event_tbl
353+ )
282354```
0 commit comments