View source: R/multiple_endpoints.R
me_both_the_two | R Documentation |
Double continuous co-primary outcomes
me_both_the_two(
deltas = c(0.2, 0.2),
sds = c(1, 1),
corr = 0.5,
sig_level = 0.025,
power = 0.8
)
## example page pag 20 sozu, sugimoto, hamasaki evans (sample size determination
## in clinical tirals with multiple endpoint)
me_both_the_two(deltas = c(0.47, 0.48), corr = 0) # 92 in the book
me_both_the_two(deltas = c(0.47, 0.48), corr = 0.3) # 90 in the book
me_both_the_two(deltas = c(0.47, 0.48), corr = 0.5) # 87 in the book
me_both_the_two(deltas = c(0.47, 0.48), corr = 0.8) # 82 in the book
## table 2.1 pag 14 (for power = 0.8)
d1 <- d2 <- seq(0.2, 0.4, by = 0.05)
corrs <- c(0, 0.3, 0.5, 0.8, 1)
cases <- expand.grid("d1" = d1, "d2" = d2, "rho" = corrs)
cases <- cases[with(cases, d1 <= d2), ]
cases <- cases[with(cases, order(d1, d2, rho)), ]
cases$sample_size <- apply(cases, 1, function(row){
me_both_the_two(deltas = c(row[1], row[2]), corr = row[3])
})
tab21 <- reshape(cases, timevar = "rho", direction = "wide", idvar = c("d1", "d2"))
tab21$E1 <- apply(tab21, 1, function(row){
round(power.t.test(delta = row[1], sig.level = 0.025, power = 0.8,
alternative = 'one.sided')$n)
})
tab21$E2 <- apply(tab21, 1, function(row){
round(power.t.test(delta = row[2], sig.level = 0.025, power = 0.8,
alternative = 'one.sided')$n)
})
tab21
## check of not standardized effects measures: all must be equal
me_both_the_two(deltas = c(0.5, 0.5), sds = c(1,1))
me_both_the_two(deltas = c(1, 1), sds = c(2,2))
me_both_the_two(deltas = c(2, 2), sds = c(4,4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.