size_two_arm: Sample size

View source: R/calc_power_and_sample_size.R

size_two_armR Documentation

Sample size

Description

Calculate required sample size and expected number of events for a two-arm survival study.

Usage

size_two_arm(
  arm0,
  arm1,
  test = list(test = "weighted logrank"),
  power = 0.8,
  alpha = 0.025,
  sides = 1
)

Arguments

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", "freedman", "rubinstein") 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 (2020). If there are multiple lists, then users may provide a 'label' for each list to be displayed in the output.

power

1 - type 2 error rate

alpha

type 1 error rate

sides

1=1-sided test, 2=2-sided test

Value

n0

sample size for arm0

n1

sample size for arm1

n

total sample size

d0

expected number of events for arm0

d1

expected number of events for arm1

d

total expected number of events; can be used to convert a time-driven trial to an event-driven trial.

References

Yung, G and Liu, Y. (2020). Sample size and power for the weighted log-rank test and Kaplan-Meier based tests with allowance for non-proportional hazards. Biometrics 76(3):939-950.

See Also

create_arm for creating an object of class 'arm'.

Examples

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", label="Logrank"),
  list(test="survival difference", milestone=12, label="12-month survival difference")))

npsurvSS documentation built on May 29, 2024, 11:23 a.m.