For models fit using MCMC (
algorithm="sampling") or one of the
variational approximations (
posterior_interval function computes Bayesian posterior uncertainty
intervals. These intervals are often referred to as credible
intervals, but we use the term uncertainty intervals to highlight the
fact that wider intervals correspond to greater uncertainty.
1 2 3
A fitted model object returned by one of the
rstanarm modeling functions. See
A number p (0 < p < 1) indicating the desired
probability mass to include in the intervals. The default is to report
90% intervals (
The type of interval to compute. Currently the only option is
An optional character vector of parameter names.
An optional character vector of regular
expressions to use for parameter selection.
Unlike for a frenquentist confidence interval, it is valid to say that, conditional on the data and model, we believe that with probability p the value of a parameter is in its 100p% posterior interval. This intuitive interpretation of Bayesian intervals is often erroneously applied to frequentist confidence intervals. See Morey et al. (2015) for more details on this issue and the advantages of using Bayesian posterior uncertainty intervals (also known as credible intervals).
We default to reporting 90% intervals rather than 95% intervals for several reasons:
Computational stability: 90% intervals are more stable than 95% intervals (for which each end relies on only 2.5% of the posterior draws).
Relation to Type-S errors (Gelman and Carlin, 2014): 95% of the mass in a 90% central interval is above the lower value (and 95% is below the upper value). For a parameter θ, it is therefore easy to see if the posterior probability that θ > 0 (or θ < 0) is larger or smaller than 95%.
Of course, if 95% intervals are desired they can be computed by
posterior_interval only computes central intervals because
other types of intervals are rarely useful for the models that rstanarm
can estimate. Additional possibilities may be provided in future releases as
more models become available.
A matrix with two columns and as many rows as model parameters (or
the subset of parameters specified by
regex_pars). For a given value of
prob, p, the columns
correspond to the lower and upper 100p% interval limits and have the
names 100α/2% and 100(1 - α/2)%, where α
= 1-p. For example, if
prob=0.9 is specified (a 90%
interval), then the column names will be
Gelman, A. and Carlin, J. (2014). Beyond power calculations: assessing Type S (sign) and Type M (magnitude) errors. Perspectives on Psychological Science. 9(6), 641–51.
Morey, R. D., Hoekstra, R., Rouder, J., Lee, M. D., and Wagenmakers, E. (2016). The fallacy of placing confidence in confidence intervals. Psychonomic Bulletin & Review. 23(1), 103–123.
confint.stanreg, which, for models fit using optimization, can
be used to compute traditional confidence intervals.
predictive_interval for predictive intervals.
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.