Skip to content

Instantly share code, notes, and snippets.

@vsbuffalo
Created February 25, 2015 06:45
Show Gist options
  • Save vsbuffalo/1185ce09785a3da5124f to your computer and use it in GitHub Desktop.
Save vsbuffalo/1185ce09785a3da5124f to your computer and use it in GitHub Desktop.
hpdi_stat <- function(x, prob=0.95) {
# stat functions for ggplot that handle HPDI from samples
# automatically.
hpdi <- HPDinterval(as.mcmc(x))
c(y=mean(x), ymin=hpdi[1, 'lower'], ymax=hpdi[1, 'upper'])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment