Description Usage Arguments Details Value Note References See Also Examples
A function to generate a random sample of hazard rates from the posterior distribution originated by a first order autoregressive BPS prior through the observation of a sequence of possibly right censored times to event.
1 | BPSpostSample(hyp, times, obs = NULL, mclen = 10, burnin = 0, thin = 1, df = 10, etastar = NULL)
|
hyp |
list of hyperparameters (as generated by |
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 |
df |
degrees of freedom for the multivariate Student-t proposal distribution |
etastar |
posterior mode and corresponding hessian in list format (as generated by |
A Markov chain sample of length mclen
from the posterior distribution
originated by hyp
through the observation of times
and obs
is generated
using a taylored proposal density Metropolis-Hastings sampler (starting at the posterior mode);
see Chib \& Greenberg (1995).
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 seven components:
hyp |
list of hyperparameters identifying the BPS prior that originated the posterior distribution from which the sample was extracted (copy of the input argument) |
dat |
dataframe with two variables ( |
burnin |
burn-in parameter used (copy of the input argument) |
thin |
thinning parameter used (copy of the input argument) |
df |
degrees of freedom used for the multivariate Student-t proposal distribution (copy of the input argument) |
etastar |
posterior mode and corresponding hessian in list format (copy of the input argument
or computed via |
eta |
matrix with |
If mclen
is equal to zero eta
will be a chain of length one containing the posterior mode.
Chib, S. \& E. Greenberg (1995). Understanding the Metropolis-Hastings algorithm. American Statistician 49, 327–335.
BayHaz-package
, BPSevalHR
, BPSplotHR
, BPSpost2mcmc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # set RNG seed (for example reproducibility only)
set.seed(1234)
# select a BPS prior distribution
hypars<-BPSpriorElicit(r0 = 0.1, H = 1, T00 = 50, ord = 4, G = 3, c = 0.9)
# load a data set
data(earthquakes)
# find the posterior mode
postmode<-BPSpostSample(hypars, times = earthquakes$ti, obs = earthquakes$ob, mclen = 0)
# evaluate the posterior mode hazard rate at year multiples
BPSevalHR(time = seq(0,50), sample = postmode)
# generate a posterior sample
post<-BPSpostSample(hypars, times = earthquakes$ti, obs = earthquakes$ob, etastar = postmode$etastar)
# plot some posterior hazard rate summaries
BPSplotHR(post, tu = "Year")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.