>> Home >> Products >> Features >> Bayesian analysis
Order Stata

Bayesian analysis

Fit Bayesian regression models using a Metropolis–Hastings Markov chain Monte Carlo (MCMC) method. You can choose from a variety of supported models or even program your own. Extensive graphical tools are available to check convergence visually. Compute posterior mean estimates and credible intervals for model parameters and functions of model parameters. You can perform both interval and model-based hypothesis testing. Compare models using Bayes factors. And much more.

Learn about Bayesian analysis.

Also see an Overview example.


  • Thousands of built-in models, by combining
    • 10 likelihood models including univariate and multivariate normal, logit, probit, ordered logit, ordered probit, Poisson, ...
    • 18 prior distributions including normal, lognormal, multivariate normal, gamma, beta, Wishart, ...
    • Continuous, binary, ordinal, and count outcomes
    • Univariate, multivariate, and multiple-equation models
    • Linear and nonlinear models
    • Continuous univariate, multivariate, and discrete priors
  • Use GUI to fit models
  • Use command language to fit models

Classes of models

Likelihood models

Prior distributions

Markov chain Monte Carlo (MCMC) methods

  • Adaptive Metropolis-Hastings (MH)
  • Hybrid MH (adaptive MH with Gibbs updates)
  • Full Gibbs sampling for some models

Adaptive MH sampling

  • Blocking of parameters
  • Adaptation within each block
  • Diminishing adaptation
  • Random-effects parametersNew
  • Control scale and covariance of the proposal distribution
  • Control adaptation
    • Length of adaptation
    • Maximum and minimum numbers of adaptive iterations
    • Acceptance rate
    • Adaptation rate
    • Target acceptance rate
    • Acceptance rate tolerance


Starting values

  • Automatic
  • May specify for some or all parameters

Factor variables

  • Automatically create indicators based on categorical variables
  • Form interactions among discrete and continuous variables
  • Include polynomial terms
Watch Introduction to Factor Variables in Stata tutorials

Add your own models

  • Write your own programs to calculate likelihood function and choose built-in priors
  • Write you own programs to calculate posterior density directly
  • Use built-in adaptive MH sampling to simulate marginal posterior

Postestimation Selector New

  • View and run all postestimation features for your command
  • Automatically updated as estimation commands are run

Graphical tools to check MCMC convergence

  • Diagnostics plots in compact form
  • Trace plots
  • Autocorrelation plots
  • Histograms
  • Density plots
  • Cumulative sum plots
  • Bivariate scatterplots
  • Produce any of above for parameters or functions of parameters
  • Multiple separate graphs or multiple plots on one graph
  • Pause between multiple graphs
  • Customize the look of each graph

Tools to check MCMC efficiency

  • Effective sample sizes
  • Autocorrelation times
  • Efficiencies
  • Compute any of above for parameters or functions of parameters

Posterior summaries

MCSE estimation methods

  • using effective sample size
  • using batch means

Hypothesis testing

Model comparison

Save your MCMC and estimation results for future use

Additional resources

See New in Stata 14 for more about what was added in Stata 14.





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ YouTube
© Copyright 1996–2017 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us