If .data
is a data frame, then ...
is a list of bare names of
columns (or expressions derived from columns) of .data
, on which
the point and interval estimates are derived. Column expressions are processed
using the tidy evaluation framework (see eval_tidy
).
For a column named x
, the resulting data frame will have a column
named x
containing its point estimate. If there is a single
column to be summarized and .broom
is TRUE
, the output will
also contain columns conf.low
(the lower end of the interval),
conf.high
(the upper end of the interval).
Otherwise, for every summarized column x
, the output will contain
x.low
(the lower end of the interval) and x.high
(the upper
end of the interval). Finally, the output will have a .prob
column
containing the' probability for the interval on each output row.
If .data
includes groups (see e.g. group_by
),
the points and intervals are calculated within the groups.
If .data
is a vector, ...
is ignored and the result is a
data frame with one row per value of .prob
and three columns:
y
(the point estimate), ymin
(the lower end of the interval),
ymax
(the upper end of the interval), and .prob
, the probability
corresponding to the interval. This behavior allows point_interval
and its derived functions (like median_qi
, mean_qi
, mode_hdi
, etc)
to be easily used to plot intervals in ggplot using methods like
geom_eye
, geom_eyeh
, or stat_summary
.
The functions ending in h
(e.g., point_intervalh
, median_qih
)
behave identically to the function without the h, except that when passed a vector,
they return a data frame with x
/xmin
/xmax
instead of
y
/ymin
/ymax
. This allows them to be used as values of the
fun.data =
argument of stat_summaryh
. Note: these
functions are not necessary if you use the point_interval
argument of stat
s and geom
s in the tidybayes
package (e.g.
stat_pointintervalh
, geom_halfeyeh
, etc), as
these automatically adjust the function output to match their required aesthetics.
median_qi
, mode_hdi
, etc are short forms for
point_interval(..., .point = median, .interval = qi)
, etc.
qi
yields the quantile interval (also known as the percentile interval or
equi-tailed interval) as a 1x2 matrix.
hdi
yields the highest-density interval(s) (also known as the highest posterior
density interval). Note: If the distribution is multimodal, hdi
may return multiple
intervals for each estimate (these will be spread over rows). Internally it uses hdi
.