I've blogged about and applied it several times:
- A background on Bayes' Theorem
- Prelude to What's Bayes' Got to Do With It?
- What's Bayes' Got to Do With It?
- Bayesian Inference in a Galaxy Far Away
And I highly recommend a couple books to learn more about Bayes': The Theory that Wouldn't Die and Doing Bayesian Analysis. But this morning, I read an excellent demonstration of Bayes' theorem - what is the probability the post's author is asleep given her bedroom light is on?
I have more than 2 months of data from my Garmin Vivosmart watch showing when I fall asleep and wake up. In a previous post, I figured out the probability I am asleep at a given time using Markov Chain Monte Carlo (MCMC) methods.She's shared her code for these calculations in a Jupyter Notebook, which you check out here.
This is the probability I am asleep taking into account only the time. What if we know the time and have additional evidence? How would knowing that my bedroom light is on change the probability that I am asleep?
We will walk through applying the equation for a time of 10:30 PM if we know my light is on. First, we calculate the prior probability I am asleep using the time and get an answer of 73.90%. The prior provides a good starting point for our estimate, but we can improve it by incorporating info about my light. Knowing that my light is on, we can fill in Bayes’ Equation with the relevant numbers
The knowledge that my light is on drastically changes our estimate of the probability I am asleep from over 70% to 3.42%. This shows the power of Bayes’ Rule: we were able to update our initial estimate for the situation by incorporating more information. While we might have intuitively done this anyway, thinking about it in terms of formal equations allows us to update our beliefs in a rigorous manner.