| CPPpostSample {BayHaz} | R Documentation |
A function to generate a random sample of hazard rates from the posterior distribution originated by a CPP prior through the observation of a sequence of possibly right censored times to event.
CPPpostSample(hyp, times, obs = NULL, mclen = 10, burnin = 0, thin = 1, lab = FALSE)
hyp |
list of hyperparameters (as generated by CPPpriorElicit) |
times |
vector of (possibly right censored) times to event |
obs |
vector of censoring indicators (0 = censored, 1 = exact) |
mclen |
requested sample size |
burnin |
burn-in parameter |
thin |
thinning parameter |
lab |
logical: should latent labels be returned? |
A random scan (random start) Gibbs sampler (with slice sampling updating of jump-times)
is used to generate a Markov chain sample of length mclen from the posterior distribution
originated by hyp through the observation of times and obs; see La Rocca (2005).
The first burnin states of the Markov chain are discarded, then one every thin is kept.
If obs is NULL, it is assumed that all observations are exact (no censoring).
A list with eight components:
hyp |
list of hyperparameters identifying the CPP prior that originated the posterior distribution from which the sample was extracted (copy of the input argument) |
dat |
dataframe with two variables (times and obs) containing the observations
on which the posterior distribution is based |
burnin |
burn-in parameter used (copy of the input argument) |
thin |
thinning parameter used (copy of the input argument) |
sgm |
matrix with mclen rows (and hyp$F columns) containing the CPP jump-times |
xi0 |
matrix with mclen rows (and just one column) containing the jump-sizes in the origin |
csi |
matrix with mclen rows (and hyp$F columns) containing the CPP jump-sizes |
gam |
matrix with mclen rows (and length(times) columns) containing the latent labels
(NULL if lab is FALSE) |
The latent label gamma_i is equal to j when the i-th time to event is associated with the j-th CPP jump; it is only defined for exact observations, but for censored observations it is conventionally set equal to -1.
Luca La Rocca (2005). On Bayesian Nonparametric Estimation of Smooth Hazard Rates with a View to Seismic Hazard Assessment. Research Report n. 38-05, Department of Social, Cognitive and Quantitative Sciences, Reggio Emilia, Italy.
BayHaz-package, CPPevalHR, CPPplotHR, CPPpost2mcmc
# set RNG seed (for example reproducibility only) set.seed(1234) # select a CPP prior distribution hypars<-CPPpriorElicit(r0 = 0.1, H = 1, T00 = 50, M00 = 2) # load a data set data(earthquakes) # generate a posterior sample post<-CPPpostSample(hypars, times = earthquakes$ti, obs = earthquakes$ob)