posterior-intervals: Calculate posterior density intervals

Description Usage Arguments Details Value

Description

Calculate the highest posterior density interval (HPDI) or the equal-tailed density interval (ETDI) of posterior samples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
tidy_hpdi(x, prob = 0.9)

## S3 method for class 'numeric'
tidy_hpdi(x, prob = 0.9)

## S3 method for class 'stanreg'
tidy_hpdi(x, prob = 0.9)

## S3 method for class 'mcmc.list'
tidy_hpdi(x, prob = 0.9)

tidy_etdi(x, prob = 0.9)

## S3 method for class 'numeric'
tidy_etdi(x, prob = 0.9)

## S3 method for class 'stanreg'
tidy_etdi(x, prob = 0.9)

## S3 method for class 'mcmc.list'
tidy_etdi(x, prob = 0.9)

Arguments

x

a model fitted with RStanARM or a vector of MCMC samples

prob

a probability content or width of the interval. Defaults to .9.

Details

The equal-tailed density interval is a term I made up for the traditional sort of confidence or uncertainty interval. A 90 the 5th and 95th percentiles. The interval contains 90 density, and the left and right tails outside of the interval contain an equal amount of probability density (5 compute the interval.

The highest density posterior interval is the narrowest interval with a given probability density. A 90 contains 90 the interval might contain unequal amounts of probability density. I use coda::HPDinterval() to compute these intervals.

Value

a data-frame (a tibble::tibble()) of intervals. Contains columns with the term name, interval type and density, and the lower and upper values of the interval.


tjmahr/tristan documentation built on May 8, 2019, 9:46 a.m.