# Fixed design examples ----
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
# Enrollment rate
enroll_rate <- define_enroll_rate(
duration = 18,
rate = 20
)
# Failure rates
fail_rate <- define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
dropout_rate = .001,
hr = c(1, .6)
)
# Study duration in months
study_duration <- 36
# Experimental / Control randomization ratio
ratio <- 1
# 1-sided Type I error
alpha <- 0.025
# Type II error (1 - power)
beta <- 0.1
# Example 1 ----
fixed_design_ahr(
alpha = alpha, power = 1 - beta,
enroll_rate = enroll_rate, fail_rate = fail_rate,
study_duration = study_duration, ratio = ratio
) %>%
summary() %>%
as_gt()
Fixed Design under AHR Method |
Design |
N |
Events |
Time |
Bound |
alpha |
Power |
---|
Average hazard ratio |
463.078 |
324.7077 |
36 |
1.959964 |
0.025 |
0.9 |
# Example 2 ----
fixed_design_fh(
alpha = alpha, power = 1 - beta,
enroll_rate = enroll_rate, fail_rate = fail_rate,
study_duration = study_duration, ratio = ratio
) %>%
summary() %>%
as_gt()
Fixed Design under Fleming-Harrington Method |
Design |
N |
Events |
Time |
Bound |
alpha |
Power |
---|
Fleming-Harrington FH(0, 0) (logrank) |
458.3509 |
321.3931 |
36 |
1.959964 |
0.025 |
0.9 |
# \donttest{
# Group sequential design examples ---
library(dplyr)
# Example 1 ----
# The default output
gs_design_ahr() %>%
summary() %>%
as_gt()
Bound summary for AHR design |
AHR approximations of ~HR at bound |
Bound |
Z |
Nominal p |
~HR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Analysis: 1 Time: 36 N: 476 Events: 291.9 AHR: 0.68 Information fraction: 1 |
---|
Efficacy |
1.96 |
0.025 |
0.795 |
0.9 |
0.025 |
gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt()
Bound summary for AHR design |
AHR approximations of ~HR at bound |
Bound |
Z |
Nominal p |
~HR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Analysis: 1 Time: 14.9 N: 108 Events: 30 AHR: 0.79 Information fraction: 0.6 |
---|
Futility |
-1.17 |
0.8792 |
1.5392 |
0.0349 |
0.1208 |
Efficacy |
2.67 |
0.0038 |
0.3743 |
0.0231 |
0.0038 |
Analysis: 2 Time: 19.2 N: 108 Events: 40 AHR: 0.74 Information fraction: 0.8 |
---|
Futility |
-0.66 |
0.7462 |
1.2359 |
0.0668 |
0.2655 |
Efficacy |
2.29 |
0.0110 |
0.4812 |
0.0897 |
0.0122 |
Analysis: 3 Time: 24.5 N: 108 Events: 50 AHR: 0.71 Information fraction: 1 |
---|
Futility |
-0.23 |
0.5897 |
1.0670 |
0.1008 |
0.4303 |
Efficacy |
2.03 |
0.0211 |
0.5595 |
0.2070 |
0.0250 |
gs_design_wlr() %>%
summary() %>%
as_gt()
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Efficacy |
1.96 |
0.025 |
0.7941 |
0.9 |
0.025 |
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt()
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Futility |
-1.17 |
0.8798 |
1.5353 |
0.0341 |
0.1202 |
Efficacy |
2.68 |
0.0037 |
0.3765 |
0.0217 |
0.0037 |
Futility |
-0.66 |
0.7452 |
1.2319 |
0.0664 |
0.2664 |
Efficacy |
2.29 |
0.0110 |
0.4846 |
0.0886 |
0.0121 |
Futility |
-0.22 |
0.5881 |
1.0650 |
0.1002 |
0.4319 |
Efficacy |
2.03 |
0.0212 |
0.5631 |
0.2071 |
0.0250 |
gs_power_combo() %>%
summary() %>%
as_gt()
Bound summary for MaxCombo design |
MaxCombo approximation |
Bound |
Z |
Nominal p |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Futility |
-1 |
0.8413 |
0.0293 |
0.0000 |
Efficacy |
3 |
0.0013 |
0.0175 |
0.0013 |
Futility |
0 |
0.5000 |
0.0314 |
0.0000 |
Efficacy |
2 |
0.0228 |
0.7261 |
0.0233 |
Futility |
1 |
0.1587 |
0.0326 |
0.0000 |
Efficacy |
1 |
0.1587 |
0.9674 |
0.1956 |
gs_design_rd() %>%
summary() %>%
as_gt()
Bound summary of Binary Endpoint |
measured by risk difference |
Bound |
Z |
Nominal p |
~Risk difference at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Analysis: 1 N: 2423.1 Risk difference: 0.05 Information fraction: 1 |
---|
Efficacy |
1.96 |
0.025 |
0.0302 |
0.9 |
0.025 |
gs_power_rd() %>%
summary() %>%
as_gt()
Bound summary of Binary Endpoint |
measured by risk difference |
Bound |
Z |
Nominal p |
~Risk difference at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Analysis: 1 N: 40 Risk difference: 0.05 Information fraction: 0.67 |
---|
Futility |
-1.28 |
0.9000 |
-0.1537 |
0.0444 |
0.1000 |
Efficacy |
3.71 |
0.0001 |
0.4448 |
0.0005 |
0.0001 |
Analysis: 2 N: 50 Risk difference: 0.05 Information fraction: 0.83 |
---|
Efficacy |
2.51 |
0.0060 |
0.2693 |
0.0204 |
0.0060 |
Analysis: 3 N: 60 Risk difference: 0.05 Information fraction: 1 |
---|
Efficacy |
1.99 |
0.0231 |
0.1951 |
0.0705 |
0.0238 |
# Example 2 ----
# Usage of title = ..., subtitle = ...
# to edit the title/subtitle
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt(
title = "Bound Summary",
subtitle = "from gs_power_wlr"
)
Bound Summary |
from gs_power_wlr |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Futility |
-1.17 |
0.8798 |
1.5353 |
0.0341 |
0.1202 |
Efficacy |
2.68 |
0.0037 |
0.3765 |
0.0217 |
0.0037 |
Futility |
-0.66 |
0.7452 |
1.2319 |
0.0664 |
0.2664 |
Efficacy |
2.29 |
0.0110 |
0.4846 |
0.0886 |
0.0121 |
Futility |
-0.22 |
0.5881 |
1.0650 |
0.1002 |
0.4319 |
Efficacy |
2.03 |
0.0212 |
0.5631 |
0.2071 |
0.0250 |
# Example 3 ----
# Usage of colname_spanner = ..., colname_spannersub = ...
# to edit the spanner and its sub-spanner
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt(
colname_spanner = "Cumulative probability to cross boundaries",
colname_spannersub = c("under H1", "under H0")
)
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative probability to cross boundaries
|
---|
under H1 |
under H0 |
---|
Futility |
-1.17 |
0.8798 |
1.5353 |
0.0341 |
0.1202 |
Efficacy |
2.68 |
0.0037 |
0.3765 |
0.0217 |
0.0037 |
Futility |
-0.66 |
0.7452 |
1.2319 |
0.0664 |
0.2664 |
Efficacy |
2.29 |
0.0110 |
0.4846 |
0.0886 |
0.0121 |
Futility |
-0.22 |
0.5881 |
1.0650 |
0.1002 |
0.4319 |
Efficacy |
2.03 |
0.0212 |
0.5631 |
0.2071 |
0.0250 |
# Example 4 ----
# Usage of footnote = ...
# to edit the footnote
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt(
footnote = list(
content = c(
"approximate weighted hazard ratio to cross bound.",
"wAHR is the weighted AHR.",
"the crossing probability.",
"this table is generated by gs_power_wlr."
),
location = c("~wHR at bound", NA, NA, NA),
attr = c("colname", "analysis", "spanner", "title")
)
)
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Futility |
-1.17 |
0.8798 |
1.5353 |
0.0341 |
0.1202 |
Efficacy |
2.68 |
0.0037 |
0.3765 |
0.0217 |
0.0037 |
Futility |
-0.66 |
0.7452 |
1.2319 |
0.0664 |
0.2664 |
Efficacy |
2.29 |
0.0110 |
0.4846 |
0.0886 |
0.0121 |
Futility |
-0.22 |
0.5881 |
1.0650 |
0.1002 |
0.4319 |
Efficacy |
2.03 |
0.0212 |
0.5631 |
0.2071 |
0.0250 |
# Example 5 ----
# Usage of display_bound = ...
# to either show efficacy bound or futility bound, or both(default)
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt(display_bound = "Efficacy")
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Z |
Nominal p |
~wHR at bound |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Efficacy |
2.68 |
0.0037 |
0.3765 |
0.0217 |
0.0037 |
Efficacy |
2.29 |
0.0110 |
0.4846 |
0.0886 |
0.0121 |
Efficacy |
2.03 |
0.0212 |
0.5631 |
0.2071 |
0.0250 |
# Example 6 ----
# Usage of display_columns = ...
# to select the columns to display in the summary table
gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>%
summary() %>%
as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability"))
Bound summary for WLR design |
WLR approximation of ~wHR at bound |
Bound |
Nominal p |
Z |
Cumulative boundary crossing probability
|
---|
Alternate hypothesis |
Null hypothesis |
---|
Futility |
0.8798 |
-1.17 |
0.0341 |
0.1202 |
Efficacy |
0.0037 |
2.68 |
0.0217 |
0.0037 |
Futility |
0.7452 |
-0.66 |
0.0664 |
0.2664 |
Efficacy |
0.0110 |
2.29 |
0.0886 |
0.0121 |
Futility |
0.5881 |
-0.22 |
0.1002 |
0.4319 |
Efficacy |
0.0212 |
2.03 |
0.2071 |
0.0250 |
# }