Showing posts with label bayesian. Show all posts
Showing posts with label bayesian. Show all posts

Thursday, August 7, 2014

The Monty Hall Problem

Suppose you're on a game show, and you're presented with three closed doors. Behind one of the doors is a car, and behind the other two are goats. You pick a door, let's say door 1. Before opening that door, the host, Monty Hall, opens a different door, let's say door 2, revealing a goat, and asks you if you want to switch which door you choose. Should you switch?

Counter-intuitively, the standard answer is yes. There is a 2/3 probability that the car is behind door 3, and only a 1/3 probability that the car is behind door 1. I'll prove it with math.

Bayes theorem says. In English, the probability of a hypothesis H given a piece of evidence E is equal to the probability of the evidence given the hypothesis times the prior probability of the hypothesis divided by the prior probability of the evidence

Let's define a few variables. We'll say C1, C2 and C3 stand for the car being behind door 1, 2 or 3, respectively. We'll also say O1, O2 and O3 stand for Monty opening door 1, 2 or 3, revealing a goat.

So, what we're interested in finding is P(C3|O2) or P(C1|O2). So, let's plug our variables into the equation.


Ok, so what are each of those terms? Well, P(O2|C3) = 1. Monty can't open the door you chose, and he's not going to open the door with the car. That only leaves one option. P(C3) = 1/3. With no information, we have to assume there's equal probability for the car to be behind each door.

By the law of total probability,, since Monty can choose either door 2 or door 3. P(O2|C2) = 0, since Monty won't open the door with the car behind it. Thus

Plugging those numbers back into the equation, we get. By the same logic,.

Here's another way to think about it. When you pick door 1, it either has the car behind it (probability 1/3) or it doesn't (probability 2/3). When Monty opens door 2, it doesn't change those probabilities. There's still a 1/3 probability your door has the car, and a 2/3 probability your door doesn't have the car. Since door 2 now has a probability 0 of having the car, that means door 3 must have the whole 2/3rds.

But what's really interesting to me about the Monty Hall problem is that it's not just dependent on what Monty does, it's also dependent on why he does it. Everything I've said is true for the standard problem, in which Monty always opens a door, and always reveals a goat. But if those things change, Monty can perform exactly the same actions, and get exactly the same results, but we'll still get different probabilities.

For example, suppose Monty only opens another door if you picked the door with the car. You pick door 1, and Monty opens door 2, revealing a goat. Should you switch? In that case, you definitely don't want to switch, because Monty wouldn't have opened a door at all if you had guessed incorrectly the first time. In this case, P(O2|C3) = 0, so P(C3|O2) = 0, and P(O2) = P(O2|C1)*P(C1), so P(C1|O2) = 1.

Alternatively, suppose Monty always opens a door, but opens one of the two you didn't pick at random. Again, you pick door 1, and Monty opens door 2, revealing a goat. It's possible Monty could have opened door 2 and revealed the car, but not this time. In this case, the probability that the car is behind door 1 and the probability that the car is behind door 3 are both 1/2. The reason is that he's twice as likely to open a goat door if you've chosen the car door than if you had not chosen the car door, so you do get information about the door you chose.

You can also find that using Bayes' theorem as before. P(O2|C2) = 0, since the goat can't be behind the door with the car. P(O2|C1) = P(O2|C3) = 1/2, since there's a 1/2 probability that Monty will open door 2, regardless of which door the car is behind.


But what if you don't know what strategy Monty is following? What if all you know is that there's a car behind one of the three doors, you picked door 1 and Monty opened door 2, revealing a goat. Maybe he's making a decision based on one of the three strategies I just described. Maybe he's using some other strategy. How do you calculate the probabilities then? What decision should you make?

I honestly have no idea.

Wednesday, January 4, 2012

Justified True Belief?

Epistemology is the branch of philosophy interested in the study of knowledge. One of the foundational questions of epistemology is "What does it mean to know something?". A common answer is that knowledge is justified true belief. In order to know something, you have to believe it, have a good reason for believing it and it has to actually be true.

That sounds pretty good, but there are problems with it. It's possible to construct scenarios in which all three conditions are apparently met, but it doesn't seem like anything was "known".

There's also the question of what counts as justification. But I think there's another, more fundamental, problem with this definition. One I don't think I've ever seen anyone else point out.

No definition of knowledge should include the condition of being true.

To do so is to make the term inapplicable in any situation remotely resembling real life. The reason for that is because of the answer to another fundamental question of epistemology: "Is it possible to be absolutely certain of something?". The answer to that is no. (Of course, others disagree, and I should probably write another post explaining why I think that.) All we can do is get more and more evidence for something, getting closer and closer to 100% certainty, but never actually reaching it.

In toy examples, whether a given fact is true or not is simply assumed/given. So if a hypothetical character has a justified belief, we can say whether that character knows it or not, because of our god-like omniscience. But in real life, no one has that omniscience.

Consider the same question - Is a belief knowledge or not - applied to yourself. Do I know the sun will rise tomorrow, or do I just believe it? Well, I certainly think it's true that the sun will come up. I wouldn't believe it if it I didn't think that, tautologically. But if that's the standard, then I ought to consider every belief I have to be knowledge. If I didn't believe they were true, I wouldn't believe them.

And if we apply that standard to other people, then our evaluations of whether someone else knows something or merely believes it, simply becomes a question of whether they agree with you or not.

I propose a simpler definition: Knowledge is belief that is held with a high degree of confidence.

This definition fits very well into a Bayesian framework. Degree of confidence is simply probability. If you believe something is true with a probability greater than, say, 99.9%, you can be said to know it. This also handily deals with the question of what counts as justification - that's just Bayesian evidence.

Tuesday, November 22, 2011

Extraordinary Evidence

"Extraordinary claims require extraordinary evidence" -Carl Sagan
 Some people don't like this quote. They say it's too subjective. There's no objective standard of what's extraordinary. And other rather silly objections.

I would generalize the saying to be something more like this: "All claims require the appropriate amount or degree of evidence.".

The ordinariness/extraordinariness of a claim is not a binary feature, but rather a sliding scale. If I said I had eggs for breakfast this morning, that's a perfectly ordinary claim. You'd probably need no more evidence than my word to believe it. If I said I saw a zebra in my backyard, that's a little bit extraordinary, since they don't live anywhere near here. You'd probably need a photograph, or a news story about a zebra that escaped from a zoo to believe it. If I said I saw a unicorn, that's even more extraordinary. You'd probably need to see the real live thing to believe that. If I said neutrinos can go faster than light, that's even more extraordinary and will require lots more evidence. And then of course, there's always God, which is about the most extraordinary claim imaginable.

Another important thing to note is that belief too is not a binary value. Rather, it's degree of certainty. Probability. Which is nice, because that means this saying can be formalized by using Bayes' Theorem.

Bayes' Theorem is a mathematical formula that lets you calculate how probable you should consider a hypothesis after seeing some evidence, given your prior probability of that hypothesis, how likely you are to see that evidence if the hypothesis were true, and how likely you are to see that evidence if the hypothesis were false.

How extraordinary a claim is, is simply how low your prior for it was. This doesn't totally eliminate claims of subjectiveness, but it's no less subjective than any other belief, and if you're doing Bayes right, it's really a lot less subjective.

And how extraordinary evidence is, is simply how much more likely that evidence is to occur if the claim were true than if the claim were not true.

Going back to my examples, the prior probability for me eating eggs for breakfast is relatively high. You already know from past experience that eggs exist and that people commonly eat them for breakfast. So the evidence doesn't need to be very strong. I'm more likely to say something if it's true than if it's false, but lying isn't unheard of.

The prior probability of me seeing a zebra in my backyard is lower. You still know that zebras exist, but you also know they don't live in the wild here. So, on just my word, it might seem more likely that I'm lying than that I actually saw a zebra. The prior probability for the unicorn is even lower, because you already know they don't exist. A photograph isn't sufficient here because it's more likely that I faked it than that unicorns actually exist.

Thursday, March 17, 2011

There is Evidence for God

Something many atheists claim is that there is no evidence for god or religion. Not one single bit of evidence at all. But that's not true. It's frequently talked about as if it were an all or nothing kind of thing. As if all the evidence points one way or the other. But, it's possible for there to be evidence for something that's false.

There is evidence for god. It's weak evidence, and clearly overwhelmed by the evidence against, but it's still there. It's not nothing.

The biggest piece of evidence I can think of is that the vast majority of people believe in god. And this is not argumentum ad populum, but rather a probabilistic, Bayesian point of view. Which is more likely? The probability that so many people would believe in god given that god exists, or the probability that so many people would believe in god given that god doesn't exist? I think people are more likely to believe in something true rather than something false, especially if it interacts with them personally. Of course, people are willing to believe all sorts of crazy shit, so it's not much more likely. Which is why it's very weak evidence.

Friday, January 15, 2010

Bayes' Theorem

In my last post, I talked about Bayesian reasoning, but didn't really explain what it actually was. I was going to make a footnote explaining it, but realized it too big for a footnote, so I'm going to write a post explaining it.

I'll start with some terminology.

P(A) is the probability that something is true. For example, let's say I roll a fair die and A is "I roll an even number". Since the die is fair, all outcomes are equally likely, so P(A) = 3/6 = 1/2, since 2, 4, and 6 are even.

~A is not A. ~A then is "I roll an odd number". Also P(~A) = 1 - P(A), for any A. In this case, P(~A) = 1 - 1/2 = 1.

P(A|B) is read probability of A given B. Let's say B is "I roll a number greater or equal to 4". So, if I roll the die, see the number is greater or equal to 4, then the P(A|B) = 2/3, because 4 and 6 are even

Bayes' Theorem states that P(A|B) = P(B|A)*P(A) / ( P(B|A)*P(A) + P(B|~A)*P(~A)). So, if we want to know how likely A is after making some observation, all we have to know is how likely the observation is if A is true, how likely the observation is if A is false, and how likely A was before we made the observation.

If we're not interested in the exact value of P(A|B), but just whether P(A|B) is higher or lower than P(A), then all we need to know is whether P(B|A) is higher or lower than P(B|~A). If P(B|A) > P(B|~A) then P(A|B) > P(A). If P(B|A) < P(B|~A) then P(A|B) < P(A). And, if P(B|A) = P(B|~A) then P(A|B) = P(A).

Relating this back to the other post, I said that not observing evidence for a phenomenon makes that phenomenon less likely. Here's an example: Tigers don't exist. Evidence: There are no tigers in my house. A - Tigers exist. B - No tigers in my house. Now, if tigers do exist, it's very unlikely that they would be in my house. Not the right environment, needs some way to get in, etc., etc. So, P(B|A) = .99999999. But, if tigers don't exist, then it is absolutely impossible for tigers to be in my house. So, P(B|~A) = 1. 1 > .99999999, so P(A|B) < P(A). Of course, there's lot of other evidence and stronger evidence that tigers do exist, so P(A|B) is still very high.

Wednesday, January 13, 2010

Absence of Evidence is Evidence of Absence.

The common saying "Absence of evidence is not evidence of absence" is not true.

If you should be seeing evidence of a phenomenon and you aren't, then that is evidence that the phenomenon doesn't exist. Consider the Michelson-Morley Experiment. It was designed to measure the speed of the Earth through the luminiferous aether. And it found... absolutely nothing. That, and other experiments which failed to detect the aether, overthrew the theory. The absence of evidence was the evidence of absence.

Even in cases where you wouldn't expect to see evidence, the absence of it is still weak evidence of absence. I say this based on Bayesian reasoning. If a phenomenon exists, but you wouldn't expect to see evidence of it given the circumstances, presumably, there's still a non-zero (though small) probability of seeing evidence of it. Whereas, if the phenomenon doesn't exist there is even less probability of seeing evidence for the phenomenon. This means that not seeing the phenomenon does shift the probability of the phenomenon actually existing down, by however small an amount. Of course, depending on the specifics, it could be a very, very weak evidence.

Usually, this sentiment comes up in reference to the existence of god. Just because we don't see evidence of god doesn't mean he doesn't exist. But it does make it less likely. The question then is, how much less likely? If god did exist, what would we expect to see different than if he didn't exist?