# [Probability] You're about to get on a plane to Seattle. You want to know if you should bring an umbrella. You call 3 random friends of yours who live there and ask each independently if it's raining. Each of your friends has a 2/3 chance of telling you the truth and a 1/3 chance of messing with you by lying. All 3 friends tell you that "Yes" it is raining. What is the probability that it's actually raining in Seattle?

Data Science Interview QuestionsCategory: Data Science[Probability] You're about to get on a plane to Seattle. You want to know if you should bring an umbrella. You call 3 random friends of yours who live there and ask each independently if it's raining. Each of your friends has a 2/3 chance of telling you the truth and a 1/3 chance of messing with you by lying. All 3 friends tell you that "Yes" it is raining. What is the probability that it's actually raining in Seattle?
MockInterview Staff asked 7 years ago

Source

MockInterview Staff answered 7 years ago
MockInterview Staff answered 5 years ago

Bayesian stats: you should estimate the prior probability that it’s raining on any given day in Seattle. If you mention this or ask the interviewer will tell you to use 25%. Then it’s straight-forward:

P(raining | Yes,Yes,Yes) = Prior(raining) * P(Yes,Yes,Yes | raining) / P(Yes, Yes, Yes)

P(Yes,Yes,Yes) = P(raining) * P(Yes,Yes,Yes | raining) + P(not-raining) * P(Yes,Yes,Yes | not-raining) = 0.25*(2/3)^3 + 0.75*(1/3)^3 = 0.25*(8/27) + 0.75*(1/27)

P(raining | Yes,Yes,Yes) = 0.25*(8/27) / ( 0.25*8/27 + 0.75*1/27 )

**Bonus points if you notice that you don’t need a calculator since all the 27’s cancel out and you can multiply top and bottom by 4.

P(training | Yes,Yes,Yes) = 8 / ( 8 + 3 ) = 8/11

But honestly, you’re going to Seattle, so the answer should always be: “YES, I’m bringing an umbrella!”
(yeah yeah, unless your friends mess with you ALL the time 😉

MockInterview Staff answered 5 years ago

Answer from a frequentist perspective:

Suppose there was one person. P(YES|raining) is twice (2/3 / 1/3) as likely as P(LIE|notraining), so the P(raining) is 2/3.

If instead n people all say YES, then they are either all telling the truth, or all lying. The outcome that they are all telling the truth is (2/3)^n / (1/3)^n = 2^n as likely as the outcome that they are not. Thus

P(ALL YES | raining) = 2^n / (2^n + 1)
= 8/9 for n=3

Notice that this corresponds exactly the bayesian answer when prior(raining) = 1/2.

nikki answered 5 years ago

Apply Bayes Theorem
P(Rains) = P(Rain/SayRain)*P(SayRain) + P(Rain/SayNoRain)*P(SayNoRain)
P(Rain) = (2/3)*(1/2) + (1/3)*(1/2)
P(Rain) = 1/2

nikki answered 5 years ago

Apply Bayes Theorem
P(Rains) = P(Rain/SayRain)*P(SayRain) + P(Rain/SayNoRain)*P(SayNoRain)
P(Rain) = (2/3)*(1/2) + (1/3)*(1/2)
P(Rain) = 1/2