Bayes: Update complete!

Let’s start by jumping right into the deep end: Bayesian analysis. If you’ve ever taken statistics, then more likely than not, you’ve heard of this concept. However, I bet most people’s training have been in frequentist statistics, so they’re not as familiar with Bayesian statistics. I will avoid going on a long history lesson and will try to avoid as many equations as possible. That information is readily available through DuckDuckGo.

The basics: with Bayes, we use prior and new knowledge to update our analysis, through conditional probabilities. We answer questions like, What is the likelihood of having hepatitis C if your hepatitis C test is positive (this is also positive predictive value for you diagnostic test fans out there)? What’s the probability of scoring another date given that last night’s was so dreadful?

Think about picking a winner based on previous wins. You always get a successful date 8/10 times, so why not expect you’ll always have a successful date 80% of the time? What if there’s new info? What if 5 out of the 8 times you were successful you used AXE body spray? But, there was also one unsuccessful date when you used it. How would you incorporate this info? Or formally: What is the probability that you will have a successful date now given that you use AXE body spray again?

Let’s turn this into a cross-tabulation.

Bayes table

You had 8 total successful dates, 5 of which you used AXE, 3 of which you didn’t. One date you used AXE was unsuccessful. Since there were a total of two unsuccessful dates, the other date did not have the use of AXE. You can add by row and by column to get totals.

Now, I said I would try to avoid equations, but it’s much easier to express this by notation and Bayes has a neat little equation that helps us out.

It is the p(A|B) = p(B|A) * p(A) / p(B).

A is a successful date, B is the use of AXE, p is the probability. p(A) and p(B) are straightforward. You had successful dates 8/10 = 80% of the time and you used AXE 6/10 = 60% of the time. p(B|A) is a little more tricky, it’s the probability of using AXE given that you had a successful date (akin to positive predictive value), so you’d want to know how many successful dates had the use of AXE, or 5/(5+3) = 5/8 = 63%.

The equation is now p(A|B) = (0.63 * 0.80) / (0.60) = 0.504/0.60 = 0.84 = 84%. Therefore the probability that you will have a successful date given that you use AXE now is 84%. Contrast that with 80% if you just decided to go forward without any changes. Now make yourself smell beautiful!

OK, now you know how to do it by hand. How do you do it in the real world when there are far more variables to consider? Yes, you can use Bayes with regression. But here’s the difference from the frequentist method: You must decide a prior!

Hold up, we need to define some terminology.

prior: the strength of belief in your predicted probability without the new evidence (e.g., p(A))

evidence: that new information that may influence your prior, p(B)

likelihood: probability of seeing evidence with our prior, p(B|A)

posterior: new belief after the evidence is incorporated, p(A|B)

So there we have it. If your statistical software has Bayes capability, you should be able to specify a prior with an accompanying distribution. What if you don’t know your prior? Then use an uninformative prior (now how this is different from frequentist is something I’m still trying to figure out)! Check the manual for your software for specific commands.

If you run a Bayes STATA command with all your settings, it will give you an estimate and a credible interval. A credible interval is interpreted similarly to a confidence interval. For a 95% credible interval, there is a 95% chance that the estimate falls within that interval.

Summary: We went through the core concepts of Bayesian analysis with an example. I shed light on how it may be used in the real world.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s