prior_sample | R Documentation |
Draws a sample from the joint prior distribution of the parameters
governing a survextrap model for given covariates. This is used,
for example, in prior_sample_hazard
, to visualise the
prior distribution around hazard curves implied by a particular
M-spline model and parameter priors.
prior_sample(
mspline,
coefs_mean = NULL,
prior_hsd = p_gamma(2, 1),
prior_hscale,
smooth_model = "exchangeable",
prior_loghr = NULL,
formula = NULL,
cure = NULL,
nonprop = NULL,
newdata = NULL,
newdata0 = NULL,
prior_hrsd = NULL,
prior_cure = NULL,
prior_logor_cure = NULL,
nsim = 100
)
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 model formula with no response, defining the covariates on the hazard scale. |
cure |
A model formula with no response, giving any covariates on the cure proportion. |
nonprop |
A model formula with no response, defining any covariates affecting the spline basis coefficients, which gives a nonproportional hazards model. |
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
|
prior_cure |
Prior for the baseline cure probability. This should be a
call to |
prior_logor_cure |
Priors for log odds ratios on cure probabilities.
This should be a call to |
nsim |
Number of simulations to draw |
prior_sample_hazard
returns a data frame of the
samples, and plot_prior_hazard
generates a plot. No
customisation options are provided for the plot function, which
is just intended as a quick check.
A list with components:
alpha
: Baseline log hazard scale parameter (log(eta)
in the notation of the manual). For models with covariates, this is at the covariate values supplied in X
, or at zero if X
is not supplied.
hscale
: Baseline hazard scale parameter (eta
).
coefs
: Spline coefficients. For non-proportional hazards model with covariates, these are returned at the suppled value of X
, or at values of zero if X
is not supplied.
beta
: Multinomial logit-transformed spline coefficients.
hsd
: Smoothing standard deviation for spline coefficients.
If X0
is supplied, then alpha0
, hscale0
, beta0
, coefs0
are also returned, representing reference covariate values.
pcure
is returned in cure models (the cure probability).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.