Learn R Programming

RChronoModel (version 0.4)

CredibleInterval: Bayesian credible interval

Description

Computes the shortest credible interval at the desired level.

Usage

CredibleInterval(a_chain, level = 0.95)

Arguments

a_chain
numeric vector containing the output of the MCMC algorithm for a one-parameter
level
probability corresponding to the level of confidence used for the credible interval

Value

Returns a vector of values containing the level of confidence and the endpoints of the shortest credible interval.

Details

A (100 * level) % credible intervalgives the shortest interval, whose posterior probability is equal to the desired level. This interval is approximated by constructing the shortest interval such that N*(1-level) elements of the sample are outside the interval.

Examples

Run this code
  data(Events); attach(Events)

  CredibleInterval(Event.1)
  CredibleInterval(Event.12, 0.50)

Run the code above in your browser using DataLab