Learn R Programming

bayesCureRateModel (version 1.5)

summary.predict_bayesCureModel: Summary method for predictions.

Description

This function produces MCMC summaries for an object of class predict_bayesCureModel.

Usage

# S3 method for predict_bayesCureModel
summary(object, ...)

Value

A list with the following entries

survival

MCMC summaries (quantiles) for the survival function.

cured_probability

MCMC summaries (quantiles) for the conditional cured probability.

cumulative_hazard

MCMC summaries (quantiles) for the cumulative hazard function.

hazard_rate

MCMC summaries (quantiles) for the hazard rate function.

Arguments

object

An object of class predict_bayesCureModel.

...

Other options passed to the summary.mcmc method of the coda package.

Author

Panagiotis Papastamoulis

References

Papastamoulis and Milienos (2024). Bayesian inference and cure rate modeling for event history data. TEST doi: 10.1007/s11749-024-00942-w.

See Also

cure_rate_MC3

Examples

Run this code
# 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(family = '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))
	my_summary <- summary(my_prediction, quantiles = c(0.1,0.9))		

Run the code above in your browser using DataLab