11
Chp 13 – Probability Exercises

Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Embed Size (px)

Citation preview

Page 1: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Chp 13 – Probability

Exercises

Page 2: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

• Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you don’t understand.

• First formulate what is being asked p(…| …) etc.

• Then work out the solution by remembering the following main rules: – If you have a joint distribution, you must sum over the unmentioned

(hidden) variables)– Conditional probabilities may be computed by normalization, if you

compute and sum the conditional probabilities of all possible outcomes given the evidence.

– Use Bayes formula to go between causal or diagnostic directions– …

Page 3: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 1• Let’s start simple.

• Among women some 10% is known to be left handed, while that proportion is 20% for men. What is the proportion of left-handed people in the whole population? You may assume that there are 50% men and 50% women in the general population.

Page 4: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 1 – Solution• I intentionally asked this as proportion, rather than probability,

because the other parts are very easy. So we are asked to compute P(lefthanded).

P(lefthanded) = P(lefthanded,man) + P(lefthanded,woman) :R1

= P(lefthanded|man)P(man) +

P(lefthanded|woman)P(woman) :R2

= 0.2*0.5 + 0.10*0.5

= 0.15

R1: We are summing through the unmentioned variable in P(lefthanded).

R2: We are using the relationship between joint and conditional probabilities

Note: Please circle your final answer to help graders and make your answer clear.

Page 5: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 2• Let’s make it one level more difficult.

• You are given the following joint probability distribution about the weather in Istanbul. Answer the following using this table.

cold cold

sunny sunny sunny sunny

rainy 0.01 0.10 0.05 0.14

rainy 0.12 0.23 0.20 0.15

Page 6: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 2

• What is the probability of having rain in Istanbul?

• What is the probability of having sunshine when there is rain? State first as a formula.

cold cold

sunny sunny sunny sunny

rainy 0.01 0.10 0.05 0.14

rainy 0.12 0.23 0.20 0.15

Page 7: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 2

• What is the probability of having rain in Istanbul?

P(rain) = 0.01+0.10+0.05+0.14= 0.30 • Notice that if you wrote this in formula, many of you would have been confused so make

use of the table advantage if you have it or if you can think of it when you need to.

• So can we say that about one third of the days are rainy?

Yes.

cold cold

sunny sunny sunny sunny

rainy 0.01 0.10 0.05 0.14

rainy 0.12 0.23 0.20 0.15

Page 8: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

Problem 2• What is the probability of having sunshine when there is

rain? State first as a formula (don’t use the table)

– Since we are asked “when there is rain”, you should notice that this is a given. So we are asked about P(sunny|rain).

– Since we have 3 random variables altogether, we must sum over the third one.

Page 9: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

When you sum over the hidden variable, since its value is not given (otherwise it would not be hidden), it must appear on the left hand side in all its possible alternatives (cold and cold). Thus:

P(sunny|rain) = P(sunny, cold|rain) + P(sunny, cold|rain).…

Since we know that we must either have sunshine or not, it is easier to calculate P(sunny|rain) and P(sunny|rain), so that we can normalize!

But this is simply P(SunCondition|rain) where we use the random variable SunCondition that can take on two values sunny, or not sunny.

We carefully use it as uppercase to indicate that this is a variable, while the rain is given as evidence, as a shorthand for RainCondition=rainy.

We also use bold P to indicate that we are computing a probability distribution.

Page 10: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

R1: from previous pageR2: Using Bayes rule

P(sunny|rain) = P(sunny, cold|rain) + P(sunny, cold|rain). :R1

= P(sunny, cold, rain)/P(rain) + P(sunny,cold,rain)/P(rain). :R2

Similarly,

P( sunny|rain) = P(sunny, cold|rain) + P(sunny, cold|rain).

= P(sunny, cold, rain)/P(rain) + P(sunny,cold,rain)/P(rain).

In short, we can say that

P(SunCondition|rain) = P(SunCondition,cold,rain) + P(SunCondition, cold,rain)

Here is 1/P(rain). Notice how we also grouped two items (blue or green together) to find the correct vector notation.

Reading these (P(sun,cold,rain), P( sunny,cold,rain) etc) off from the table, we get:

P(SunCondition|rain) =

When we normalize, we getP(SunCondition|rain) = <0.06/0.30 , 0.24/0.30>=<1/5,4/5>

Page 11: Chp 13 – Probability Exercises. Please try to do this problems without looking at the answer. When you look at the answer, you will not realize what you

If you cannot deal with the vector notation, you can compute them as much as we have (leaving as unknown

P(sunny|rain) = P(sunny, cold, rain) + P(sunny,cold,rain).

Similarly,

P(sunny|rain) = P(sunny, cold, rain) + P(sunny,cold,rain)

Now since P(sunny|rain) + P(sunny|rain) = 1, we get (0.06+0.24) = 1. Hence /0.30

Thus normalizing your probabilities (by the factor)

P( sunny|rain)=0.06/0.30=1/5

P(sunny|rain)=0.24/0.30=4/5

Now we can write it in vector notation:P(SunCondition|rain) = Circle or highlight your answer.