Learn R Programming

ggdistribute (version 1.0.3)

post_int: Posterior intervals

Description

Returns cutoff points from a posterior distribution

Usage

post_int(x, mid = c("median", "mean", "mode"), int = c("hdi", "ci"),
  widths = c(0.5, 0.95), adj = 1.5, rope = NULL, warn = FALSE)

Arguments

x

Vector of numeric values. Typically a posterior sample.

mid

Central tendency estimator. Defaults to "median". Other options include "mean" and "mode".

int

interval type, either "hdi" or "ci"

widths

interval widths

adj

Bandwidth adjustment used only with the "mode" estimator. See dmode.

rope

Region of practical equivalence. Check how much of the distribution is within rope value.

warn

Turn off warning for flat intervals found (multiple possible values)

Value

data.table

Examples

Run this code
# NOT RUN {
x <- rpois(5000, 15)
ints <- post_int(x, warn = FALSE)
hist(x, br=50)
abline(v=ints$c, col="cyan")
abline(v=ints[, c("l.wide", "r.wide")], col="magenta")

post_int(x, "median", warn = FALSE)
post_int(x, "mean", warn = FALSE)
post_int(x, "mode", adj=2, rope = c(14, 16), warn = FALSE)
# }

Run the code above in your browser using DataLab