Bayesian Analysis with Stata is a compendium of Stata community-contributed commands for Bayesian analysis. It contains just enough theoretical and foundational material to be useful to all levels of users interested in Bayesian statistics, from neophytes to aficionados.
The book is careful to introduce concepts and coding tools incrementally so that there are no steep patches or discontinuities in the learning curve. The content helps the user see exactly what computations are done for simple standard models and shows the user how those computations are implemented. Understanding these concepts is important for users because Bayesian analysis lends itself to custom or very complex models, and users must be able to code these themselves. Bayesian Analysis with Stata is wonderful because it goes through the computational methods three times—first using Stata's ado-code, then using Mata, and finally using Stata to run the MCMC chains with WinBUGS or OpenBUGS. This reinforces the material while making all three methods accessible and clear. Once the book explains the computations and underlying methods, it satisfies the user's yearning for more complex models by providing examples and advice on how to implement such models. The book covers advanced topics while showing the basics of Bayesian analysis—which is quite an achievement.
Bayesian Analysis with Stata presents all the material using real datasets rather than simulated datasets, and there are many exercises that also use real datasets. There is also a chapter on validating code for users who like to learn by simulating models and recovering the known models. This provides users with the opportunity to gain experience in assessing and running Bayesian models and teaches users to be careful when doing so.
The book starts by discussing the principles of Bayesian analysis and by explaining the thought process underlying it. It then builds from the ground up, showing users how to write evaluators for posteriors in simple models and how to speed them up using algebraic simplification.
Of course, this type of evaluation is useful only in very simple models, so the book then addresses the MCMC methods used throughout the Bayesian world. Once again, this starts from the fundamentals, beginning with the Metropolis–Hastings algorithm and moving on to Gibbs samplers. Because the latter are much quicker to use but are often intractable, the book thoroughly explains the specialty tools of Griddy sampling, slice sampling, and adaptive rejection sampling.
After discussing the computational tools, the book changes its focus to the MCMC assessment techniques needed for a proper Bayesian analysis; these include assessing convergence and avoiding problems that can arise from slowly mixing chains. This is where burn-in gets treated, and thinning and centering are used for performance gains.
The book then returns its focus to computation. First, it shows users how to use Mata in place of Stata's ado-code; second, it demonstrates how to pass data and models to WinBUGS or OpenBUGS and retrieve its output. Using Mata speeds up evaluation time. However, using WinBUGS or OpenBUGS further speeds evaluation time, and each one opens a toolbox, which reduces the amount of custom Stata programming needed for complex models. This material is easy for the book to introduce and explain because it has already laid the conceptual and computational groundwork.
The book finishes with detailed chapters on model checking and selection, followed by a series of case studies that introduce extra modeling techniques and give advice on specialized Stata code. These chapters are very useful because they allow the book to be a self-contained introduction to Bayesian analysis while providing additional information on models that are normally beyond a basic introduction.