This is analogous to the archetypal example of Bayesian inference wherein the likelihood of actual breast cancer is evaluated in light of a positive mammogram ("test"). The "test" in this case would be listening for the sound of a barking dog prior to breaking into a home. A true positive would be hearing a barking dog when there is such a dog (analogous to a positive mammogram and actual breast cancer). A false positive would be hearing a barking dog when none exists, i.e., when the Home Speaker sounds a dog alarm but there is no dog.
In order to come up with an estimate of my safety when breaking in should I hear a barking dog, I need to have an estimate for:
- The fraction of homes have appropriate (i.e., big and scary) dogs (analogous to how many women have breast cancer).
- The fraction of homes have a barking dog sound generator (analogous to a false positive).
- The fraction of the time that, if there is a big, scary dog in the house, it will bark and I will hear it (analogous to a true positive).
In the table below, I've shown that 12% of homes have a big (barking) dog, and 88% do not. When I hear a big, scary dog, I'm in the "Test pos" row. The 0.108 entry is the 0.12 fraction of homes with a big, scary dog * the 0.9 fraction that the dog will bark and I will hear it. The 0.0176 entry is the 0.88 fraction of homes with no big, scary dog * the 0.02 fraction of homes with a barking dog sound generator.
Actual big dog | No actual big dog | |
---|---|---|
0.12 | 0.88 | |
Test pos (heard barking big dog) | 0.108 | 0.0176 |
Test neg (didn't hear barking big dog) | 0.012 | 0.8624 |
Now, the probability of a true positive (I hear a big, scary dog and there's actually one in the house) is the number of true positives divided by the total number of positives, or 0.108/(0.108+0.0176)=0.8599 or about 86%. Of course, this number will vary, depending on the actual values for the needed parameters but I think that this is in the ballpark.
Moral of the story: If I'm intending to burgle a house and I hear a big, scary dog, I'd best move on.