Learn R Programming

BayHaz (version 0.1-3)

BPSpriorSample: Function to Sample Hazard Rates from BPS Priors

Description

A function to generate a random sample of hazard rates from a first order autoregrssive BPS prior distribution.

Usage

BPSpriorSample(ss = 1, hyp = BPSpriorElicit())

Arguments

ss
requested sample size
hyp
list of hyperparameters (as generated by BPSpriorElicit)

Value

A list with two components:
hyp
list of hyperparameters identifying the BPS prior distribution from which the sample was extracted (copy of the input argument)
eta
matrix with ss rows (and length(hyp$knots)-hyp$ord columns) containing the spline weights

Details

A random sample of ss hazard rates is extracted from the first order autoregressive BPS prior distribution identified by hyp.

See Also

BPSevalHR, BPSplotHR

Examples

Run this code
# 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)

# generate a sample of ten hazard rates
prior<-BPSpriorSample(ss = 10, hyp = hypars)

Run the code above in your browser using DataLab