## [1] "/home/zhayuji4/Rtemp/test_temp/gsDesign2-merck/inst"
## [1] "AHR_.R" "eEvents_.R"
## [3] "eEvents_df_.R" "gridpts_h1_hupdate_oldR.R"
## [5] "gs_design_ahr_.R" "gs_design_npe_.R"
## [7] "gs_power_ahr_.R" "gs_power_npe_.R"
## [9] "tEvents_.R"
## ./old_function/AHR_.R ./old_function/eEvents_.R
## value ? ?
## visible FALSE FALSE
## ./old_function/eEvents_df_.R ./old_function/gridpts_h1_hupdate_oldR.R
## value ? ?
## visible FALSE FALSE
## ./old_function/gs_design_ahr_.R ./old_function/gs_design_npe_.R
## value ? ?
## visible FALSE FALSE
## ./old_function/gs_power_ahr_.R ./old_function/gs_power_npe_.R
## value ? ?
## visible FALSE FALSE
## ./old_function/tEvents_.R
## value ?
## visible FALSE
Test 1
In this test, we verify tEvents()
by
AHR()
.
enrollRates <- tibble(Stratum = "All", duration = c(2, 2, 10), rate = c(3, 6, 9) * 5)
failRates <- tibble(Stratum = "All", duration = c(3, 100), failRate = log(2) / c(9, 18),
hr = c(.9, .6), dropoutRate = rep(.001, 2))
ratio <- 1
x <- AHR_(enrollRates = enrollRates,
failRates = failRates,
ratio = ratio, totalDuration = 20)
cat("The number of events by 20 months is ", x$Events, ".\n")
## The number of events by 20 months is 208.3641 .
y <- tEvents(enroll_rate = enrollRates,
fail_rate = failRates %>% rename(fail_rate = failRate, dropout_rate = dropoutRate),
ratio = ratio, target_event = x$Events)
cat("The time to get ", x$Events, " is ", y$Time, "months.\n")
## The time to get 208.3641 is 20 months.
Test 2
x1 <- tEvents()
x2 <- tEvents_()
x1 %>%
union_all(x2) %>%
mutate(`function comes from` = c("new version", "old version")) %>%
select(`function comes from`, Time, AHR, Events, info, info0) %>%
gt::gt()
function comes from |
Time |
AHR |
Events |
info |
info0 |
new version |
14.90814 |
0.7865729 |
150 |
36.86707 |
37.5 |
old version |
14.90814 |
0.7865729 |
150 |
36.86707 |
37.5 |
Test 3
enrollRates <- tibble(Stratum = "All", duration = c(2, 2, 10), rate = c(3, 6, 9) * 5)
failRates <- tibble(Stratum = "All", duration = c(3, 100),
failRate = log(2) / c(9, 18), hr = c(.9, .6),
dropoutRate = rep(.001, 2))
ratio <- 1
x1 <- tEvents(enroll_rate = enrollRates,
fail_rate = failRates %>% rename(fail_rate = failRate, dropout_rate = dropoutRate),
ratio = ratio,
target_event = 200)
x2 <- tEvents_(enrollRates = enrollRates,
failRates = failRates,
ratio = ratio,
targetEvents = 200)
x1 %>%
union_all(x2) %>%
mutate(`function comes from` = c("new version", "old version")) %>%
select(`function comes from`, Time, AHR, Events, info, info0) %>%
gt::gt()
function comes from |
Time |
AHR |
Events |
info |
info0 |
new version |
19.16437 |
0.7442008 |
200 |
48.9497 |
50 |
old version |
19.16437 |
0.7442008 |
200 |
48.9497 |
50 |