CPPpostSample             package:BayHaz             R Documentation

_F_u_n_c_t_i_o_n _t_o _S_a_m_p_l_e _H_a_z_a_r_d _R_a_t_e_s _f_r_o_m _C_P_P _P_o_s_t_e_r_i_o_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     CPPpostSample(hyp, times, obs = NULL, mclen = 10, burnin = 0, thin = 1, lab = FALSE)

_A_r_g_u_m_e_n_t_s:

     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?

_D_e_t_a_i_l_s:

     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).

_V_a_l_u_e:

     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')

_N_o_t_e:

     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.

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     'BayHaz-package', 'CPPevalHR', 'CPPplotHR', 'CPPpost2mcmc'

_E_x_a_m_p_l_e_s:

     # 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)

