Group sequential design power under risk difference
Usage
gs_power_rd(
p_c = tibble::tibble(Stratum = "All", Rate = 0.2),
p_e = tibble::tibble(Stratum = "All", Rate = 0.15),
N = tibble::tibble(Stratum = "All", N = c(40, 50, 60), Analysis = 1:3),
rd0 = 0,
ratio = 1,
weight = c("un-stratified", "ss", "invar"),
upper = gs_b,
lower = gs_b,
upar = list(par = gsDesign(k = length(N), test.type = 1, sfu = sfLDOF, sfupar =
NULL)$upper$bound),
lpar = list(par = c(qnorm(0.1), rep(-Inf, length(N) - 1))),
info_scale = c(0, 1, 2),
binding = FALSE,
test_upper = TRUE,
test_lower = TRUE,
r = 18,
tol = 1e-06
)
Arguments
- p_c
rate at the control group
- p_e
rate at the experimental group
- N
sample size
- rd0
treatment effect under super-superiority designs, the default is 0
- ratio
experimental:control randomization ratio
- weight
weigting method, either "un-stratified" or "ss" or "invar"
- upper
function to compute upper bound
- lower
function to compare lower bound
- upar
parameter to pass to upper
- lpar
parameter to pass to lower
- info_scale
the information scale for calculation
- binding
indicator of whether futility bound is binding; default of FALSE is recommended
- test_upper
indicator of which analyses should include an upper (efficacy) bound; single value of TRUE (default) indicates all analyses; otherwise, a logical vector of the same length as
info
should indicate which analyses will have an efficacy bound- test_lower
indicator of which analyses should include a lower bound; single value of TRUE (default) indicates all analyses; single value FALSE indicated no lower bound; otherwise, a logical vector of the same length as
info
should indicate which analyses will have a lower bound- r
Integer, at least 2; default of 18 recommended by Jennison and Turnbull
- tol
Tolerance parameter for boundary convergence (on Z-scale)
Examples
# --------------------- #
# example 1 #
# --------------------- #
library(gsDesign)
# un-stratified case with H0: rd0 = 0
gs_power_rd(
p_c = tibble::tibble(Stratum = "All",
Rate = .2),
p_e = tibble::tibble(Stratum = "All",
Rate = .15),
N = tibble::tibble(Stratum = "All",
N = c(20, 40, 60),
Analysis = 1:3),
rd0 = 0,
ratio = 1,
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2))
)
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000309 0.000104 3.71 0.629 1.04e-4
#> 2 2 Upper 0.0182 0.00605 2.51 0.301 6.01e-3
#> 3 3 Upper 0.0728 0.0250 1.99 0.195 2.31e-2
#> 4 1 Lower 0.0571 0.100 -1.28 -0.217 9 e-1
#> 5 2 Lower 0.0571 0.100 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0571 0.100 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 20 0.05 0 0.295 0 34.8 34.6 0.333 0.333
#> 2 2 40 0.05 0 0.417 0 69.6 69.3 0.667 0.667
#> 3 3 60 0.05 0 0.511 0 104. 104. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# --------------------- #
# example 2 #
# --------------------- #
# un-stratified case with H0: rd0 != 0
gs_power_rd(
p_c = tibble::tibble(Stratum = "All",
Rate = .2),
p_e = tibble::tibble(Stratum = "All",
Rate = .15),
N = tibble::tibble(Stratum = "All",
N = c(20, 40, 60),
Analysis = 1:3),
rd0 = 0.005,
ratio = 1,
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2))
)
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000309 0.000116 3.71 0.571 1.04e-4
#> 2 2 Upper 0.0182 0.00680 2.51 0.276 6.01e-3
#> 3 3 Upper 0.0728 0.0281 1.99 0.181 2.31e-2
#> 4 1 Lower 0.0571 0.0949 -1.28 -0.191 9 e-1
#> 5 2 Lower 0.0571 0.0949 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0571 0.0949 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 20 0.05 0.005 0.295 0.0294 34.8 34.6 0.333 0.333
#> 2 2 40 0.05 0.005 0.417 0.0416 69.6 69.3 0.667 0.667
#> 3 3 60 0.05 0.005 0.511 0.0510 104. 104. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# use spending function
gs_power_rd(
p_c = tibble::tibble(Stratum = "All",
Rate = .2),
p_e = tibble::tibble(Stratum = "All",
Rate = .15),
N = tibble::tibble(Stratum = "All",
N = c(20, 40, 60),
Analysis = 1:3),
rd0 = 0.005,
ratio = 1,
upper = gs_spending_bound,
lower = gs_b,
upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
lpar = c(qnorm(.1), rep(-Inf, 2))
)
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000309 0.000116 3.71 0.571 1.04e-4
#> 2 2 Upper 0.0182 0.00680 2.51 0.276 6.01e-3
#> 3 3 Upper 0.0728 0.0281 1.99 0.181 2.31e-2
#> 4 1 Lower 0.0571 0.0949 -1.28 -0.191 9 e-1
#> 5 2 Lower 0.0571 0.0949 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0571 0.0949 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 20 0.05 0.005 0.295 0.0294 34.8 34.6 0.333 0.333
#> 2 2 40 0.05 0.005 0.417 0.0416 69.6 69.3 0.667 0.667
#> 3 3 60 0.05 0.005 0.511 0.0510 104. 104. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# --------------------- #
# example 3 #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 = 0
gs_power_rd(
p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.15, .2, .25)),
p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.1, .16, .19)),
N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
Analysis = rep(1:3, 3),
N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
rd0 = 0,
ratio = 1,
weight = "ss",
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2)))
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000437 0.000104 3.71 0.456 1.04e-4
#> 2 2 Upper 0.0237 0.00604 2.51 0.228 6.01e-3
#> 3 3 Upper 0.0795 0.0237 1.99 0.166 2.31e-2
#> 4 1 Lower 0.0470 0.100 -1.28 -0.157 9 e-1
#> 5 2 Lower 0.0470 0.100 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0470 0.100 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 38 0.0479 0 0.390 0 66.3 66.0 0.485 0.485
#> 2 2 66 0.0491 0 0.528 0 116. 115. 0.846 0.846
#> 3 3 78 0.0492 0 0.576 0 137. 136. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# --------------------- #
# example 4 #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 = 0
gs_power_rd(
p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.15, .2, .25)),
p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.1, .16, .19)),
N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
Analysis = rep(1:3, 3),
N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
rd0 = 0,
ratio = 1,
weight = "invar",
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2)))
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000443 0.000104 3.71 0.449 1.04e-4
#> 2 2 Upper 0.0240 0.00604 2.51 0.225 6.01e-3
#> 3 3 Upper 0.0803 0.0237 1.99 0.164 2.31e-2
#> 4 1 Lower 0.0467 0.100 -1.28 -0.155 9 e-1
#> 5 2 Lower 0.0467 0.100 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0467 0.100 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 38 0.0477 0 0.394 0 68.2 67.9 0.483 0.483
#> 2 2 66 0.0487 0 0.533 0 119. 119. 0.845 0.845
#> 3 3 78 0.0489 0 0.581 0 141. 141. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# --------------------- #
# example 5 #
# --------------------- #
# stratified case under sample size weighting and H0: rd0 != 0
gs_power_rd(
p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.15, .2, .25)),
p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.1, .16, .19)),
N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
Analysis = rep(1:3, 3),
N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
rd0 = 0.02,
ratio = 1,
weight = "ss",
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2)))
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000437 0.000194 3.71 0.285 1.04e-4
#> 2 2 Upper 0.0237 0.0109 2.51 0.153 6.01e-3
#> 3 3 Upper 0.0795 0.0401 1.99 0.117 2.31e-2
#> 4 1 Lower 0.0470 0.0744 -1.28 -0.0717 9 e-1
#> 5 2 Lower 0.0470 0.0744 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0470 0.0744 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 38 0.0479 0.02 0.390 0.163 66.3 66.0 0.485 0.485
#> 2 2 66 0.0491 0.02 0.528 0.215 116. 115. 0.846 0.846
#> 3 3 78 0.0492 0.02 0.576 0.233 137. 136. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"
# --------------------- #
# example 6 #
# --------------------- #
# stratified case under inverse variance weighting and H0: rd0 != 0
gs_power_rd(
p_c = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.15, .2, .25)),
p_e = tibble::tibble(Stratum = c("S1", "S2", "S3"),
Rate = c(.1, .16, .19)),
N = tibble::tibble(Stratum = rep(c("S1", "S2", "S3"), each = 3),
Analysis = rep(1:3, 3),
N = c(10, 20, 24, 18, 26, 30, 10, 20, 24)),
rd0 = 0.03,
ratio = 1,
weight = "invar",
upper = gs_b,
lower = gs_b,
upar = gsDesign(k = 3, test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
lpar = c(qnorm(.1), rep(-Inf, 2)))
#> $bounds
#> # A tibble: 6 × 7
#> Analysis Bound Probability Probability0 Z ~Risk difference at …¹ Nomin…²
#> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 Upper 0.000443 0.000267 3.71 0.196 1.04e-4
#> 2 2 Upper 0.0240 0.0145 2.51 0.113 6.01e-3
#> 3 3 Upper 0.0803 0.0518 1.99 0.0906 2.31e-2
#> 4 1 Lower 0.0467 0.0632 -1.28 -0.0275 9 e-1
#> 5 2 Lower 0.0467 0.0632 -Inf -Inf 1 e+0
#> 6 3 Lower 0.0467 0.0632 -Inf -Inf 1 e+0
#> # … with abbreviated variable names ¹`~Risk difference at bound`, ²`Nominal p`
#>
#> $analysis
#> # A tibble: 3 × 10
#> Analysis N rd rd0 theta1 theta0 info info0 IF IF0
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 38 0.0477 0.03 0.394 0.247 68.2 67.9 0.483 0.483
#> 2 2 66 0.0487 0.03 0.533 0.327 119. 119. 0.845 0.845
#> 3 3 78 0.0489 0.03 0.581 0.356 141. 141. 1 1
#>
#> attr(,"class")
#> [1] "rd" "gs_design" "list"