Description Usage Arguments Value Examples
shrinkDSM
samples from the joint posterior distribution of the parameters of a timevarying
parameter survival model with shrinkage and returns the MCMC draws.
See also shrinkTVP
to see more examples of how to modify the prior setup of the timevarying
component of the model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  shrinkDSM(
formula,
data,
mod_type = "double",
delta,
S,
group,
subset,
niter = 10000,
nburn = round(niter/2),
nthin = 1,
learn_a_xi = TRUE,
learn_a_tau = TRUE,
a_xi = 0.1,
a_tau = 0.1,
learn_c_xi = TRUE,
learn_c_tau = TRUE,
c_xi = 0.1,
c_tau = 0.1,
a_eq_c_xi = FALSE,
a_eq_c_tau = FALSE,
learn_kappa2_B = TRUE,
learn_lambda2_B = TRUE,
kappa2_B = 20,
lambda2_B = 20,
hyperprior_param,
sv_param,
MH_tuning,
display_progress = TRUE
)

formula 
an object of class "formula": a symbolic representation of the model, as in the
function 
data 
optional data frame containing the response variable and the covariates. If not found in 
mod_type 
character string that reads either 
delta 
The status indicator of the last period, 0=censored or 1=event observed. 
S 
integer vector of time points that start a new interval. Parameters are fixed within an interval and vary across intervals. 
group 
optional grouping indicator for latent factor. 
subset 
optional vector specifying a subset of observations to be used in the fitting process. 
niter 
positive integer, indicating the number of MCMC iterations
to perform, including the burnin. Has to be larger than or equal to 
nburn 
nonnegative integer, indicating the number of iterations discarded
as burnin. Has to be smaller than or equal to 
nthin 
positive integer, indicating the degree of thinning to be performed. Every 
learn_a_xi 
logical value indicating whether to learn a_xi, the spike parameter of the state variances.
The default value is 
learn_a_tau 
logical value indicating whether to learn a_tau, the spike parameter of the mean of the
initial values of the states. The default value is 
a_xi 
positive, real number, indicating the (fixed) value for a_xi. Ignored if

a_tau 
positive, real number, indicating the (fixed) value for a_tau. Ignored if

learn_c_xi 
logical value indicating whether to learn c_xi, the tail parameter of the state variances.
Ignored if 
learn_c_tau 
logical value indicating whether to learn c_tau, the tail parameter of the mean of the
initial values of the states. Ignored if 
c_xi 
positive, real number, indicating the (fixed) value for c_xi. Ignored if

c_tau 
positive, real number, indicating the (fixed) value for c_tau. Ignored if

a_eq_c_xi 
logical value indicating whether to force 
a_eq_c_tau 
logical value indicating whether to force 
learn_kappa2_B 
logical value indicating whether to learn kappa2_B, the global level of shrinkage for
the state variances. The default value is 
learn_lambda2_B 
logical value indicating whether to learn the lambda2_B parameter,
the global level of shrinkage for the mean of the initial values of the states. The default value is 
kappa2_B 
positive, real number. Initial value of kappa2_B. The default value is 20. 
lambda2_B 
positive, real number. Initial value of lambda2_B. The default value is 
hyperprior_param 
optional named list containing hyperparameter values. Not all have to be supplied, with those missing being replaced by the default values. Any list elements that are misnamed will be ignored and a warning will be thrown. All hyperparameter values have to be positive, real numbers. The following hyperparameters can be supplied:

sv_param 
optional named list containing hyperparameter values for the stochastic volatility
parameters. Not all have to be supplied, with those missing being replaced by the default values.
Any list elements that are misnamed will be ignored and a warning will be thrown. Ignored if

MH_tuning 
optional named list containing values used to tune the MH steps for

display_progress 
logical value indicating whether the progress bar and other informative output should be
displayed. The default value is 
The value returned is a list object of class shrinkDSM
containing











(optional) 

(optional) 

(optional) 

(optional) 

(optional) 

(optional) 

(optional) 

(optional) 

(optional) named list containing statistics for assessing MH performance. Not returned if no MH steps are required or none of them are specified to be adaptive. 






To display the output, use plot
and summary
. The summary
method displays the specified prior values stored in
priorvals
and the posterior summaries stored in summaries
, while the plot
method calls coda
's plot.mcmc
or the plot.mcmc.dsm.tvp
method. Furthermore, all functions that can be applied to coda::mcmc
objects
(e.g. coda::acfplot
) can be applied to all output elements that are coda
compatible.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  set.seed(123)
data("gastric")
# Create intervals for piecewise exponential model
intervals < divisionpoints(gastric$time, gastric$status, 2)
# Estimate baseline model
mod < shrinkDSM(time ~ radiation, gastric,
delta = gastric$status, S = intervals)
# Estimate model with different prior setup
mod2 < shrinkDSM(time ~ radiation, gastric,
delta = gastric$status, S = intervals,
mod_type = "triple")
# Change some of the hyperparameters
mod3 < shrinkDSM(time ~ radiation, gastric,
delta = gastric$status, S = intervals,
mod_type = "triple",
hyperprior_param = list(beta_a_xi = 5,
alpha_a_xi = 10))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.