{"items":["5fa159802aa2eb001780f242","5f9b0e933d112900183281df","5f60e638efb61e00176c4ac0"],"styles":{"galleryType":"Columns","groupSize":1,"showArrows":true,"cubeImages":true,"cubeType":"max","cubeRatio":1.7777777777777777,"isVertical":true,"gallerySize":30,"collageAmount":0,"collageDensity":0,"groupTypes":"1","oneRow":false,"imageMargin":30,"galleryMargin":0,"scatter":0,"rotatingScatter":"","chooseBestGroup":true,"smartCrop":false,"hasThumbnails":false,"enableScroll":true,"isGrid":true,"isSlider":false,"isColumns":false,"isSlideshow":false,"cropOnlyFill":false,"fixedColumns":0,"enableInfiniteScroll":true,"isRTL":false,"minItemSize":50,"rotatingGroupTypes":"","rotatingCropRatios":"","columnWidths":"","gallerySliderImageRatio":1.7777777777777777,"numberOfImagesPerRow":3,"numberOfImagesPerCol":1,"groupsPerStrip":0,"borderRadius":0,"boxShadow":0,"gridStyle":0,"mobilePanorama":false,"placeGroupsLtr":false,"viewMode":"preview","thumbnailSpacings":4,"galleryThumbnailsAlignment":"bottom","isMasonry":false,"isAutoSlideshow":false,"slideshowLoop":false,"autoSlideshowInterval":4,"bottomInfoHeight":0,"titlePlacement":["SHOW_ON_THE_RIGHT","SHOW_BELOW"],"galleryTextAlign":"center","scrollSnap":false,"itemClick":"nothing","fullscreen":true,"videoPlay":"hover","scrollAnimation":"NO_EFFECT","slideAnimation":"SCROLL","scrollDirection":0,"scrollDuration":400,"overlayAnimation":"FADE_IN","arrowsPosition":0,"arrowsSize":23,"watermarkOpacity":40,"watermarkSize":40,"useWatermark":true,"watermarkDock":{"top":"auto","left":"auto","right":0,"bottom":0,"transform":"translate3d(0,0,0)"},"loadMoreAmount":"all","defaultShowInfoExpand":1,"allowLinkExpand":true,"expandInfoPosition":0,"allowFullscreenExpand":true,"fullscreenLoop":false,"galleryAlignExpand":"left","addToCartBorderWidth":1,"addToCartButtonText":"","slideshowInfoSize":200,"playButtonForAutoSlideShow":false,"allowSlideshowCounter":false,"hoveringBehaviour":"NEVER_SHOW","thumbnailSize":120,"magicLayoutSeed":1,"imageHoverAnimation":"NO_EFFECT","imagePlacementAnimation":"NO_EFFECT","calculateTextBoxWidthMode":"PERCENT","textBoxHeight":60,"textBoxWidth":200,"textBoxWidthPercent":75,"textImageSpace":10,"textBoxBorderRadius":0,"textBoxBorderWidth":0,"loadMoreButtonText":"","loadMoreButtonBorderWidth":1,"loadMoreButtonBorderRadius":0,"imageInfoType":"ATTACHED_BACKGROUND","itemBorderWidth":0,"itemBorderRadius":0,"itemEnableShadow":false,"itemShadowBlur":20,"itemShadowDirection":135,"itemShadowSize":10,"imageLoadingMode":"BLUR","expandAnimation":"NO_EFFECT","imageQuality":90,"usmToggle":false,"usm_a":0,"usm_r":0,"usm_t":0,"videoSound":false,"videoSpeed":"1","videoLoop":true,"jsonStyleParams":"","gallerySizeType":"px","gallerySizePx":1000,"allowTitle":true,"allowContextMenu":true,"textsHorizontalPadding":-30,"itemBorderColor":{"themeName":"color_12","value":"rgba(199,199,199,0)"},"showVideoPlayButton":true,"galleryLayout":2,"calculateTextBoxHeightMode":"MANUAL","targetItemSize":1000,"selectedLayout":"2|bottom|1|max|true|0|true","layoutsVersion":2,"selectedLayoutV2":2,"isSlideshowFont":true,"externalInfoHeight":60,"externalInfoWidth":0.75},"container":{"width":300,"galleryWidth":330,"galleryHeight":0,"scrollBase":0,"height":null}}

# Volume 7: Bayesian Analysis

### Why You Can Never Be Sure of Anything

*“Bet you $50 it hasn't.” – xkcd #1132 *

People don’t like thinking probabilistically. They crave certainty. That rock on the side of the road is definitely a rock. That apple is definitely red. It rained today, so the chances of rain were definitely 100%. The discussion of “what we know” is a philosophical topic, not a mathematical one. Math is useless if we want to know if our entire universe is a single atom in a larger dimension.

Bayesian Inference helps us to describe “what we learned.” In other words, we begin by knowing some things and then we gain information; now we know more. The difference from what we knew before to what we know now is our learning. Bayesian thinking can provide insight as to how much a piece of information should change your knowledge.

But Bayes Theorem is also helpful for traders – or gamblers! Maybe you think the Lions have a 10% chance to win the next Super Bowl; I’ve incorporated more information and think it’s closer to 1%. If my information is better, I can expect to profit from a wager.

Who was Thomas Bayes? What is Bayes Theorem?

How is Frequentist probability different from Bayesian probability? Why do Frequentists and Bayesians fight so much?

How can I use Bayesian Statistics in my everyday life?

**Who was Thomas Bayes? What is Bayes Theorem?**

The story of the 18th century is the story of rising British world domination. After nearly 100 years of religious conflict and battles between King and Parliament, the Glorious Revolution of 1688 installed a new dynasty, settling the major points of dispute. After this, Britain would face no more major revolutions. The government would change over the next three centuries, but it would happen slowly and peacefully. Without the internal strife that plagued France, Germany, Spain and other European nations, Britain could focus on building the world’s first industrial economy and its finest navy. This would lead to untold wealth due partially to the benefits of colonization.

A small, side benefit of this golden age was the ability of the British Empire(1) to afford a system of country pastors. Coming especially from the later sons of the lesser nobility, these parish priests were supposed to spread across the country, advancing the Church of England. But, for many of them, the life of a country preacher was not so arduous. Fortunately for us, many of their side pursuits were of great cultural and scientific value. Jonathan Swift and Joseph Priestly are two examples of great contributors to art and science whose day job was working for the Church of England(2).

Why do I go on at length about English country parish life in the 18th century(3)? Well, we just don’t know that much about Thomas Bayes so describing his world is the best we can do. We think he might have been born in 1701 but we don’t really know(4). His father was a well-known preacher in the world described above. Thomas spent his early years working with his father before moving to his own parish in Kent (southwest England) around 1735. Today, we only know of two of his publications, and only one of those is about mathematics. I’ll quote from Wikipedia(5) – not for the information, but just to demonstrate how little we know:

*“It is speculated that Bayes was elected as a Fellow of the Royal Society in 1742 on the strength of the Introduction to the Doctrine of Fluxions, as he is not known to have published any other mathematical works during his lifetime.*

*In his later years he took a deep interest in probability. Professor Stephen Stigler, historian of statistical science, thinks that Bayes became interested in the subject while reviewing a work written in 1755 by Thomas Simpson, but George Alfred Barnard thinks he learned mathematics and probability from a book by Abraham de Moivre. Others speculate he was motivated to rebut David Hume's anti-Christian An Enquiry Concerning Human Understanding.”*

I count two times that we speculate, two where we “think that,” and once where we don’t know at all. What we do know is that his most lasting work, the eponymous Theorem, only came to light after his death(6).

After that little digression, we can get to the point; here is Bayes Theorem(7) in all its glory:

In this equation, means the probability of X and is the conditional probability of X, assuming Y(8). The letters “A” and “B” can represent anything, from a statement like “that man is six feet tall” to an event like “this coin flip will come up heads.” Remember that probability is the likelihood of something happening or being true; it is expressed as a number between 0 and 1 (or 0% and 100%). Let’s go through a simple example.

Let “B” be the event of me going to the grocery store tomorrow and “A” be the event of me buying eggs. Maybe the probability of going to the store is 50%. We can also say that, without knowing whether I went to the store, the probability of buying eggs is 40%. Let’s also say that if I bought eggs, there is a 90% probability I went to the grocery store(9). Then:

What does this mean? In English, “if I go to the grocery store, the probability that I buy eggs is 72%(10).”

Bayes Theorem itself is a trivial piece of mathematics; it can literally be proven on one side of an index card(11). But as mentioned above, we can use this simple formula to gain a deeper idea of the concept of learning. To demonstrate this, let’s use the example of a drug test, a common application of Bayesian Inference(12).

Let’s say that 1% of the population uses cocaine. You see a person on the street, but know nothing about them; the probability that he or she uses cocaine is therefore 1%. The person walks up and says to you “I took a drug test yesterday and it showed positive for cocaine use.” What is the updated probability that the person uses cocaine?

You are tempted to say “100%” or very close – but this is wrong. Let’s guess that the “false positive” rate on cocaine tests is around 5% and the “false negative” around 2%(13). Let’s go back to Bayes – we’ll abbreviate the event “Tested positive” as “+” and Uses/Doesn’t Use as “U” and “DU” respectively.

We also know that the probability of a positive test, , is equal to the probability of a non-user testing positive plus the probability of a user testing positive, so:

So,

We’ve learned that, given a person had a positive test for cocaine, the probability they are a user is only around 16%. This is only as likely as getting a “6” on a single roll of a die. If the person failed a second drug test, the probability would go to 79.5%, and a third would take it to 98.7%(14). But no matter how many tests were failed, the probability would never go to exactly 100%. This is an important point about Bayesian theory: unless you are already certain of something, no amount of additional information can make you completely certain(15).

**How is Frequentist probability different? Why do Frequentists and Bayesians fight so much?**

So far, this has been fairly simple – we found a formula and “proved” that everybody you meet is possibly using cocaine. But now it is going to get tricky.

Remember we said that probability is not “wired” correctly into human minds? Well, to make the case in a point, after 2000 years of study going back to Aristotle, top mathematicians still don’t agree on exactly what probability means or how it should be interpreted. There are three major interpretations of probability:

*Classical Probability*

In Classical Probability, there are a certain number of outcomes, each of which is equally likely. Then the probability of an event is the number of favorable outcomes divided by the number of possible outcomes. A fair die has six total sides of which three are even. So, the probability of rolling an even number is 3/6 = 50%. While most of mathematics was developed with the Classical view holding sway, it has some significant limitations. First, in our example we specified a “fair die.” But this is a circular definition; how do you know what a fair die is if you haven’t defined probability? Second, classical probability has no way to handle an infinite number of possible outcomes, which is a big limitation.

*Frequentist Probability*

Frequentist theory states that the probability of an event is its relative frequency over a large number of trials. If I roll a die many times and half of the rolls are even, then the probability of rolling an even number is 50%. It solves the two major problems of Classical theory that we discussed: we don’t have to assume a “fair die” and if we could imagine a theoretical infinite-sided die, Frequentist theory still works(16). However, because Frequentists interpret probability is the frequency of events, we can create some extreme misuse of the method, as in this comic(17):

Now, this example is without question a bastardization of how the Frequentism works. But it does portray a situation that is not well handled.

*Bayesian Probability*

Bayes Theorem, as we discussed, is just a formula. But there is an interpretation of probability that is consistent with the Theorem. Bayesian Theory says that the probability of an event is the degree of certainty that it happened(18). To go back to our 6-sided die, let’s consider the statement “the die will roll any number 1 time out of 6”. What is the probability this is true, given we just rolled a 4? Well, the probability of rolling a 4 on a fair die is 1/6. Let’s say that the probability the die is fair is 99%. What is the probability of rolling a 4 on a 6-sided die, without making the assumption that the die is fair? I would say that is 1/6 also. Plugging this into the Theorem means that the probability of the die being fair is now 99%, the same as before our roll. In other words, we didn’t learn anything from a single roll(19).

But you can see here a major drawback of Bayesian Probability. Where did we come up with 99% probability that the die was fair? We also made a guess at the probability of rolling a 4 on a die that isn’t necessarily fair. Where did we get that number from? These assumptions are called “Bayesian Priors,” and this is the main criticism of Bayesian Probability: you need to make assumptions as to probability prior to receiving any information.

The cartoon gives us a much better usage for Bayesian logic: what is the probability the sun has exploded, given that the machine says it has? Well, the probability the machine says “yes” if nova has happened is 35/36 = 97.2%; the probability that it says yes in general is 1/36 = 2.8%(20). Now we need to choose our Prior: what is the probability the sun exploded, before using the machine? I’m going to go with 0.00001%.

This makes sense; it is far more likely that the machine lied than that the sun exploded(21).

For two groups of people who disagree only about the details of a subtle mathematical philosophy, Frequentists and Bayesians have an ongoing, contentious debate over “who is right.” I think that some of this is really a proxy battle between mathematicians and “hard scientists.” Hard scientists tend to prefer the Frequentist approach. They design an experiment and run it a bunch of times. If it comes out as expected, they write a paper, otherwise back to the drawing board. Hard scientists hate the Priors; how can you decide if you are right **before** you’ve done any experiments?

Mathematicians, surprisingly, tend to dislike the certainty that comes from the Frequentist approach. Remember our drug test example? It was based on pure mathematics, not Bayesian Theory, and left us with an uncertain result. There are many examples of science seeing a false positive and treating it as a Great Breakthrough. Mathematicians agree that Priors are annoying, but also find them useful. Before starting, you need to think about how the system works and consider what answer makes sense(22).

It won’t surprise you when I hedge my bets and say that both Frequentist and Bayesian Theories have uses and misuses. But I find that Bayes is far deeper and more interesting. It is really attempting to answer the question of what we know – more specifically, what we learn. And you can use it to gamble.

**How can I use Bayesian Statistics in my everyday life?**

As I discussed in Volume 3, I try to use Bayesian principles(23) when I incorporate new information into my worldview. Which is to say – almost always. In our Commentary, we try to follow a methodology: obtain pieces of information and use them to form a view of the world. There are several ways that Bayesian logic is useful in this process.

*Understanding degrees of certainty*

A basic precept of Bayesian thinking is that it is not possible to achieve certainty. New information should always affect your thinking about what is and is not true. With Bayes Theorem, a probability can’t reach 100% unless one of the inputs itself is 100%. This is another reason “belief” can be dangerous. Certainty on a topic, in the absence of evidence, can incorrectly lead to certainty on other topics.

*Considering new pieces of information*

How “important” is a piece of information? According to Bayes, information is important to the extent that we learn from it. If you are fairly certain (say 90% sure) that it is raining, and then see that everybody outside is carrying an umbrella, your probability will not change significantly. You didn’t learn much, so the information wasn’t very important. On the other hand, if you thought it was sunny, seeing umbrellas will drastically change your thinking. With a different Prior, the same information is now far more important.

*Acting without complete information*

Because we can never be truly certain, a corollary to Bayesian Theory is that we must act without certainty. It is consistent with Bayes that juries are asked to decide “beyond a reasonable doubt,” rather than beyond any doubt. Many measurements are showing the Earth getting warmer, and we are pretty sure that this is happening because of the actions of our species. So we should do something, even though we are not “sure.” Similarly, there is a 0.0001% chance that it is an optical illusion, but I’m still going to stop my car at a red light. We can’t state with 100% probability that the Affordable Care Act increased the total insured population. But the evidence is strong, so when considering policy it is appropriate to behave as if it is very likely the case(24).

Perhaps the best known application of Bayesian inference is to gambling(25). Let’s consider a single basketball game and a single wager. Say that the odds on the game imply that Team A has a 75% chance to win, Team B a 25% chance. To bet on Team A, you must risk losing $75 to win $25 and on Team B, $25 to win $75(26). If your information agrees with these odds, you have no expectation to win with a bet:

P(A Win) * Win(A) + P(A Lose) * Lose(A) =

75% * $25 + 25% * (-$75) = $0

However, if you have better information which tells you that Team A has an 85% chance to win, you can expect to win:

P(A Win) * Win(A) + P(A Lose) * Lose(A) =

85% * $25 + 15% * (-$75) = $10

Perhaps this is obvious, but when gambling (or trading), you can expect to profit only if you have better information than other people. Only if your probabilities are different from “the market” should you place a bet. Which brings us back to Bayes: to win at sports gambling, or in the markets, we need to know the difference between important and unimportant information.

I thought this was supposed to be about Government, maybe with a little history sprinkled in? Why did we go on a long digression about an obscure 18th-century Englishman?

Some of the reason is “meta” – to properly read what we write about Obamacare, it’s important to understand the mindset in which it was written. That mindset is many things, but it is certainly Bayesian.

But I encourage you to apply the Theory to any topic. Thinking in terms of probabilities rather than certainties. Incorporating new information even when it doesn’t comport to your Prior view. Realizing when the information has become clear enough to lead to a conclusion or action. Then challenging that conclusion when new information points the other way!

Perhaps the most important thing I learn from Bayes is the importance of information. We learn from the application to the gambler - in order to have the best performance, you need to use the most important information. And you need to seek out important information, because it isn’t always readily available. Which is my purpose to write here in the first place; whether or not you think these pieces are useful – whether or not they help you learn – hopefully they cause you to continue to search out more information in order to keep updating your Priors.

I’m playing loose with what I call the entity which is today’s United Kingdom. The proper name changed a few times in this period, but I’m always talking about that country where they drink warm beer.

For more on this, see “At Home: A Short History of Private Life” by Bill Bryson.

Yeah – I mean isn’t this supposed to be technical government stuff?

The image shown here is always used as Bayes’ portrait. But there is no good reason to think that it is really him.

Wikipedia - Thomas Bayes

We know that he died in 1761. A famous, awful math joke is that we know more about Bayes’ Posterior than his Prior.

Most people write “Bayes’ Theorem,” but I prefer it without the possessive as in “The Bayes Theorem.”

Conditional probability can be a tricky concept. It is often best expressed with the phrase “given that.” For example, what is the probability that it will be cloudy tomorrow? Maybe 50%. What is the probability that it will be cloudy outside, given that it snows? Closer to 100%.

I usually buy eggs from the grocery, but sometimes from the drug store or farmers’ market.

The most important question to ask when doing math is “Does this make sense?” Yes. I usually buy eggs at the store, but not always. If it had come back as 35% or 99%, it would have been a sign something is likely wrong.

For example, here.

Many places on the internet, including here.

“False positive” = returns a positive test on a non-user; “false negative” = returns a negative test on a user. I’m not able to find definite values for cocaine testing stats, but these are in the ballpark.

I’ll leave these calculations as an exercise for the reader.

This statement is conceptually accurate, but should not be treated as rigorous mathematics.

Maybe I wouldn’t throw as many 7’s at the craps table with this one.

Analogously, the probability of a statement is the degree of certainty that it is true.

Which makes sense – rolling a single 4 tells you nothing about whether it is a fair die.

By the way - did Randall forget how to round a number? 1/36 = .0277777…

Citation: you are reading this.

This is a

**vast**oversimplification and overgeneralization of the debate.It may be important to note: Bayes came up with the Theorem in the sense of a mathematical proof. But he didn’t develop modern Bayesian Probability or Inference, which were developed later. However, his writings do show that he was considering these concepts, at least 100 years ahead of their time, so we use his name for the full theory.

For fun: perhaps somebody once said that there was a crowd of 1,500,000 people on the National Mall. However, various types of evidence (photographic, personal accounts, Metro ridership) indicate that it was a fraction of this size. Incorporating this information via Bayes Theorem, we can see that the probability that the crowd was large is indeed very low. We don’t need said probability to literally reach zero to be able to state factually “not many people were there.”

Or trading, which isn’t so different.

We ignore any house edge.