CPPplotHR               package:BayHaz               R Documentation

_F_u_n_c_t_i_o_n _t_o _P_l_o_t _C_P_P _H_a_z_a_r_d _R_a_t_e_s

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

     A function to plot a (prior or posterior) sample of CPP hazard
     rates.

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

     CPPplotHR(sample = CPPpriorSample(0), npts = 101, tu = "Time Unit", title = NULL)

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

  sample: sample of CPP hazard rates (as generated by 'CPPpriorSample'
          or 'CPPpostSample')

    npts: number of time points where the hazard rates in the sample
          should be evaluated

      tu: name of the time unit to be used for labelling the time axis

   title: main title for the plot

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

     For a prior sample, the individual trajectories are plotted (as
     solid lines) and dashed lines are added to represent the pointwise
     prior mean and +/- one standard deviation band.

     For a posterior sample, the pointwise posterior mean and equal
     tail 95% credible band are drawn (as solid lines) and dashed lines
     are added to represent the analogous posterior summaries for the
     constant hazard rate model (using a conjugate gamma prior and
     letting its shape and rate parameters tend to zero). Furthermore,
     the observations are marked on the time axis ("x" for exact
     observations, "o" for censored observations).

     The range spanned by the time axis always goes from the origin to
     'sample$hyp$T00'.

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

     Always 'NULL'.

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

     'BayHaz-package', 'CPPevalHR'

_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)
     # generate a sample of ten hazard rates
     prior<-CPPpriorSample(ss = 10, hyp = hypars)

     # plot the ten hazard rates
     CPPplotHR(prior, tu = "Year")

     # load a data set
     data(earthquakes)
     # generate a posterior sample
     post<-CPPpostSample(hypars, times = earthquakes$ti, obs = earthquakes$ob)

     # plot some posterior hazard rate summaries
     CPPplotHR(post, tu = "Year")

