Learn R Programming

rice (version 1.3.0)

hpd.overlap: 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)

Value

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

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%.

Examples

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

Run the code above in your browser using DataLab