prior_haz {survextrap} | R Documentation |
Determine priors for time-varying hazards and hazard ratios
Description
Computes consequences of priors chosen for the parameters hsd
and hrsd
in a flexible hazard model survextrap
on
an interpretable scale. This can be used to calibrate Gamma
priors for these parameters to match interpretable beliefs.
Usage
prior_haz_sd(
mspline,
coefs_mean = NULL,
prior_hsd = p_gamma(2, 1),
prior_hscale = p_normal(0, 20),
smooth_model = "exchangeable",
prior_loghr = NULL,
formula = NULL,
cure = NULL,
nonprop = NULL,
newdata = NULL,
prior_hrsd = NULL,
tmin = 0,
tmax = NULL,
nsim = 1000,
hq = c(0.1, 0.9),
quantiles = c(0.025, 0.5, 0.975)
)
prior_hr_sd(
mspline,
coefs_mean = NULL,
prior_hsd = p_gamma(2, 1),
prior_hscale = p_normal(0, 20),
smooth_model = "exchangeable",
prior_loghr = NULL,
formula = NULL,
cure = NULL,
nonprop = NULL,
newdata = NULL,
newdata0 = NULL,
prior_hrsd = NULL,
tmin = 0,
tmax = 10,
nsim = 100,
hq = c(0.1, 0.9),
quantiles = c(0.025, 0.5, 0.975)
)
Arguments
mspline |
A list of control parameters defining the spline model.
If there are external data, and both
|
coefs_mean |
Spline basis coefficients that define the prior
mean for the hazard function. By default, these are set to values
that define a constant hazard function (see
|
prior_hsd |
Gamma prior for the standard deviation that
controls the variability over time (or smoothness) of the hazard
function. This should be a call to |
prior_hscale |
Prior for the baseline log hazard scale
parameter ( Note that "Baseline" is defined by the continuous covariates taking a value of zero and factor covariates taking their reference level. To use a different baseline, the data should be transformed appropriately beforehand, so that a value of zero has a different meaning. For continuous covariates, it helps for both computation and interpretation to define the value of zero to denote a typical value in the data, e.g. the mean. |
smooth_model |
The default The alternative In non-proportional hazards models, setting |
prior_loghr |
Priors for log hazard ratios. This should be a
call to The default is |
formula |
A survival formula in standard R formula syntax, with a call to Covariates included on the right hand side of the formula with be
modelled with proportional hazards, or if If |
cure |
If |
nonprop |
Non-proportional hazards model specification. This is achieved by modelling the spline basis coefficients in terms of the covariates. See the methods vignette for more details. If If this is a formula, then this is assumed to define a model for the dependence of the basis coefficients on the covariates. IF this is |
newdata |
A data frame with one row, containing variables in the model formulae. Samples will then be drawn, for any covariate-dependent parameters, with covariates set to the values given here. |
prior_hrsd |
Prior for the standard deviation parameters that
smooth the non-proportionality effects over time in
non-proportional hazards models. This should be a call to
|
tmin |
Minimum plotting time. Defaults to zero. |
tmax |
Maximum plotting time. Defaults to the highest knot. |
nsim |
Number of simulations to draw |
hq |
Quantiles which define the "low" and "high" values of a
time-varying quantity (hazard in |
quantiles |
Quantiles used to summarise the implied prior distributions of the simulated quantities. |
newdata0 |
A data frame with one row, containing "reference"
values of variables in the model formulae. The hazard ratio
between the hazards at |
Details
The spline model in survextrap
allows the hazard to
change over time in an arbitrarily flexible manner. The prior
distributions on the parameters of this model have implications
for how much we expect the hazard to plausibly vary over time.
These priors are hard to interpret directly, but this function can
be used to compute their implications on a more
easily-understandable scale.
This is done by:
(1) simulating a set of parameters from their prior distributions
(2) computing the hazard at a fine grid of equally-spaced points spanning the boundary knots
(3) calculating the empirical standard deviation of the set of hazards at these points
(4) repeatedly performing steps 1-3, and summarising the distribution of the resulting standard deviations. This is the implied prior for the hazard variability.
prior_haz_sd
computes the SD of the hazard, and the SD of the inverse hazard is also
computed. The inverse hazard at time t
is the expected time to the event given survival to t
.
The hazard ratio between a high and low value (defined by quantiles of values at different times)
is also computed.
prior_hr_sd
computes the SD of the hazard ratio between two covariate values
supplied by the user.
All of these SDs refer to the variability over time, e.g. a SD of 0 indicates that the hazard (or inverse hazard, or hazard ratio) is constant with time.
Value
A data frame with columns sd_haz
(SD of the hazard),
sd_mean
(SD of the inverse hazard) and hr
(ratio between
high/low hazards) (for prior_haz_sd
), and rows
giving prior quantiles of these.
In prior_hr_sd
, sd_hr
is the SD of hazard ratios
over time, and hrr
is the ratio between high/low hazard ratios.