Skip to contents

Computes fixed design sample size for many sample size methods. Returns a tibble with a basic summary

Usage

fixed_design(
  x = c("AHR", "FH", "MB", "LF", "RD", "MaxCombo", "RMST", "Milestone"),
  alpha = 0.025,
  power = NULL,
  ratio = 1,
  studyDuration = 36,
  ...
)

Arguments

x

Sample size method; default is "AHR"; other options include "FH", "MB", "LF", "RD", "MaxCombo", "Milestone".

alpha

One-sided Type I error (strictly between 0 and 1)

power

Power (NULL to compute power or strictly between 0 and 1 - alpha otherwise)

ratio

Experimental:Control randomization ratio

studyDuration

study duration

...

additional arguments like enrollRates, failRates, rho, gamma, tau

Value

a table

Examples

library(dplyr)

# Average hazard ratio
x <- fixed_design("AHR", 
                  alpha = .025, power = .9, 
                  enrollRates = tibble::tibble(Stratum = "All",  duration = 18, rate = 1),
                  failRates = tibble::tibble(Stratum = "All", duration = c(4, 100), failRate = log(2) / 12, hr = c(1, .6), dropoutRate = .001),
                  studyDuration = 36)
x %>% summary()            
#> # A tibble: 1 × 7
#>   Design                   N Events  Time Bound alpha Power
#>   <chr>                <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Average hazard ratio  463.   325.    36  1.96 0.025   0.9

# Lachin and Foulkes (uses gsDesign::nSurv())
x <- fixed_design("LF", 
                  alpha = .025, power = .9, 
                  enrollRates = tibble::tibble(Stratum = "All",  duration = 18, rate = 1),
                  failRates = tibble::tibble(Stratum = "All", duration = 100, failRate = log(2) / 12, hr = .7, dropoutRate = .001),
                  studyDuration = 36)
x %>% summary()
#> # A tibble: 1 × 7
#>   Design                 N Events  Time Bound alpha Power
#>   <chr>              <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Lachin and Foulkes  463.   329.    36  1.96 0.025   0.9

# RMST
x <- fixed_design("RMST", alpha = .025, power = .9, 
                  enrollRates = tibble::tibble(Stratum = "All",  duration = 18, rate = 1),
                  failRates = tibble::tibble(Stratum = "All", duration = 100, failRate = log(2) / 12, hr = .7, dropoutRate = .001),
                  studyDuration = 36,
                  tau = 18)
x %>% summary()
#> # A tibble: 1 × 7
#>   Design             N Events  Time Bound alpha Power
#>   <chr>          <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 RMST: tau = 18  671.   477.    36  1.96 0.025   0.9

# Milestone 
x <- fixed_design("Milestone", alpha = .025, power = .9, 
                  enrollRates = tibble::tibble(Stratum = "All",  duration = 18, rate = 1),
                  failRates = tibble::tibble(Stratum = "All", duration = 100, failRate = log(2) / 12, hr = .7, dropoutRate = .001),
                  studyDuration = 36,
                  tau = 18)
x %>% summary()
#> # A tibble: 1 × 7
#>   Design                  N Events  Time Bound alpha Power
#>   <chr>               <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Milestone: tau = 18  606.   431.    36  1.96 0.025   0.9