Stata 15 help for bayestest interval

[BAYES] bayestest interval -- Interval hypothesis testing

Syntax

Test one interval hypothesis about continuous or discrete parameter

bayestest interval exspec [, luspec options]

Test one point hypothesis about discrete parameter

bayestest interval exspec==# [, options]

Test multiple hypotheses separately

bayestest interval (testspec) [(testspec) ...] [, options]

Test multiple hypotheses jointly

bayestest interval (jointspec) [, options]

Full syntax

bayestest interval (spec) [(spec) ...] [, options]

exspec is optionally labeled expression of model parameters, [prlabel:]expr, where prlabel is a valid Stata name (or prob# by default), and expr is a scalar model parameter or scalar expression containing (parentheses are optional) scalar model parameters. The expression expr may not contain variable names.

testspec is exspec[, luspec] or exspec==# for discrete parameters only.

jointspec is [prlabel:](testspec) (testspec) ..., joint. The labels (if any) of testspec are ignored.

spec is one of testspec or jointspec.

luspec Null hypothesis ------------------------------------------------------------------------- lower(#) [upper(.)] theta > # lower(#,inclusive) [upper(.)] theta >= # [lower(.)] upper(#) theta < # [lower(.)] upper(#,inclusive) theta <= # lower(#_l) upper(#_u) #_l < theta < #_u lower(#_l) upper(#_u,inclusive) #_l < theta <= #_u lower(#_l,inclusive) upper(#_u) #_l <= theta < #_u lower(#_l,inclusive) upper(#_u,inclusive) #_l <= theta <= #_u -------------------------------------------------------------------------

lower(intspec) and upper(intspec) specify the lower- and upper-interval values, respectively.

intspec is # [, inclusive] where # is the interval value, and suboption inclusive specifies that this value should be included in the interval, meaning a closed interval. Closed intervals make sense only for discrete parameters. intspec may also contain a dot (.), meaning negative infinity for lower() and positive infinity for upper(). Either option lower(.) or option upper(.) must be specified.

options Description ------------------------------------------------------------------------- Main skip(#) skip every # observations from the MCMC sample; default is skip(0) nolegend suppress table legend

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

Menu

Statistics > Bayesian analysis > Interval hypothesis testing

Description

bayestest interval performs interval hypothesis tests for model parameters and functions of model parameters using current Bayesian estimation results. bayestest interval reports mean estimates, standard deviations, and MCMC standard errors of posterior probabilities associated with an interval hypothesis.

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.

+----------+ ----+ 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 . sysuse auto . set seed 14 . bayesmh mpg, likelihood(normal({var})) prior({mpg:_cons}, flat) prior({var}, jeffreys)

Estimated posterior mean probability of an interval hypothesis for {mpg:_cons} . bayestest interval {mpg:_cons}, lower(19) upper(22)

Label the estimate prob_mean . bayestest interval (prob_mean:{mpg:_cons}), lower(19) upper(22)

Test multiple hypotheses separately . bayestest interval ({mpg:_cons}, lower(19) upper(22)) ({var}, lower(24) upper(47))

Test multiple hypotheses jointly . bayestest interval (({mpg:_cons}, lower(19) upper(22)) ({var}, lower(24) upper(47)), joint)

Test a function of model parameters . bayestest interval (sd:sqrt({var})), lower(4.9) upper(6.9)

--------------------------------------------------------------------------- Setup . clear . set seed 12345 . set obs 20 . generate double y = rpoisson(2) . set seed 14 . bayesmh y, likelihood(dpoisson({mu})) prior({mu}, index(0.25,0.25,0.25,0.25)) initial({mu} 2)

Test point hypothesis for a discrete parameter . bayestest interval {mu}==1

Test multiple point hypotheses separately . bayestest interval ({mu}==1) ({mu}==2) ({mu}==3) ({mu}==4)

Test an open-interval hypothesis . bayestest interval {mu}, lower(2) upper(4)

Test a closed-interval hypothesis . bayestest interval {mu}, lower(2, inclusive) upper(4, inclusive)

---------------------------------------------------------------------------

Stored results

bayestest interval 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 probability expression r(names) names of probability expressions

Matrices r(summary) test results for parameters in r(names)


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