prop_to_haz {goldilocks} | R Documentation |
Estimate plausible piecewise constant hazard rates from summary summary event proportions
Description
Given estimates of the event probability at one or more fixed times, the corresponding piecewise hazard rates can be determined through closed-form formulae. This utility function can be useful when simulating trial datasets with plausible event rates.
Usage
prop_to_haz(probs, cutpoints = 0, endtime)
Arguments
probs |
vector. Probabilities of the event (i.e. cumulative incidence
probabilities) at one or more time point. If only a single value is given,
then it is assumed that this is the probability at the |
cutpoints |
vector. Times at which the baseline hazard changes. Default
is |
endtime |
scalar. Time at which final element in |
Details
Given J-1
internal cut-points, then there are J intervals
defined as: [s_0, s_1)
, [s_1, s_2)
, \dots
, [s_{J-1},
s_{J})
, with conditions that s_0 = 0
and s_J = \infty
. Each
interval corresponds to constant hazard \lambda_j
.
Value
Vector of constant hazard rates for each time piece defined by
cutpoints
.
Examples
lambda <- prop_to_haz(0.15, endtime = 36) # 15% probability at 36-months
all.equal(pexp(36, lambda), 0.15)
# 15% probability at 12-months, and 30% at 24-months
prop_to_haz(c(0.15, 0.30), c(0, 12), 24)
PWEALL::pwe(12, prop_to_haz(c(0.15, 0.30), c(0, 12), 24), c(0, 12))$dist
PWEALL::pwe(24, prop_to_haz(c(0.15, 0.30), c(0, 12), 24), c(0, 12))$dist