Test 1
enrollRates <- tibble(duration = c(2, 1, 2), rate = c(5, 10, 20))
failRates <- tibble(duration = c(1, 1, 1),failRate = c(.05, .02, .01), dropoutRate = .01)
totalDuration <- 20
x1 <- gsDesign::eEvents(lambda = failRates$failRate,
S = failRates$duration[1 : (nrow(failRates) - 1)],
eta = failRates$dropoutRate,
gamma = enrollRates$rate,
R = enrollRates$duration,
T = totalDuration)$d
x2 <- eEvents_df_(enrollRates, failRates, totalDuration, simple = TRUE)
x3 <- eEvents_df(enrollRates, failRates, totalDuration, simple = TRUE)
tibble(method = c("gsDesign", "old version", "new version"),
exp_events = c(x1, x2, x3)) %>% gt()
method | exp_events |
---|---|
gsDesign | 11.02302 |
old version | 11.02302 |
new version | 11.02302 |
Test 2
enrollRates <- tibble(duration = c(1, 1, 8), rate = c(3, 2, 0))
failRates <- tibble(duration = c(4, Inf), failRate = c(.03, .06), dropoutRate = c(.001, .002))
totalDuration <- 7
x <- eEvents_df(enrollRates, failRates, totalDuration, simple = FALSE) %>% data.frame()
# expected checked with alternate calculations in gsSurvNPH vignette
y <- data.frame(t = c(0, 4), failRate = c(0.03, 0.06), Events = c(0.5642911, 0.5194821))
x %>% gt() %>% tab_header(title = "From gsDesign2 new version")
From gsDesign2 new version | ||
t | failRate | Events |
---|---|---|
0 | 0.03 | 0.5642911 |
4 | 0.06 | 0.5194821 |
y %>% gt() %>% tab_header(title = "From gsSurvNPH vignette")
From gsSurvNPH vignette | ||
t | failRate | Events |
---|---|---|
0 | 0.03 | 0.5642911 |
4 | 0.06 | 0.5194821 |