cure_rate_MC3 {bayesCureRateModel} | R Documentation |
Main function of the package
Description
Runs a Metropolis Coupled MCMC (MC^3
) sampler in order to estimate the joint posterior distribution of the model.
Usage
cure_rate_MC3(y, X, Censoring_status, nChains = 12, mcmc_cycles = 15000,
alpha = NULL,nCores = 1, sweep = 5, mu_g = 1, s2_g = 1,
a_l = 2.1, b_l = 1.1, mu_b = rep(0, dim(X)[2]),
Sigma = 100 * diag(dim(X)[2]), g_prop_sd = 0.045,
lambda_prop_scale = 0.03, b_prop_sd = rep(0.022, dim(X)[2]),
initialValues = NULL, plot = TRUE, adjust_scales = FALSE,
verbose = FALSE, tau_mala = 1.5e-05, mala = 0.15,
promotion_time = list(distribution = "weibull",
prior_parameters = matrix(rep(c(2.1, 1.1), 2), byrow = TRUE, 2, 2),
prop_scale = c(0.1, 0.2)), single_MH_in_f = 0.2)
Arguments
y |
Observed data, that is, a vector of length |
X |
Design matrix with |
Censoring_status |
A vector |
nChains |
Positive integer corresponding to the number of heated chains in the MC |
mcmc_cycles |
Length of the generated MCMC sample. Default value: 15000. Note that each MCMC cycle consists of |
alpha |
A decreasing sequence in |
nCores |
The number of cores used for parallel processing. In case where |
sweep |
The number of usual MCMC iterations per MCMC cycle. Default value: 10. |
mu_g |
Parameter |
s2_g |
Parameter |
a_l |
Shape parameter |
b_l |
Scale parameter |
mu_b |
Mean ( |
Sigma |
Covariance matrix of the multivariate normal prior distribution of regression coefficients. |
g_prop_sd |
The scale of the proposal distribution for single-site updates of the |
lambda_prop_scale |
The scale of the proposal distribution for single-site updates of the |
b_prop_sd |
The scale of the proposal distribution for the update of the |
initialValues |
A list of initial values for each parameter (optional). |
plot |
Plot MCMC sample on the run. Default: TRUE. |
adjust_scales |
Boolean. If TRUE the MCMC sampler runs an initial phase of a small number of iterations in order to tune the scale of the proposal distributions in the Metropolis-Hastings steps. |
verbose |
Print progress on the terminal if TRUE. |
tau_mala |
Scale of the Metropolis adjusted Langevin diffussion proposal distribution. |
mala |
A number between |
promotion_time |
A list with details indicating the parametric family of distribution describing the promotion time and corresponding prior distributions. See 'details'. |
single_MH_in_f |
The probability for attempting a series of single site updates in the typical Metropolis-Hastings move. Otherwise, with probability 1 - |
Details
It is advised to scale all continuous explanatory variables in the design matrix, so their sample mean and standard deviations are equal to 0 and 1, respectively.
The promotion_time
argument should be a list containing the following entries
distribution
Character string specifying the family of distributions
\{F(\cdot;\boldsymbol\alpha);\boldsymbol\alpha\in\mathcal A\}
describing the promotion time.prior_parameters
Values of hyper-parameters in the prior distribution of the parameters
\boldsymbol\alpha
.prop_scale
The scale of the proposal distributions for each parameter in
\boldsymbol\alpha
.dirichlet_concentration_parameter
Relevant only in the case of the
'gamma_mixture'
. Positive scalar (typically, set to 1) determining the (common) concentration parameter of the Dirichlet prior distribution of mixing proportions.
The distribution
entry should be one of the following: 'exponential'
, 'weibull'
, 'gamma'
, 'logLogistic'
, 'gompertz'
, 'lomax'
, 'dagum'
, 'gamma_mixture'
.
The joint prior distribution of \boldsymbol\alpha = (\alpha_1,\ldots,\alpha_d)
factorizes into products of inverse Gamma distributions for all (positive) parameters of F
. Moreover, in the case of 'gamma_mixture'
, the joint prior also consists of another term to the Dirichlet prior distribution on the mixing proportions.
The prop_scale
argument should be a vector with length equal to the length of vector d
(number of elements in \boldsymbol\alpha
), containing (positive) numbers which correspond to the scale of the proposal distribution. Note that these scale parameters are used only as initial values in case where adjust_scales = TRUE
.
Value
An object of class bayesCureModel
, i.e. a list with the following entries
mcmc_sample |
Object of class
|
complete_log_likelihood |
The complete log-likelihood for the target chain. |
all_cll_values |
The complete log-likelihood for all chains |
latent_status_censored |
A data frame with the simulated binary latent status for each censored item. |
swap_accept_rate |
the acceptance rate of proposed swappings between adjacent MCMC chains. |
input_data_and_model_prior |
the input data and specification of the prior parameters. |
log_posterior |
the logarithm of the posterior distribution, up to a normalizing constant. |
map_estimate |
The Maximum A Posterior estimate of parameters |
BIC |
Bayesian Information Criterion. |
AIC |
Akaike Information Criterion. |
Note
The core function is cure_rate_mcmc
.
Author(s)
Panagiotis Papastamoulis
References
Papastamoulis and Milienos (2023). Bayesian inference and cure rate modeling for event history data. arXiv:2310.06926
See Also
Examples
# simulate toy data just for cran-check purposes
set.seed(10)
n = 4
stat = rbinom(n, size = 1, prob = 0.5)
x <- cbind(1, matrix(rnorm(2*n), n, 2))
y <- rexp(n)
fit1 <- cure_rate_MC3(y = y, X = x, Censoring_status = stat,
promotion_time = list(distribution = 'weibull'),
nChains = 2, nCores = 1,
mcmc_cycles = 3, sweep = 2)