# AHR method ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_ahr(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_ahr(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36
)
x %>% summary()
# WLR test with FH weights ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_fh(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
rho = 1, gamma = 1
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_fh(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
rho = 1, gamma = 1
)
x %>% summary()
# LF method ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_lf(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_fh(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36
)
x %>% summary()
# MaxCombo test ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_maxcombo(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1)
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_maxcombo(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
rho = c(0, 0.5), gamma = c(0, 0), tau = c(-1, -1)
)
x %>% summary()
# WLR test with MB weights ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_mb(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
tau = 4
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_mb(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = c(4, 100),
fail_rate = log(2) / 12,
hr = c(1, .6),
dropout_rate = .001
),
study_duration = 36,
tau = 4
)
x %>% summary()
# Milestone method ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_milestone(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36,
tau = 18
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_milestone(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36,
tau = 18
)
x %>% summary()
# Binary endpoint with risk differences ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_rd(
alpha = 0.025, power = 0.9, p_c = .15, p_e = .1,
rd0 = 0, ratio = 1
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_rd(
alpha = 0.025, power = NULL, p_c = .15, p_e = .1,
rd0 = 0, n = 2000, ratio = 1
)
x %>% summary()
# RMST method ----
library(dplyr)
# Example 1: given power and compute sample size
x <- fixed_design_rmst(
alpha = .025, power = .9,
enroll_rate = define_enroll_rate(duration = 18, rate = 1),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36,
tau = 18
)
x %>% summary()
# Example 2: given sample size and compute power
x <- fixed_design_rmst(
alpha = .025,
enroll_rate = define_enroll_rate(duration = 18, rate = 20),
fail_rate = define_fail_rate(
duration = 100,
fail_rate = log(2) / 12,
hr = .7,
dropout_rate = .001
),
study_duration = 36,
tau = 18
)
x %>% summary()
Run the code above in your browser using DataLab