hpd: get the highest posterior density (HPD) interval

hpdR Documentation

get the highest posterior density (HPD) interval

Description

get the highest posterior density (HPD) interval

Usage

hpd(object, parm, level = 0.95, HPD = TRUE)

Arguments

object

the output model from fitting a (network) meta analysis/regression model

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the probability which the HPD interval will cover

HPD

a logical value indicating whether HPD or equal-tailed credible interval should be computed; by default, TRUE

Details

A 100(1-α)% HPD interval for θ is given by

R(π_α) = {θ: π(θ| D) ≥ π_α},

where π_α is the largest constant that satisfies P(θ \in R(π_α)) ≥ 1-α. hpd computes the HPD interval from an MCMC sample by letting θ_{(j)} be the jth smallest of the MCMC sample, {θ_i} and denoting

R_j(n) = (θ_{(j)}, θ_{(j+[(1-α)n])}),

for j=1,2,…,n-[(1-α)n]. Once θ_i's are sorted, the appropriate j is chosen so that

θ_{(j+[(1-α)n])} - θ_{(j)} = \min_{1≤ j ≤q n-[(1-α)n]} (θ_{(j+[(1-α)n])} - θ_{(j)}).

Value

dataframe containing HPD intervals for the parameters

References

Chen, M. H., & Shao, Q. M. (1999). Monte Carlo estimation of Bayesian credible and HPD intervals. Journal of Computational and Graphical Statistics, 8(1), 69-92.


metapack documentation built on May 31, 2022, 1:05 a.m.