Stata 15 help for bayes

[BAYES] bayes -- Bayesian regression models using the bayes prefix

Syntax

bayes [, bayesopts] : estimation_command [, estopts]

estimation_command is a likelihood-based estimation command, and estopts are command-specific estimation options; see [BAYES] bayesian estimation for a list of supported commands, and see the command-specific entries for the supported estimation options, estopts.

bayesopts Description ------------------------------------------------------------------------- Priors * gibbs specify Gibbs sampling; available only with the regress or mvreg for certain prior combinations * normalprior(#) specify standard deviation of default normal priors for regression coefficients and other real scalar parameters; default is normalprior(100) * igammaprior(# #) specify shape and scale of default inverse-gamma prior for variances; default is igammaprior(0.01 0.01) * iwishartprior(# [...]) specify degrees of freedom and, optionally, scale matrix of default inverse-Wishart prior for unstructured random-effects covariance prior(priorspec) prior for model parameters; this option may be repeated dryrun show model summary without estimation

Simulation mcmcsize(#) MCMC sample size; default is mcmcsize(10000) burnin(#) burn-in period; default is burnin(2500) thinning(#) thinning interval; default is thinning(1) rseed(#) random-number seed exclude(paramref) specify model parameters to be excluded from the simulation results restubs(restub1 restub2 ...) specify stubs for random-effects parameters for all levels; allowed only with multilevel models

Blocking * blocksize(#) maximum block size; default is blocksize(50) block(paramref[, blockopts]) specify a block of model parameters; this option may be repeated blocksummary display block summary * noblocking do not block parameters by default

Initialization initial(initspec) initial values for model parameters nomleinitial suppress the use of maximum likelihood estimates as starting values initrandom specify random initial values initsummary display initial values used for simulation * noisily display output from the estimation command during initialization

Adaptation adaptation(adaptopts) control the adaptive MCMC procedure scale(#) initial multiplier for scale factor; default is scale(2.38) covariance(cov) initial proposal covariance; default is the identity matrix

Reporting clevel(#) set credible interval level; default is clevel(95) hpd display HPD credible intervals instead of the default equal-tailed credible intervals eform_option display coefficient table in exponentiated form remargl compute log marginal likelihood batch(#) specify length of block for batch-means calculations; default is batch(0) saving(filename[, replace]) save simulation results to filename.dta nomodelsummary suppress model summary nomesummary suppress multilevel-structure summary; allowed only with multilevel models [no]dots suppress dots or display dots every 100 iterations and iteration numbers every 1,000 iterations; default is command-specific dots(#[, every(#)]) display dots as simulation is performed [no]show(paramref) specify model parameters to be excluded from or included in the output showreffects[(reref)] specify that all or a subset of random-effects parameters be included in the output; allowed only with multilevel commands melabel display estimation table using the same row labels as estimation_command; allowed only with multilevel commands nogroup suppress table summarizing groups; allowed only with multilevel models notable suppress estimation table noheader suppress output header title(string) display string as title above the table of parameter estimates display_options control spacing, line width, and base and empty cells

Advanced search(search_options) control the search for feasible initial values corrlag(#) specify maximum autocorrelation lag; default varies corrtol(#) specify autocorrelation tolerance; default is corrtol(0.01) ------------------------------------------------------------------------- * Starred options are specific to the bayes prefix; other options are common between bayes and bayesmh. The full specification of iwishartprior() is iwishartprior(# [matname] [, relevel(levelvar)]). Options prior() and block() can be repeated. priorspec and paramref are defined in [BAYES] bayesmh. paramref may contain factor variables; see fvvarlist. See [BAYES] bayesian postestimation for features available after estimation.

Menu

Statistics > Bayesian analysis > Regression models > estimation_command

Description

The bayes prefix fits Bayesian regression models. It provides Bayesian support for many likelihood-based estimation commands. The bayes prefix uses default or user-supplied priors for model parameters and estimates parameters using MCMC by drawing simulation samples from the corresponding posterior model. Also see [BAYES] bayesmh and [BAYES] bayesmh evaluators for fitting more general Bayesian models.

Options

+--------+ ----+ Priors +-----------------------------------------------------------

gibbs specifies that Gibbs sampling be used to simulate model parameters instead of the default adaptive Metropolis-Hastings sampling. This option is allowed only with the regress and mvreg estimation commands. It is available only with certain prior combinations such as normal prior for regression coefficients and an inverse-gamma prior for the variance. Specifying the gibbs option is equivalent to specifying block()'s gibbs suboption for all default blocks of parameters. If you use the block() option to define your own blocks of parameters, the gibbs option will have no effect on those blocks, and an MH algorithm will be used to update parameters in those blocks unless you also specify block()'s gibbs suboption.

normalprior(#) specifies the standard deviation of the default normal priors. The default is normalprior(100). The normal priors are used for scalar parameters defined on the whole real line; see Default priors for details.

igammaprior(# #) specifies the shape and scale parameters of the default inverse-gamma priors. The default is igammaprior(0.01 0.01). The inverse-gamma priors are used for positive scalar parameters such as a variance; see Default priors for details. Instead of a number #, you can specify a missing value (.) to refer to the default value of 0.01.

iwishartprior(# [matname] [, relevel(levelvar)]) specifies the degrees of freedom and, optionally, the scale matrix matname of the default inverse-Wishart priors used for unstructured covariances of random effects with multilevel models. The degrees of freedom # is a positive real scalar with the default value of d+1, where d is the number of random-effects terms at the level of hierarchy levelvar. Instead of a number #, you can specify a missing value (.) to refer to the default value. Matrix name matname is the name of a positive-definite Stata matrix with the default of I(d), the identity matrix of dimension d. If relevel(levelvar) is omitted, the specified parameters are used for inverse-Wishart priors for all levels with unstructured random-effects covariances. Otherwise, they are used only for the prior for the specified level levelvar. See Default priors for details.

prior(priorspec) specifies a prior distribution for model parameters. This option may be repeated. A prior may be specified for any of the model parameters, except the random-effects parameters in multilevel models. Model parameters with the same prior specifications are placed in a separate block. Model parameters that are not included in prior specifications are assigned default priors; see Default priors for details. Model parameters may be scalars or matrices, but both types may not be combined in one prior statement. If multiple scalar parameters are assigned a single univariate prior, they are considered independent, and the specified prior is used for each parameter. You may assign a multivariate prior of dimension d to d scalar parameters. Also see Referring to model parameters in [BAYES] bayesmh.

All prior() distributions are allowed, but they are not guaranteed to correspond to proper posterior distributions for all likelihood models. You need to think carefully about the model you are building and evaluate its convergence thoroughly.

dryrun specifies to show the summary of the model that would be fit without actually fitting the model. This option is recommended for checking specifications of the model before fitting the model. The model summary reports the information about the likelihood model and about priors for all model parameters.

+------------+ ----+ Simulation +-------------------------------------------------------

mcmcsize(#) specifies the target MCMC sample size. The default MCMC sample size is mcmcsize(10000). The total number of iterations for the MH algorithm equals the sum of the burn-in iterations and the MCMC sample size in the absence of thinning. If thinning is present, the total number of MCMC iterations is computed as burnin() + (mcmcsize() - 1) x thinning() + 1. Computation time of the MH algorithm is proportional to the total number of iterations. The MCMC sample size determines the precision of posterior summaries, which may be different for different model parameters and will depend on the efficiency of the Markov chain. Also see Burn-in period and MCMC sample size in [BAYES] bayesmh.

burnin(#) specifies the number of iterations for the burn-in period of MCMC. The values of parameters simulated during burn-in are used for adaptation purposes only and are not used for estimation. The default is burnin(2500). Typically, burn-in is chosen to be as long as or longer than the adaptation period. The burn-in period may need to be larger for multilevel models because these models introduce high-dimensional random-effects parameters and thus require longer adaptation period. Also see Burn-in period and MCMC sample size in [BAYES] bayesmh and Convergence of MCMC in [BAYES] bayesmh.

thinning(#) specifies the thinning interval. Only simulated values from every (1+k x #)th iteration for k = 0, 1, 2, ... are saved in the final MCMC sample; all other simulated values are discarded. The default is thinning(1); that is, all simulation values are saved. Thinning greater than one is typically used for decreasing the autocorrelation of the simulated MCMC sample.

rseed(#) sets the random-number seed. This option can be used to reproduce results. rseed(#) is equivalent to typing set seed # prior to calling the bayes prefix; see [R] set seed and Reproducing results in [BAYES] bayes.

exclude(paramref) specifies which model parameters should be excluded from the final MCMC sample. These model parameters will not appear in the estimation table, and postestimation features for these parameters and log marginal likelihood will not be available. This option is useful for suppressing nuisance model parameters. For example, if you have a factor predictor variable with many levels but you are only interested in the variability of the coefficients associated with its levels, not their actual values, then you may wish to exclude this factor variable from the simulation results. If you simply want to omit some model parameters from the output, see the noshow() option. paramref can include individual random-effects parameters.

restubs(restub1 restub2 ...) specifies the stubs for the names of random-effects parameters. You must specify stubs for all levels -- one stub per level. This option overrides the default random-effects stubs. See Likelihood model for details about the default names of random-effects parameters.

+----------+ ----+ Blocking +---------------------------------------------------------

blocksize(#) specifies the maximum block size for the model parameters; default is blocksize(50). This option does not apply to random-effects parameters. Each group of random-effects parameters is placed in one block, regardless of the number of random-effects parameters in that group.

block(paramref[, blockopts]) specifies a group of model parameters for the blocked MH algorithm. By default, model parameters, except the random-effects parameters, are sampled as independent blocks of 50 parameters or of the size specified in option blocksize(). Regression coefficients from different equations are placed in separate blocks. Auxiliary parameters such as variances and correlations are sampled as individual separate blocks, whereas the cutpoint parameters of the ordinal-outcome regressions are sampled as one separate block. With multilevel models, each group of random-effects parameters is placed in a separate block, and the block() option is not allowed with random-effects parameters. The block() option may be repeated to define multiple blocks. Different types of model parameters, such as scalars and matrices, may not be specified in one block(). Parameters within one block are updated simultaneously, and each block of parameters is updated in the order it is specified; the first specified block is updated first, the second is updated second, and so on. See Improving efficiency of the MH algorithm---blocking of parameters in [BAYES] bayesmh.

blockopts include gibbs, split, scale(), covariance(), and adaptation().

gibbs specifies to use Gibbs sampling to update parameters in the block. This option is allowed only for hyperparameters and only for specific combinations of prior and hyperprior distributions; see Gibbs sampling for some likelihood-prior and prior-hyperprior configurations in [BAYES] bayesmh. For more information, see Gibbs and hybrid MH sampling in [BAYES] bayesmh. gibbs may not be combined with scale(), covariance(), or adaptation().

split specifies that all parameters in a block are treated as separate blocks. This may be useful for levels of factor variables.

scale(#) specifies an initial multiplier for the scale factor corresponding to the specified block. The initial scale factor is computed as #/sqrt{n_p} for continuous parameters and as #/n_p for discrete parameters, where n_p is the number of parameters in the block. The default is scale(2.38). If specified, this option overrides the respective setting from the scale() option specified with the command. scale() may not be combined with gibbs.

covariance(matname) specifies a scale matrix matname to be used to compute an initial proposal covariance matrix corresponding to the specified block. The initial proposal covariance is computed as rho x Sigma, where rho is a scale factor and Sigma = matname. By default, Sigma is the identity matrix. If specified, this option overrides the respective setting from the covariance() option specified with the command. covariance() may not be combined with gibbs.

adaptation(tarate()) and adaptation(tolerance()) specify block-specific TAR and acceptance tolerance. If specified, they override the respective settings from the adaptation() option specified with the command. adaptation() may not be combined with gibbs.

blocksummary displays the summary of the specified blocks. This option is useful when block() is specified.

noblocking requests that no default blocking is applied to model parameters. By default, model parameters are sampled as independent blocks of 50 parameters or of the size specified in option blocksize(). For multilevel models, this option has no effect on random-effects parameters; blocking is always applied to them.

+----------------+ ----+ Initialization +---------------------------------------------------

initial(initspec) specifies initial values for the model parameters to be used in the simulation. You can specify a parameter name, its initial value, another parameter name, its initial value, and so on. For example, to initialize a scalar parameter alpha to 0.5 and a 2x2 matrix Sigma to the identity matrix I(2), you can type

bayes, initial({alpha} 0.5 {Sigma,m} I(2)): ...

You can also specify a list of parameters using any of the specifications described in Referring to model parameters in [BAYES] bayesmh. For example, to initialize all regression coefficients from equations y1 and y2 to zero, you can type

bayes, initial({y1:} {y2:} 0): ...

The general specification of initspec is

paramref # [paramref # []]

Curly braces may be omitted for scalar parameters but must be specified for matrix parameters. Initial values declared using this option override the default initial values or any initial values declared during parameter specification in the likelihood() option. See Specifying initial values in [BAYES] bayesmh for details.

nomleinitial suppresses using maximum likelihood estimates (MLEs) starting values for model parameters. By default, when no initial values are specified, MLE values from estimation_command are used as initial values. For multilevel commands, MLE estimates are used only for regression coefficients. Random effects are assigned zero values, and random-effects variances and covariances are initialized with ones and zeros, respectively. If nomleinitial is specified and no initial values are provided, the command uses ones for positive scalar parameters, zeros for other scalar parameters, and identity matrices for matrix parameters. nomleinitial may be useful for providing an alternative starting state when checking convergence of MCMC. This option cannot be combined with initrandom.

initrandom requests that the model parameters be initialized randomly. Random initial values are generated from the prior distributions of the model parameters. If you want to use fixed initial values for some of the parameters, you can specify them in the initial() option or during parameter declarations in the likelihood() option. Random initial values are not available for parameters with flat, density(), logdensity(), and jeffreys() priors; you must provide fixed initial values for such parameters. This option cannot be combined with nomleinitial.

initsummary specifies that the initial values used for simulation be displayed.

noisily specifies that the output from the estimation command be shown during initialization. The estimation command is executed once to set up the model and calculate initial values for model parameters.

+------------+ ----+ Adaptation +-------------------------------------------------------

adaptation(adaptopts) controls adaptation of the MCMC procedure. Adaptation takes place every prespecified number of MCMC iterations and consists of tuning the proposal scale factor and proposal covariance for each block of model parameters. Adaptation is used to improve sampling efficiency. Provided defaults are based on theoretical results and may not be sufficient for all applications. See Adaptation of the MH algorithm in [BAYES] bayesmh for details about adaptation and its parameters.

adaptopts are any of the following options:

every(#) specifies that adaptation be attempted every #th iteration. The default is every(100). To determine the adaptation interval, you need to consider the maximum block size specified in your model. The update of a block with k model parameters requires the estimation of a k x k covariance matrix. If the adaptation interval is not sufficient for estimating the k(k+1)/2 elements of this matrix, the adaptation may be insufficient.

maxiter(#) specifies the maximum number of adaptive iterations. Adaptation includes tuning of the proposal covariance and of the scale factor for each block of model parameters. Once the TAR is achieved within the specified tolerance, the adaptation stops. However, no more than # adaptation steps will be performed. The default is variable and is computed as max{25,floor(burnin()/adaptation(every()))}.

maxiter() is usually chosen to be no greater than (mcmcsize()+burnin())/adaptation(every()).

miniter(#) specifies the minimum number of adaptive iterations to be performed regardless of whether the TAR has been achieved. The default is miniter(5). If the specified miniter() is greater than maxiter(), then miniter() is reset to maxiter(). Thus, if you specify maxiter(0), then no adaptation will be performed.

alpha(#) specifies a parameter controlling the adaptation of the AR. alpha() should be in [0,1]. The default is alpha(0.75).

beta(#) specifies a parameter controlling the adaptation of the proposal covariance matrix. beta() must be in [0,1]. The closer beta() is to zero, the less adaptive the proposal covariance. When beta() is zero, the same proposal covariance will be used in all MCMC iterations. The default is beta(0.8).

gamma(#) specifies a parameter controlling the adaptation rate of the proposal covariance matrix. gamma() must be in [0,1]. The larger the value of gamma(), the less adaptive the proposal covariance. The default is gamma(0).

tarate(#) specifies the TAR for all blocks of model parameters; this is rarely used. tarate() must be in (0,1). The default AR is 0.234 for blocks containing continuous multiple parameters, 0.44 for blocks with one continuous parameter, and 1/n_maxlev for blocks with discrete parameters, where n_maxlev is the maximum number of levels for a discrete parameter in the block.

tolerance(#) specifies the tolerance criterion for adaptation based on the TAR. tolerance() should be in (0,1). Adaptation stops whenever the absolute difference between the current AR and TAR is less than tolerance(). The default is tolerance(0.01).

scale(#) specifies an initial multiplier for the scale factor for all blocks. The initial scale factor is computed as #/sqrt{n_p} for continuous parameters and #/n_p for discrete parameters, where n_p is the number of parameters in the block. The default is scale(2.38).

covariance(cov) specifies a scale matrix cov to be used to compute an initial proposal covariance matrix. The initial proposal covariance is computed as rho x Sigma, where rho is a scale factor and Sigma = matname. By default, Sigma is the identity matrix. Partial specification of Sigma is also allowed. The rows and columns of cov should be named after some or all model parameters. According to some theoretical results, the optimal proposal covariance is the posterior covariance matrix of model parameters, which is usually unknown. This option does not apply to the blocks containing random-effects parameters.

+-----------+ ----+ Reporting +--------------------------------------------------------

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.

eform_option causes the coefficient table to be displayed in exponentiated form; see [R] eform_option. The estimation command determines which eform_option is allowed (eform(string) and eform are always allowed).

remargl specifies to compute the log marginal likelihood for multilevel models. It is not reported by default for multilevel models. Bayesian multilevel models contain many parameters because, in addition to regression coefficients and variance components, they also estimate individual random effects. The computation of the log marginal likelihood involves the inverse of the determinant of the sample covariance matrix of all parameters and loses its accuracy as the number of parameters grows. For high-dimensional models such as multilevel models, the computation of the log marginal likelihood can be time consuming, and its accuracy may become unacceptably low. Because it is difficult to access the levels of accuracy of the computation for all multilevel models, the log marginal likelihood is not reported by default. For multilevel models containing a small number of random effects, you can use the remargl option to compute and display the log marginal likelihood.

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

saving(filename[, replace]) saves simulation results in filename.dta. The replace option specifies to overwrite filename.dta if it exists. If the saving() option is not specified, the bayes prefix saves simulation results in a temporary file for later access by postestimation commands. This temporary file will be overridden every time the bayes prefix is run and will also be erased if the current estimation results are cleared. saving() may be specified during estimation or on replay.

The saved dataset has the following structure. Variance _index records iteration numbers. The bayes prefix saves only states (sets of parameter values) that are different from one iteration to another and the frequency of each state in variable _frequency. (Some states may be repeated for discrete parameters.) As such, _index may not necessarily contain consecutive integers. Remember to use _frequency as a frequency weight if you need to obtain any summaries of this dataset. Values for each parameter are saved in a separate variable in the dataset. Variables containing values of parameters without equation names are named as eq0_p#, following the order in which parameters are declared in the bayes prefix. Variables containing values of parameters with equation names are named as eq#_p#, again following the order in which parameters are defined. Parameters with the same equation names will have the same variable prefix eq#. For example,

. bayes, saving(mcmc): ...

will create a dataset, mcmc.dta, with variable names eq1_p1 for {y:x1}, eq1_p2 for {y:_cons}, and eq0_p1 for {var}. Also see macros e(parnames) and e(varnames) for the correspondence between parameter names and variable names.

In addition, the bayes prefix saves variable _loglikelihood to contain values of the log likelihood from each iteration and variable _logposterior to contain values of the log posterior from each iteration.

nomodelsummary suppresses the detailed summary of the specified model. The model summary is reported by default.

nomesummary suppresses the summary about the multilevel structure of the model. This summary is reported by default for multilevel commands.

nodots, dots, and dots(#) specify to suppress or display dots during simulation. dots(#) displays a dot every # iterations. During the adaptation period, a symbol a is displayed instead of a dot. If dots(..., every(#)) is specified, then an iteration number is displayed every #th iteration instead of a dot or a. dots(, every(#)) is equivalent to dots(1, every(#)). dots displays dots every 100 iterations and iteration numbers every 1,000 iterations; it is a synonym for dots(100), every(1000). dots is the default with multilevel commands, and nodots is the default with other commands.

show(paramref) or noshow(paramref) specifies a list of model parameters to be included in the output or excluded from the output, respectively. By default, all model parameters (except random-effects parameters with multilevel models) are displayed. Do not confuse noshow() with exclude(), which excludes the specified parameters from the MCMC sample. When the noshow() option is specified, for computational efficiency, MCMC summaries of the specified parameters are not computed or stored in e(). paramref can include individual random-effects parameters.

showreffects and showreffects(reref) are used with multilevel commands and specify that all or a list reref of random-effects parameters be included in the output in addition to other model parameters. By default, all random-effects parameters are excluded from the output as if you have specified the noshow() option. This option computes, displays, and stores in e() MCMC summaries for the first #_matsize-#_npar random-effects parameters, where #_matsize is the maximum number of variables as determined by matsize (see [R] matsize) and #_npar is the number of other model parameters displayed. If you want to obtain MCMC summaries and display other random-effects parameters, you can use the show() option or use bayesstats summary (see [BAYES] bayesstats summary).

melabel specifies that the bayes prefix use the same row labels as estimation_command in the estimation table. This option is allowed only with multilevel commands. It is useful to match the estimation table output of bayes: mecmd with that of mecmd. This option implies nomesummary and nomodelsummary.

nogroup suppresses the display of group summary information (number of groups, average group size, minimum, and maximum) from the output header. This option is for use with multilevel commands.

notable suppresses the estimation table from the output. By default, a summary table is displayed containing all model parameters except those listed in the exclude() and noshow() options. Regression model parameters are grouped by equation names. The table includes six columns and reports the following statistics using the MCMC simulation results: posterior mean, posterior standard deviation, MCMC standard error or MCSE, posterior median, and credible intervals.

noheader suppresses the output header either at estimation or upon replay.

title(string) specifies an optional title for the command that is displayed above the table of the parameter estimates. The default title is specific to the specified likelihood model.

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

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

search(search_options) searches for feasible initial values. search_options are on, repeat(#), and off.

search(on) is equivalent to search(repeat(500)). This is the default.

search(repeat(k)), k>0, specifies the number of random attempts to be made to find a feasible initial-value vector, or initial state. The default is repeat(500). An initial-value vector is feasible if it corresponds to a state with positive posterior probability. If feasible initial values are not found after k attempts, an error will be issued. repeat(0) (rarely used) specifies that no random attempts be made to find a feasible starting point. In this case, if the specified initial vector does not correspond to a feasible state, an error will be issued.

search(off) prevents the command from searching for feasible initial values. We do not recommend specifying this option.

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

--------------------------------------------------------------------------- Logistic regression example

Setup . webuse lbw

Bayesian logistic model for the outcome variable low . bayes: logit low age i.race ptl ui

Specifying a block() option . bayes, block({low:i.race}): logit low age i.race ptl ui

Specifying a prior() option . bayes, prior({low:i.race}, normal(0, 1)) block({low:i.race}): logit low age i.race ptl ui

--------------------------------------------------------------------------- Truncated Poisson regression example

Setup . webuse runshoes

Bayesian truncated Poisson regression with default truncation point of 0 . bayes: tpoisson shoes distance i.male age

Bayesian Poisson regression with truncation point of 3 and exposure variable age . replace shoes = . if shoes < 4 . bayes: tpoisson shoes distance male, exposure(age) ll(3)

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

Video examples

Introduction to Bayesian statistics, part 1: The basic concepts

Introduction to Bayesian statistics, part 2: MCMC and the Metropolis-Hastings algorithm

A prefix for Bayesian regression in Stata

Bayesian linear regression using the bayes prefix

Bayesian linear regression using the bayes prefix: How to specify custom priors

Bayesian linear regression using the bayes prefix: Checking convergence of the MCMC chain

Bayesian linear regression using the bayes prefix: How to customize the MCMC chain

Stored results

In addition to the results stored by bayesmh, the bayes prefix stores the following in e():

Scalars e(priorsigma) standard deviation of default normal priors e(priorshape) shape of default inverse-gamma priors e(priorscale) scale of default inverse-gamma priors e(blocksize) maximum size for blocks of model parameters

Macros e(prefix) bayes e(cmdname) command name from estimation_command e(cmd) same as e(cmdname) e(command) estimation command line


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