prior_sample_hazard {survextrap} | R Documentation |
Generate and/or plot a sample from the prior distribution of M-spline hazard curves
Description
Generates and/or plots the hazard curves (as functions of time) implied by a prior mean for the spline coefficients (a constant hazard by default) and particular priors for the baseline log hazard and smoothness standard deviation.
Usage
prior_sample_hazard(
knots = NULL,
df = 10,
degree = 3,
bsmooth = TRUE,
coefs_mean = NULL,
prior_hsd = p_gamma(2, 1),
prior_hscale = NULL,
smooth_model = "exchangeable",
prior_loghr = NULL,
formula = NULL,
cure = NULL,
nonprop = NULL,
newdata = NULL,
newdata0 = NULL,
prior_hrsd = NULL,
tmin = 0,
tmax = 10,
nsim = 10
)
plot_prior_hazard(
knots = NULL,
df = 10,
degree = 3,
bsmooth = TRUE,
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 = p_gamma(2, 1),
tmin = 0,
tmax = NULL,
nsim = 10
)
Arguments
knots |
Vector of knot locations. If not supplied, The number of knots (excluding zero) is |
df |
Desired number of basis terms, or "degrees of freedom"
in the spline. If |
degree |
Spline polynomial degree. Can only be changed from
the default of 3 if |
bsmooth |
If |
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. |
newdata0 |
A data frame with one row, containing "reference"
values of variables in the model formulae. The hazard ratio
between the hazards at |
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 |
Value
A tidy data frame containing values of the hazard at a sequence of times, for different draws from the prior distribution.