Learn R Programming

rice (version 1.1.1)

hpd: Calculate highest posterior density

Description

Calculate highest posterior density ranges of calibrated distribution

Usage

hpd(
  calib,
  prob = 0.95,
  return.raw = FALSE,
  BCAD = FALSE,
  ka = FALSE,
  age.round = 0,
  prob.round = 1,
  every = 0.1,
  bins = 20
)

Value

The highest posterior density ranges, as three columns: from age, to age, and the corresponding percentage(s) of the range(s)

Arguments

calib

The calibrated distribution, as returned from caldist()

prob

Probability range which should be calculated. Default prob=0.95.

return.raw

The raw data to calculate hpds can be returned, e.g. to draw polygons of the calibrated distributions. Defaults to return.raw=FALSE.

BCAD

Which calendar scale to use. Defaults to cal BP, BCAD=FALSE.

ka

Whether to report results in years (default) or as ka

age.round

Rounding for ages. Defaults to 0 decimals.

prob.round

Rounding for reported probabilities. Defaults to 1 decimal.

every

Yearly precision (defaults to 0.1, as a compromise between speed and accuracy).

bins

The number of bins required. Any distribution with fewer bins gets recalculated using 100 narrower bins.

Examples

Run this code
hpd(caldist(130,20))
plot(tmp <- caldist(2450,50), type='l')
abline(v=hpd(tmp)[,1:2], col=4)

Run the code above in your browser using DataLab