@@ -19,28 +19,14 @@ x <- gsDesign::gsSurv(
19
19
T = NULL ,
20
20
minfup = NULL ,
21
21
ratio = 1
22
- )
22
+ ) | > gsDesign :: toInteger()
23
23
24
- # Update x with gsDesign() to get integer event counts
25
- x <- gsDesign :: gsDesign(
26
- k = x $ k ,
27
- test.type = 1 ,
28
- alpha = x $ alpha ,
29
- beta = x $ beta ,
30
- sfu = x $ upper $ sf ,
31
- sfupar = x $ upper $ param ,
32
- n.I = ceiling(x $ n.I ),
33
- maxn.IPlan = ceiling(x $ n.I [x $ k ]),
34
- delta = x $ delta ,
35
- delta1 = x $ delta1 ,
36
- delta0 = x $ delta0
37
- )
38
24
y <- gsDesign :: gsBoundSummary(
39
25
x ,
40
26
ratio = 1 ,
41
27
digits = 4 ,
42
28
ddigits = 2 ,
43
- tdigits = 1 ,
29
+ tdigits = 4 ,
44
30
timename = " Month" ,
45
31
logdelta = TRUE
46
32
)
@@ -54,16 +40,16 @@ test_that("under same number of events, compare the power", {
54
40
55
41
out <- gs_power_ahr(
56
42
enroll_rate = define_enroll_rate(
57
- duration = c( 2 , 2 , 2 , 6 ) ,
58
- rate = c( 6 , 12 , 18 , 24 )
43
+ duration = x $ R ,
44
+ rate = x $ gamma | > as.vector( )
59
45
),
60
46
fail_rate = define_fail_rate(
61
- duration = 1 ,
62
- fail_rate = log( 2 ) / 9 ,
63
- hr = 0.65 ,
64
- dropout_rate = 0.001
47
+ duration = Inf ,
48
+ fail_rate = x $ lambdaC | > as.vector() ,
49
+ dropout_rate = x $ etaE | > as.vector() ,
50
+ hr = x $ hr
65
51
),
66
- ratio = 1 ,
52
+ ratio = x $ ratio ,
67
53
# Set number of events the same as the design x above from gsDesign()
68
54
event = x $ n.I ,
69
55
analysis_time = NULL ,
@@ -84,20 +70,20 @@ test_that("under same power setting, compare the number of events", {
84
70
85
71
out <- gs_power_ahr(
86
72
enroll_rate = define_enroll_rate(
87
- duration = c( 2 , 2 , 2 , 6 ) ,
88
- rate = c( 6 , 12 , 18 , 24 )
73
+ duration = x $ R ,
74
+ rate = x $ gamma | > as.vector( )
89
75
),
90
76
fail_rate = define_fail_rate(
91
- duration = 1 ,
92
- fail_rate = log( 2 ) / 9 ,
93
- dropout_rate = 0.001 ,
94
- hr = 0.65
77
+ duration = Inf ,
78
+ fail_rate = x $ lambdaC | > as.vector() ,
79
+ dropout_rate = x $ etaE | > as.vector() ,
80
+ hr = x $ hr
95
81
),
96
- ratio = 1 ,
82
+ ratio = x $ ratio ,
97
83
event = NULL ,
98
84
# Adjust the times s.t. power ~= 0.801 and information fraction ~= 0.7
99
85
# (same as the design x above from gsDesign())
100
- analysis_time = c( 21 , 34.9 ),
86
+ analysis_time = sub( " ^Month: " , " " , y $ Analysis [startsWith( y $ Analysis , " Month: " )]) | > as.numeric( ),
101
87
binding = FALSE ,
102
88
upper = gs_spending_bound ,
103
89
upar = list (sf = gsDesign :: sfLDOF , total_spend = 0.025 , param = NULL , timing = NULL , theta = 0 ),
@@ -108,5 +94,5 @@ test_that("under same power setting, compare the number of events", {
108
94
)
109
95
110
96
# In case test fails, check whether caused by small tolerance
111
- expect_equal(out $ analysis $ event [1 : 2 ], x $ n.I , tolerance = 0.02 )
97
+ expect_equal(out $ analysis $ event [1 : 2 ], x $ n.I , tolerance = 0.002 )
112
98
})
0 commit comments