hazard_ratio {survextrap} | R Documentation |
Hazard ratio against time in a survextrap model
Description
Compute the hazard ratio at a series of time points, estimated from
a survextrap
model. Intended for use with
non-proportional hazards models
(survextrap(...,nonprop=TRUE)
). In proportional hazards
models (which survextrap
fits by default) the hazard
ratio is constant with time.
Usage
hazard_ratio(
x,
newdata = NULL,
t = NULL,
tmax = NULL,
niter = NULL,
summ_fns = NULL,
sample = FALSE
)
Arguments
x |
A fitted model object as returned by |
newdata |
A data frame with two rows. The hazard ratio will
be defined as hazard(second row) divided by hazard(first row).
If the only covariate in the model is a factor with two levels,
then Standardisation (with |
t |
Vector of times at which to compute the estimates. |
tmax |
Maximum time at which to compute the estimates. If
|
niter |
Number of MCMC iterations to use to compute credible intervals. Set to a low value to make this function quicker, at the cost of some approximation error (which may not be important for plotting or model development). |
summ_fns |
A list of functions to use to summarise the posterior sample.
This is passed to |
sample |
If |
Value
A data frame (tibble) with each row containing posterior summary statistics for different times.
Or if sample=TRUE
, an array with dimensions
length(t)
, niter
, and 1, giving the
incremental RMST evaluated at different times and MCMC iterations
respectively.