Learn R Programming

gsDesign2 (version 1.1.2)

to_integer: Rounds sample size to an even number for equal design

Description

Rounds sample size to an even number for equal design

Usage

to_integer(x, ...)

# S3 method for fixed_design to_integer(x, sample_size = TRUE, ...)

# S3 method for gs_design to_integer(x, sample_size = TRUE, ...)

Value

A list similar to the output of fixed_design_xxx() and gs_design_xxx(), except the sample size is an integer.

Arguments

x

An object returned by fixed_design_xxx() and gs_design_xxx().

...

Additional parameters (not used).

sample_size

Logical, indicting if ceiling sample size to an even integer.

Examples

Run this code
library(dplyr)
library(gsDesign2)

# Average hazard ratio
# \donttest{
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 %>% to_integer()

# FH
x <- fixed_design_fh(
  alpha = 0.025, power = 0.9,
  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
  ),
  rho = 0.5, gamma = 0.5,
  study_duration = 36, ratio = 1
)
x %>% to_integer()

# MB
x <- fixed_design_mb(
  alpha = 0.025, power = 0.9,
  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
  ),
  tau = 4,
  study_duration = 36, ratio = 1
)
x %>% to_integer()
# }
# \donttest{
gs_design_ahr() %>% to_integer()
# }
# \donttest{
gs_design_wlr() %>% to_integer()
# }

Run the code above in your browser using DataLab