## Stata 15 help for bayesstats summary

```
[BAYES] bayesstats summary -- Bayesian summary statistics

Syntax

Summary statistics for all model parameters

bayesstats summary [, options showreffects[(reref)]]

bayesstats summary _all [, options showreffects[(reref)]]

Summary statistics for selected model parameters

bayesstats summary paramspec [, options]

Summary statistics for functions of model parameters

bayesstats summary exprspec [, options]

Summary statistics of log-likelihood or log-posterior functions

bayesstats summary _loglikelihood | _logposterior [, options]

Full syntax

bayesstats summary spec [spec ...] [, options]

paramspec can be one of the following:

{eqname:param} refers to a parameter param with equation name eqname;

{eqname:} refers to all model parameters with equation name eqname;

{eqname:paramlist} refers to parameters with names in paramlist and
with equation name eqname; or

{param} refers to all parameters named param from all equations.

In the above, param can refer to a matrix name, in which case it will
imply all elements of this matrix. See Different ways of specifying
model parameters in [BAYES] bayesian postestimation for examples.

exprspec is an optionally labeled expression of model parameters
specified in parentheses:

([exprlabel:]expr)

exprlabel is a valid Stata name, and expr is a scalar expression that
may not contain matrix model parameters. See Specifying functions of
model parameters in [BAYES] bayesian postestimation for examples.

_loglikelihood and _logposterior also have respective synonyms _ll and
_lp.

spec is one of paramspec, exprspec, _loglikelihood (or _ll), or
_logposterior (or _lp).

options               Description
-------------------------------------------------------------------------
Main
clevel(#)           set credible interval level; default is clevel(95)
hpd                 display HPD credible intervals instead of the
default equal-tail credible intervals
batch(#)            specify length of block for batch-mean
calculations; default is batch(0)
skip(#)             skip every # observations from the MCMC sample;
default is skip(0)
nolegend            suppress table legend
display_options     control spacing, line width, and base and empty
cells

corrlag(#)          specify maximum autocorrelation lag; default varies
corrtol(#)          specify autocorrelation tolerance; default is
corrtol(0.01)
-------------------------------------------------------------------------

Statistics > Bayesian analysis > Summary statistics

Description

bayesstats summary calculates and reports posterior summary statistics
for model parameters and functions of model parameters using current
Bayesian estimation results.  Posterior summary statistics include
posterior means, posterior standard deviations, MCMC standard errors
(MCSE), posterior medians, and equal-tailed credible intervals or highest
posterior density (HPD) credible intervals.

Options

+------+
----+ Main +-------------------------------------------------------------

clevel(#) specifies the credible level, as a percentage, for equal-tailed
and HPD credible intervals.  The default is clevel(95) or as set by
[BAYES] set clevel.

hpd specifies the display of HPD credible intervals instead of the
default equal-tailed credible intervals.

batch(#) specifies the length of the block for calculating batch means,
batch standard deviation, and MCSE using batch means.  The default is
batch(0), which means no batch calculations.  When batch() is not
specified, MCSE is computed using effective sample sizes instead of
batch means.  Option batch() may not be combined with corrlag() or
corrtol().

skip(#) specifies that every # observations from the MCMC sample not be
used for computation.  The default is skip(0) or to use all
observations in the MCMC sample.  Option skip() can be used to
subsample or thin the chain.  skip(#) is equivalent to a thinning
interval of #+1.  For example, if you specify skip(1), corresponding
to the thinning interval of 2, the command will skip every other
observation in the sample and will use only observations 1, 3, 5, and
so on in the computation.  If you specify skip(2), corresponding to
the thinning interval of 3, the command will skip every 2
observations in the sample and will use only observations 1, 4, 7,
and so on in the computation.  skip() does not thin the chain in the
sense of physically removing observations from the sample, as is done
by, for example, bayesmh's thinning() option.  It only discards
selected observations from the computation and leaves the original
sample unmodified.

nolegend suppresses the display of table legend.  The table legend
identifies the rows of the table with the expressions they represent.

showreffects and showreffects(reref) are for use after multilevel models,
and they specify that the results for all or a list reref of
random-effects parameters be provided in addition to other model
parameters.  By default, all random-effects parameters are excluded
from the results to conserve computation time.

display_options:  vsquish, noemptycells, baselevels, allbaselevels,
nofvlabel, fvwrap(#), fvwrapon(style), and nolstretch; see [R]
estimation options.

+----------+

corrlag(#) specifies the maximum autocorrelation lag used for calculating
effective sample sizes.  The default is min{500,mcmcsize()/2}.  The
total autocorrelation is computed as the sum of all lag-k
autocorrelation values for k from 0 to either corrlag() or the index
at which the autocorrelation becomes less than corrtol() if the
latter is less than corrlag().  Options corrlag() and batch() may not
be combined.

corrtol(#) specifies the autocorrelation tolerance used for calculating
effective sample sizes.  The default is corrtol(0.01). For a given
model parameter, if the absolute value of the lag-k autocorrelation
is less than corrtol(), then all autocorrelation lags beyond the kth
lag are discarded.  Options corrtol() and batch() may not be
combined.

Examples

Setup
. webuse oxygen
. set seed 14
. bayesmh change age group, likelihood(normal({var}))
prior({change:}, flat) prior({var}, jeffreys)

Summaries for all model parameters
. bayesstats summary

Summaries for model parameters {change:age} and {var}
. bayesstats summary {change:age} {var}

Summaries for model parameters {change:age} and {change:_cons}
. bayesstats summary {change:age _cons}

Summaries for model parameters in the equation for change
. bayesstats summary {change:}

Summaries for a function of model parameters labeled sd
. bayesstats summary (sd: sqrt({var}))

Stored results

bayesstats summary stores the following in r():

Scalars
r(clevel)      credible interval level
r(hpd)         1 if hpd is specified, 0 otherwise
r(batch)       batch length for batch-mean calculations
r(skip)        number of MCMC observations to skip in the computation;
every r(skip) observations are skipped
r(corrlag)     maximum autocorrelation lag
r(corrtol)     autocorrelation tolerance

Macros
r(expr_#)      #th expression
r(names)       names of model parameters and expressions
r(exprnames)   expression labels

Matrices
r(summary)     matrix with posterior summaries statistics for
parameters in r(names)

```