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
numericvector: the minimum hazard ratio of interest- power
A
numericvector: the statistical power of interest- alpha
A
numericvector: Type I Error probability- test_sides
A
numericvector: Number of sides for test (1 or 2)- ratio
A
numericvector: the allocation ratio of treatment to control, i.e. for an \(r:1\) trial,ratio= \(r\).- events
A
numericvector: the number of observed events
Value
a numeric vector or data.frame, depending on whether
arguments are specified as scalars or vectors.
Details
The function hr_design takes in user input, and depending on the
arguments supplied, calls the appropriate function depending on whether the
number of pooled events observed (hr_events), power (hr_power),
Type I Error (hr_alpha), or relative risk (hr_minimal) is left
unspecified.
References
Schoenfeld, DA. 1983. "Sample-Size Formula for the Proportional-Hazards Regression Model." Biometrics 39 (2): 499. https://doi.org/10.2307/2531021.
See also
stats::power.t.test() for design calculations for a difference in
means, stats::power.prop.test() for design calculations for a difference in
proportions, rr_design() for design calculations for a relative
risk estimand.
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