Announcement

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

  • Plotting credible intervals from a bayesian model

    I have created a bayesian model and now I'd like to visualize the model's output by plotting the credible intervals for certain parameter. How would I do that?
    Code:
    sysuse auto, clear
    set seed 12345
    
    bayesmh mpg foreign, likelihood(normal({var})) prior({mpg:_cons foreign}, flat) prior({var}, jeffreys)
    The above code is just a working example, but how would I plot the posterior mean of foreign and its credible intervals? Additionally, some assistance in making a triplot (likelihood, prior probability and posterior probability) would be much appreciated.
    Last edited by Dougie Jones; 30 Jul 2018, 08:36.

  • #2
    No one?

    Comment


    • #3
      This is not a complete answer, and I am not yet familiar with Stata's Bayesian estimation commands. It may be interesting to you to examine the posted estimation results, using -ereturn list-. One of the listed results is called "cri" which seems to be the credible intervals. Following your example code, you can view the contents of -e(cri)- using -matrix list e(cri)- which gives the following output.

      Code:
      . matrix list e(cri)
      
      e(cri)[2,3]
                   mpg:       mpg:          
               foreign      _cons        var
      Lower  2.0341353  18.271162  20.827042
      Upper  7.7758433  21.358019  41.501285
      Indeed, these are the credible intervals. I think this will give you enough to get started.

      Comment

      Working...
      X