Description Usage Arguments Value References See Also Examples
View source: R/calc_power_and_sample_size.R
Calculate required sample size and expected number of events for a two-arm survival study.
1 2 | size_two_arm(arm0, arm1, test = list(test = "weighted logrank"),
power = 0.8, alpha = 0.025, sides = 1)
|
arm0 |
object of class 'arm'. |
arm1 |
object of class 'arm'. |
test |
list or list of lists. Each list must contain at minimum the key 'test' describing the type of statistical test. Default test is the "weighted logrank". Kaplan-Meier based tests ("survival difference", "survival ratio", "rmst difference", "rmst ratio", "percentile difference", and "percentile ratio") require the user to define an additional key, either the desired 'milestone' or 'percentile'. The weighted log-rank test does not require additional keys. However, user may choose which weight function ("1"=unweighted, "n"=Gehan-Breslow, "sqrtN"=Tarone-Ware, "FH_[a]_[b]"= Fleming-Harrington with p=a and q=b) and which approximation for the large-sample mean ("asymptotic", "generalized schoenfeld", "event driven") and variance ("1", "block[ randomization]", "simple[ randomization]") they wish to use. Default choice is 'weight'="1", 'mean.approx'="asymptotic", and 'var.approx'="1". For more details regarding the different mean and variance approximations for the weight log-rank test, please see Yung and Liu (in press). |
power |
1 - type 2 error rate |
alpha |
type 1 error rate |
sides |
1=1-sided test, 2=2-sided test |
n0 |
sample size for |
n1 |
sample size for |
n |
total sample size |
d0 |
expected number of events for |
d1 |
expected number of events for |
d |
total expected number of events; can be used to convert a time-driven trial to an event-driven trial. |
Yung, G and Liu, Y. (2019). Sample size and power for the weighted log-rank test and Kaplan-Meier based tests with allowance for non-proportional hazards. Biometrics. <doi:10.1111/biom.13196>
create_arm
for creating an object of class 'arm'.
1 2 3 4 5 6 7 8 9 10 11 12 13 | arm0 <- create_arm(size=120, accr_time=6, surv_scale=0.05, loss_scale=0.005, follow_time=12)
arm1 <- create_arm(size=120, accr_time=6, surv_scale=0.03, loss_scale=0.005, follow_time=12)
size_two_arm(arm0, arm1)
size_two_arm(arm0, arm1, list(test="weighted logrank",
weight="n",
mean.approx="generalized schoenfeld",
var.approx="block"))
size_two_arm(arm0, arm1, list(test="survival difference", milestone=12))
size_two_arm(arm0, arm1, list(test="rmst ratio", milestone=12))
size_two_arm(arm0, arm1, list(test="percentile difference", percentile=0.25))
size_two_arm(arm0, arm1, list(
list(test="weighted logrank"),
list(test="survival difference", milestone=12)))
|
n0 n1 n d0 d1 d
142.41934 142.41934 284.83868 72.47511 49.72759 122.20270
n0 n1 n d0 d1 d
149.96628 149.96628 299.93257 76.31563 52.36271 128.67834
n0 n1 n d0 d1 d
167.78545 167.78545 335.57090 85.38354 58.58450 143.96805
n0 n1 n d0 d1 d
207.1541 207.1541 414.3083 105.4177 72.3306 177.7483
n0 n1 n d0 d1 d
274.83583 274.83583 549.67166 139.85991 95.96255 235.82246
test n0 n1 n d0 d1 d
1 1 142.4193 142.4193 284.8387 72.47511 49.72759 122.2027
2 2 167.7854 167.7854 335.5709 85.38354 58.58450 143.9680
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.