Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bayesian analysis in Stata

    I will be leading a workshop on Bayesian analysis, where I need to make all Baysian analyses as simple as possible for the particular audience. Therefore, I've decided to allow participants to choose between R and Stata. I assume that for many researchers, initial use of Bayes might be easier in Stata. (I've never used Stata for Bayesian analysis before myself.)

    But when using Stata's convenient bayes: prefix, I'm not able to get the PPP (posterior predictive p-value), which summarises the discrepancies between the model and the data.

    Code:
    . bayespredict {_ysim1} {_ysim2}, saving(prdata)
    bayespredict is supported only after bayesmh
    Which would make running Bayesian analyses easier in R (with the blavaan package) than in Stata. Is there no possible way to get Stata to provide the PPP after the bayes: prefix? As data analysists, we always need the PPP after running Bayes.

    If PPP is not computed after the bayes: prefix, I would suggest including PPP by default in Stata 18.
    I also suggest increasing the default number of chains to (at least) 2, rather than the current 1. I believe Bayesian statisticians will agree that Bayesian analyses should always use at least 2 chains to ensure robust results (some suggest 3 chains).

  • #2
    You don't tell us what estimation command you ran using the bayes: prefix, so I want to point out, for other readers here, that the output of
    Code:
    help bayespredict
    tells us that the error message shown in post #1 is inaccurate: bayespredict is supported by the bayes prefix for a limited number of estimation commands.
    Code:
        bayespredict computes Bayesian predictions using current estimation
        results produced by bayesmh with built-in likelihood models or by
        bayes: var, bayes: xtreg, bayes: xtlogit, bayes: xtprobit, bayes:
        xtologit, bayes: xtoprobit, bayes: xtpoisson, bayes: xtnbreg, or
        bayes: xtmlogit.

    Comment


    • #3
      Thanks for the correction. To make things simple when teaching, I do

      Code:
      bayes: reg y x1 x2

      Comment


      • #4
        PS. This might be of help to others:

        I tried bayesmh instead of bayes: and found that bayesmh seems much faster. A follow-up for analysts considering Bayes with Stata: it might be better to use bayesmh rather than the easier bayes:
        Speed is still an issue when running complex models (more than in Mplus, but less than in R in my experience). So, speed can be one reason to use bayesmh, in addition, bayes: might not give you the information you need, at least in Stata 17.

        Also, if using bayes:/bayesmh, please add the option nchains(2) or nchains(3), or even more chains if needed.

        Comment

        Working...
        X