Skip to contents

This is a function for designing a study with a time-to-event outcome whose inferential target is the hazard ratio. hr_design() will calculate the minimum number of events, minimum hazard ratio, power, or Type I error when the other arguments are specified.

Usage

hr_events(hazard_ratio, power = 0.8, alpha = 0.05, test_sides = 2, ratio = 1)

hr_power(events, hazard_ratio, alpha = 0.05, test_sides = 2, ratio = 1)

hr_alpha(events, hazard_ratio, power = 0.8, test_sides = 2, ratio = 1)

hr_minimal(events, power = 0.8, alpha = 0.05, test_sides = 2, ratio = 1)

hr_design(
  events = NULL,
  hazard_ratio = NULL,
  power = NULL,
  alpha = NULL,
  test_sides = 2,
  ratio = 1
)

Arguments

hazard_ratio

A numeric vector: the minimum hazard ratio of interest

power

A numeric vector: the statistical power of interest

alpha

A numeric vector: Type I Error probability

test_sides

A numeric vector: Number of sides for test (1 or 2)

ratio

A numeric vector: the allocation ratio of treatment to control, i.e. for an \(r:1\) trial, ratio = \(r\).

events

A numeric vector: the number of observed events

Value

a numeric vector or data.frame, depending on whether arguments are specified as scalars or vectors.

Examples

# Number of Events
hr_design(
  hazard_ratio = 0.75,
  power = 0.80,
  alpha = 0.05,
  test_sides = 2
)
#> [1] 379.3517

# Power
hr_design(
  events = 400,
  hazard_ratio = 0.75,
  alpha = 0.05,
  test_sides = 2
)
#> [1] 0.8203911

# Type I Error
hr_design(
  events = 400,
  hazard_ratio = 0.75,
  power = 0.80,
  test_sides = 2
)
#> [1] 0.0418308

# Hazard Ratio
hr_design(
  events = 400,
  power = 0.80,
  alpha = 0.05,
  test_sides = 2
)
#>   hazard_ratio hazard_ratio_inv
#> 1    0.7556639          1.32334