Description Usage Arguments Details Value Setting the correct prior Note References Examples
A support interval contains only the values of the parameter that predict the observed data better
than average, by some degree k; these are values of the parameter that are associated with an
updating factor greater or equal than k. From the perspective of the SavageDickey Bayes factor, testing
against a point null hypothesis for any value within the support interval will yield a Bayes factor smaller
than 1/k.
For more info, in particular on specifying correct priors for factors with more than 2 levels,
see the Bayes factors vignette.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  si(posterior, prior = NULL, BF = 1, verbose = TRUE, ...)
## S3 method for class 'numeric'
si(posterior, prior = NULL, BF = 1, verbose = TRUE, ...)
## S3 method for class 'stanreg'
si(
posterior,
prior = NULL,
BF = 1,
verbose = TRUE,
effects = c("fixed", "random", "all"),
component = c("conditional", "location", "zi", "zero_inflated", "all",
"smooth_terms", "sigma", "distributional", "auxiliary"),
parameters = NULL,
...
)
## S3 method for class 'brmsfit'
si(
posterior,
prior = NULL,
BF = 1,
verbose = TRUE,
effects = c("fixed", "random", "all"),
component = c("conditional", "location", "zi", "zero_inflated", "all",
"smooth_terms", "sigma", "distributional", "auxiliary"),
parameters = NULL,
...
)
## S3 method for class 'blavaan'
si(
posterior,
prior = NULL,
BF = 1,
verbose = TRUE,
effects = c("fixed", "random", "all"),
component = c("conditional", "location", "zi", "zero_inflated", "all",
"smooth_terms", "sigma", "distributional", "auxiliary"),
parameters = NULL,
...
)
## S3 method for class 'emmGrid'
si(posterior, prior = NULL, BF = 1, verbose = TRUE, ...)
## S3 method for class 'data.frame'
si(posterior, prior = NULL, BF = 1, verbose = TRUE, ...)

posterior 
A numerical vector, 
prior 
An object representing a prior distribution (see 'Details'). 
BF 
The amount of support required to be included in the support interval. 
verbose 
Toggle off warnings. 
... 
Arguments passed to and from other methods. (Can be used to pass
arguments to internal 
effects 
Should results for fixed effects, random effects or both be returned? Only applies to mixed models. May be abbreviated. 
component 
Should results for all parameters, parameters for the conditional model or the zeroinflated part of the model be returned? May be abbreviated. Only applies to brmsmodels. 
parameters 
Regular expression pattern that describes the parameters
that should be returned. Metaparameters (like 
This method is used to compute support intervals based on prior and posterior distributions.
For the computation of support intervals, the model priors must be proper priors (at the very least
they should be not flat, and it is preferable that they be informative  note
that by default, brms::brm()
uses flat priors for fixedeffects; see example below).
BF
The choice of BF
(the level of support) depends on what we want our interval to represent:
A BF
= 1 contains values whose credibility is not decreased by observing the data.
A BF
> 1 contains values who received more impressive support from the data.
A BF
< 1 contains values whose credibility has not been impressively decreased by observing the data.
Testing against values outside this interval will produce a Bayes factor larger than 1/BF
in support of
the alternative. E.g., if an SI (BF = 1/3) excludes 0, the Bayes factor against the pointnull will be larger than 3.
A data frame containing the lower and upper bounds of the SI.
Note that if the level of requested support is higher than observed in the data, the
interval will be [NA,NA]
.
prior
For the computation of Bayes factors, the model priors must be proper priors
(at the very least they should be not flat, and it is preferable that
they be informative); As the priors for the alternative get wider, the
likelihood of the null value(s) increases, to the extreme that for completely
flat priors the null is infinitely more favorable than the alternative (this
is called the JeffreysLindleyBartlett paradox). Thus, you should
only ever try (or want) to compute a Bayes factor when you have an informed
prior.
(Note that by default, brms::brm()
uses flat priors for fixedeffects;
See example below.)
It is important to provide the correct prior
for meaningful results.
When posterior
is a numerical vector, prior
should also be a numerical vector.
When posterior
is a data.frame
, prior
should also be a data.frame
, with matching column order.
When posterior
is a stanreg
or brmsfit
model:
prior
can be set to NULL
, in which case prior samples are drawn internally.
prior
can also be a model equivalent to posterior
but with samples from the priors only. See unupdate()
.
Note: When posterior
is a brmsfit_multiple
model, prior
must be provided.
When posterior
is an emmGrid
object:
prior
should be the stanreg
or brmsfit
model used to create the emmGrid
objects.
prior
can also be an emmGrid
object equivalent to posterior
but created with a model of priors samples only.
Note: When the emmGrid
has undergone any transformations ("log"
, "response"
, etc.), or regrid
ing, then prior
must be an emmGrid
object, as stated above.
There is also a plot()
method implemented in the seepackage.
Wagenmakers, E., Gronau, Q. F., Dablander, F., & Etz, A. (2018, November 22). The Support Interval. doi: 10.31234/osf.io/zwnxb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  library(bayestestR)
prior < distribution_normal(1000, mean = 0, sd = 1)
posterior < distribution_normal(1000, mean = .5, sd = .3)
si(posterior, prior)
## Not run:
# rstanarm models
# 
library(rstanarm)
contrasts(sleep$group) < contr.orthonorm # see vingette
stan_model < stan_lmer(extra ~ group + (1  ID), data = sleep)
si(stan_model)
si(stan_model, BF = 3)
# emmGrid objects
# 
library(emmeans)
group_diff < pairs(emmeans(stan_model, ~group))
si(group_diff, prior = stan_model)
# brms models
# 
library(brms)
contrasts(sleep$group) < contr.orthonorm # see vingette
my_custom_priors <
set_prior("student_t(3, 0, 1)", class = "b") +
set_prior("student_t(3, 0, 1)", class = "sd", group = "ID")
brms_model < brm(extra ~ group + (1  ID),
data = sleep,
prior = my_custom_priors
)
si(brms_model)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.