Stata 15 help for bayesstats ess

[BAYES] bayesstats ess -- Effective sample sizes and related statistics

Syntax

Statistics for all model parameters

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

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

Statistics for selected model parameters

bayesstats ess paramspec [, options]

Statistics for functions of model parameters

bayesstats ess exprspec [, options]

Full syntax

bayesstats ess 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.

spec is one of paramspec or exprspec.

options Description ------------------------------------------------------------------------- Main 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

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

Menu

Statistics > Bayesian analysis > Effective sample sizes

Description

bayesstats ess calculates effective sample sizes (ESS), correlation times, and efficiencies for model parameters and functions of model parameters using current Bayesian estimation results.

Options

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

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 the 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.

+----------+ ----+ Advanced +---------------------------------------------------------

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().

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.

Examples

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

Effective sample sizes for all model parameters . bayesstats ess

Effective sample size for parameter {change:age} . bayesstats ess {change:age}

Effective sample sizes for a function of model parameter {var} . bayesstats ess (sqrt({var}))

Effective sample sizes for multiple functions of model parameters with labels for each expression . bayesstats ess (exp_age: exp({change:age})) (sd: sqrt({var}))

Stored results

bayesstats ess stores the following in r():

Scalars 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(ess) matrix with effective sample sizes, correlation times, and efficiencies for parameters in r(names)


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index