View source: R/bayesian_cure_rate_model.R
predict.bayesCureModel | R Documentation |
Returns MAP estimates of the survival function and the conditional cured probability for a given set of covariates.
## S3 method for class 'bayesCureModel'
predict(object, newdata = NULL, tau_values = NULL,
burn = NULL, K_max = 1, alpha = 0.1, nDigits = 3, verbose = FALSE, ...)
object |
An object of class |
newdata |
A |
tau_values |
A vector of values for the response variable (time) for returning predictions for each row in the |
burn |
Positive integer corresponding to the number of mcmc iterations to discard as burn-in period |
K_max |
Maximum number of components in order to cluster the (univariate) values of the joint posterior distribution across the MCMC run. Used to identify the main mode of the posterior distribution. |
alpha |
Scalar between 0 and 1 corresponding to 1 - confidencel level for computing Highest Density Intervals. If set to NULL, the confidence intervals are not computed. |
nDigits |
A positive integer for printing the output, after rounding to the corresponding number of digits. Default: |
verbose |
Boolean. If set to TRUE (default) the function prints a summary of the predictions. |
... |
ignored. |
The values of the posterior draws are clustered according to a (univariate) normal mixture model, and the main mode corresponds to the cluster with the largest mean. The maximum number of mixture components corresponds to the K_max
argument. The mclust library is used for this purpose. The inference for the latent cure status of each (censored) observation is based on the MCMC draws corresponding to the main mode of the posterior distribution. The FDR is controlled according to the technique proposed in Papastamoulis and Rattray (2018).
In case where covariate_levels
is set to TRUE
, the summary
function also returns a list named p_cured_output
with the following entries
It is returned only in the case where the argument covariate_values
is not NULL
. A vector of posterior cured probabilities for the given values in covariate_values
, per retained MCMC draw.
It is returned only in the case where the argument covariate_values
is not NULL
. The cured probabilities computed at the MAP estimate of the parameters, for the given values covariate_values
.
tau values
covariate levels
the subset of MCMC draws allocated to the main mode of the posterior distribution.
A list with the following entries
map_estimate |
Maximum A Posteriori (MAP) estimate of the parameters of the model. |
highest_density_intervals |
Highest Density Interval per parameter |
latent_cured_status |
Estimated posterior probabilities of the latent cure status per censored subject. |
cured_at_given_FDR |
Classification as cured or not, at given FDR level. |
p_cured_output |
It is returned only in the case where the argument |
main_mode_index |
The retained MCMC iterations which correspond to the main mode of the posterior distribution. |
Panagiotis Papastamoulis
Papastamoulis and Milienos (2024). Bayesian inference and cure rate modeling for event history data. TEST doi: 10.1007/s11749-024-00942-w.
Papastamoulis and Rattray (2018). A Bayesian Model Selection Approach for Identifying Differentially Expressed Transcripts from RNA Sequencing Data, Journal of the Royal Statistical Society Series C: Applied Statistics, Volume 67, Issue 1.
Scrucca L, Fraley C, Murphy TB, Raftery AE (2023). Model-Based Clustering, Classification, and Density Estimation Using mclust in R. Chapman and Hall/CRC. ISBN 978-1032234953
cure_rate_MC3
# simulate toy data just for cran-check purposes
set.seed(10)
n = 4
# censoring indicators
stat = rbinom(n, size = 1, prob = 0.5)
# covariates
x <- matrix(rnorm(2*n), n, 2)
# observed response variable
y <- rexp(n)
# define a data frame with the response and the covariates
my_data_frame <- data.frame(y, stat, x1 = x[,1], x2 = x[,2])
# run a weibull model with default prior setup
# considering 2 heated chains
fit1 <- cure_rate_MC3(survival::Surv(y, stat) ~ x1 + x2, data = my_data_frame,
promotion_time = list(distribution = 'exponential'),
nChains = 2,
nCores = 1,
mcmc_cycles = 3, sweep=2)
newdata <- data.frame(x1 = c(0.2,-1), x2 = c(-1,0))
# return predicted values at tau = c(0.5, 1)
my_prediction <- predict(fit1, newdata = newdata,
burn = 0, tau_values = c(0.5, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.