Dear Forum Members,
I came a cross a quite simple example of Bayesian analysis (from the book Think Bayes, written by Allen Downeyfor Python users) which can be done directly, I mean, just by using the Bayes' theorem.
In short, there are 2 baskets with cookies. In basket 1, 30 vanilla cookies and 10 chocolate cookies. In basket 2, 20 vanilla cookies and 20 chocolate cookies.
Below, I generate a dataset accordingly:
Code:
input basket str20 cookie freq 1 vanilla 30 1 chocolate 10 2 vanilla 20 2 chocolate 20 end expand freq encode cookie, gen(vanilla) drop freq
Using the Bayes formula, we get: Posterior = (3/4 *1/2)/ (50/80) = 0.35/0.625 = 0.56 = 56%
That said, I wish to perform the estimation in Stata.
I tryed hard with - bayesmh -, to no avail so far.
Thank you in advance for any advice.
0 Response to How to replicate this simple (Bayesian) calculation in Stata
Post a Comment