hpd.overlap: Check whether hpds of two distributions overlap

View source: R/sets.R

hpd.overlapR Documentation

Check whether hpds of two distributions overlap

Description

Checks whether any of the highest posterior densities (hpds) of two distributions overlap.

Usage

hpd.overlap(distA, distB, prob = 0.95, add.zeros = FALSE)

Arguments

distA

Distribution A. Expects two columns: values and their probabilities (e.g., caldist(130,10, cc=1)).

distB

Distribution B. Expects two columns: values and their probabilities (e.g., caldist(130,10, cc=1)).

prob

The probability of the highest posterior densities. Defaults to 95%.

add.zeros

Pad the distribution with zeros at both extremes. Can be useful for distributions with 'open endings'. Defaults to FALSE

Value

TRUE if at least one of the hpds of distA overlaps with that of distB.

Examples

  distA <- caldist(130, 20, cc=0) # normal distribution
  distB <- caldist(130, 20, cc=1, bombalert=FALSE) # calibrated distribution
  plot(distB, type="l")
  lines(distA, col=2)
  hpd.overlap(distA, distB)

rice documentation built on Aug. 19, 2026, 5:07 p.m.