This function computes point estimates and HPD (or quantile) intervals for each
factor combination in object@emmGrid. While this function
may be called independently, it is called automatically by the S3 method
summary.emmGrid when the object is based on a Bayesian model.
(Note: the level argument, or its default, is passed as prob).
hpd.summary(object, prob, by, type, point.est = median,
ci.method = get_emm_option("post.ci.method"), delta,
bias.adjust = get_emm_option("back.bias.adj"), sigma, ...)an object of class summary_emm
an emmGrid object having a non-missing post.beta slot
numeric probability content for HPD intervals (note: when not specified,
the current level option is used; see emm_options)
factors to use as by variables
prediction type as in summary.emmGrid
function to use to compute the point estimates from the posterior sample for each grid point
character value matching "HPD" (default) or "quantile"
(but actually not case-sensitive).
The default is to use HPD intervals (which are the shortest possible intervals).
Alternatively, choosing "quantile" uses the quantiles of the posterior
having equal tail probabilities.
Numeric equivalence threshold (on the linear predictor scale
regardless of type).
See the section below on equivalence testing.
Logical value for whether to adjust for bias in
back-transforming (type = "response"). This requires a value of
sigma to exist in the object or be specified.
Error SD assumed for bias correction (when
type = "response". If not specified,
object@misc$sigma is used, and a warning if it is not found or invalid.
Note: sigma may be a vector, as long as it conforms to the
number of observations in the posterior sample.
required but not used
If delta is positive, two columns labeled p.equiv and
odds.eq are appended to the summary. p.equiv is the fraction
of posterior estimates having absolute values less than delta. The
odds.eq column is just p.equiv converted to an odds ratio; so
it is the posterior odds of equivalence.
A high value of p.equiv is evidence
in favor of equivalence. It can be used to obtain something equivalent
(in spirit) to the frequentist Schuirmann (TOST) procedure, whereby we would
conclude equivalence at significance level \(\alpha\) if the \((1 - 2\alpha)\)
confidence interval falls entirely in the interval \([-\delta, \delta]\).
Similarly in the Bayesian context, an equally strong argument for
equivalence is obtained if p.equiv exceeds \(1 - 2\alpha\).
A closely related quantity is the ROPE (region of practical equivalence),
obtainable via bayestestR::rope(object, range = c(-delta, delta)).
Its value is approximately 100 * p.equiv / 0.95 if the default
ci = 0.95 is used. See also bayestestR's
issue #567.
Finally, a Bayes factor for equivalence is obtainable by dividing
odds.eq by the prior odds of equivalence, assessed or elicited separately.
summary.emmGrid
if(require("coda"))
emm_example("hpd.summary-coda")
# Use emm_example("hpd.summary-coda", list = TRUE) # to see just the code
Run the code above in your browser using DataLab