Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 4)
## ----setup--------------------------------------------------------------------
library(DesignComplexSurvival)
## ----models-------------------------------------------------------------------
ctl <- ms_model(time = c(0, 4), prog = c(0.10, 0.08), death = 0.01,
switch_prob = 0.3, death_prog = 0.06, switch_rate = 0.04,
death_switch = 0.035, dropout = 0.003, clock = "forward")
trt <- ms_model(time = c(0, 4), prog = c(0.06, 0.05), death = 0.008,
death_prog = 0.055, dropout = 0.003, clock = "forward")
acc <- ms_accrual(rate = 25)
looks <- ms_looks("os", fraction = c(0.6, 1))
## ----power-by-start-----------------------------------------------------------
starts <- c(0, 6, 12, 18, 24)
res <- lapply(starts, function(s)
ms_power(ms_scenario(ctl, trt, accrual = acc, switch_start = s), n = 500,
looks = looks, test = ms_test(), events = 300))
tab <- data.frame(switch_start = starts,
power = sapply(res, function(x) x$power),
type1 = sapply(res, function(x) x$type1[["nonbinding"]]),
interim = sapply(res, function(x) x$looks$time[1]),
final = sapply(res, function(x) x$study_duration))
knitr::kable(tab, digits = c(0, 4, 5, 1, 1))
## ----power-plot, fig.alt = "Power of the OS test by the calendar time from which switching is possible"----
plot(tab$switch_start, tab$power, type = "b", pch = 19,
xlab = "Calendar month from which switching is possible", ylab = "Power")
## ----scope--------------------------------------------------------------------
scn12 <- ms_scenario(ctl, trt, accrual = acc, switch_start = 12)
err <- function(expr) tryCatch({
expr
"no error"
}, error = conditionMessage)
err(ms_power(scn12, n = 500, looks = looks, test = ms_test(mean = "schoenfeld"),
events = 300))
err(ms_power(scn12, n = 500, looks = ms_looks("pfs", fraction = c(0.6, 1)),
test = ms_test(), events = 300))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.