Docsity

Exercise session 1, Esercizi di Probabilità e Statistica

Toggle sidebar
bg1
Exercise session 1 – October 7, 2015
Basics on probability
Example from the movie 21 (just to start …)
In a tv game, the participant can choose among three box, one containing the prize and the other
two empty. Once the participant has made his choice, the game master, who knows where the price
is, opens the box among the other two which is empty. At this point the participant can choose to
stick with his box or change, taking the remaining one. Which is the best choice to make in order to
win?
Definition of events:
P[A] = probability the prize is in box 1
P[B] = probability the prize is in box 2
P[C] = probability the prize is in box 3
Since we have no other info, the three probability are the same, the three event are mutually
exclusive (only one prize) and exhaustive, therefore
𝑃[𝐴]= 𝑃[𝐵]= 𝑃[𝐶]=1
3
Let’s suppose we choose box 1, we have thus 1/3 probability of winning, and 2/3 probability of
losing, that is in other words:
𝑃[𝑝𝑟𝑖𝑧𝑒 𝑖𝑠 𝑖𝑛 𝑏𝑜𝑥 𝐵 𝑜𝑟 𝐶]= 𝑃[𝐵 ∪ 𝐶]= 𝑃[𝐵]+ 𝑃[𝐶]=2
3
I can sum the probability because the events are mutually exclusive
If the game master opens the empty box between 2 and 3, still the probabilities
𝑃[𝐴]=1
3
𝑃[𝐵∪𝐶]=2
3
are unmodified (the statistical characteristics of the problem are still these !), and if I keep my
choice of box A I still have 1/3 probability of winning. Instead, if I change box and pick the
remaining one between 2 and 3, this options preserves the 2/3 probability of winning, because it is
“as if” I chose both the boxes 2 and 3. Therefore, it is better to change.
Basic principle of counting
Ex 3.5.3 Ross (to show how statistics challenges our common sense)
If n persons are gathered in a room, how much is the probability that all people have their birthday
in a different day ? How large the number n needs to be in order to have this probability below 50%
?
pf3
pf4
pf5
pf8
pf9

Anteprima parziale del testo

Scarica Exercise session 1 e più Esercizi in PDF di Probabilità e Statistica solo su Docsity!

Exercise session 1 – October 7, 2015

Basics on probability

Example from the movie 21 (just to start …)

In a tv game, the participant can choose among three box, one containing the prize and the other two empty. Once the participant has made his choice, the game master, who knows where the price is, opens the box among the other two which is empty. At this point the participant can choose to stick with his box or change, taking the remaining one. Which is the best choice to make in order to win?

Definition of events:

P[A] = probability the prize is in box 1

P[B] = probability the prize is in box 2

P[C] = probability the prize is in box 3

Since we have no other info, the three probability are the same, the three event are mutually exclusive (only one prize) and exhaustive, therefore

𝑃[𝐴] = 𝑃[𝐵] = 𝑃[𝐶] =

Let’s suppose we choose box 1, we have thus 1/3 probability of winning, and 2/3 probability of losing, that is in other words:

𝑃[𝑝𝑟𝑖𝑧𝑒 𝑖𝑠 𝑖𝑛 𝑏𝑜𝑥 𝐵 𝑜𝑟 𝐶] = 𝑃[𝐵 ∪ 𝐶] = 𝑃[𝐵] + 𝑃[𝐶] =

I can sum the probability because the events are mutually exclusive

If the game master opens the empty box between 2 and 3, still the probabilities

𝑃[𝐴] =

𝑃[𝐵 ∪ 𝐶] =

are unmodified (the statistical characteristics of the problem are still these !), and if I keep my choice of box A I still have 1/3 probability of winning. Instead, if I change box and pick the remaining one between 2 and 3, this options preserves the 2/3 probability of winning, because it is “as if” I chose both the boxes 2 and 3. Therefore, it is better to change.

Basic principle of counting

Ex 3.5.3 Ross (to show how statistics challenges our common sense)

If n persons are gathered in a room, how much is the probability that all people have their birthday in a different day? How large the number n needs to be in order to have this probability below 50% ?

To solve this problem we consider that the probability of being born in any day of the year has the same probability, so each person has 365 options, all equally probable:

𝑃[𝑏𝑒𝑖𝑛𝑔 𝑏𝑜𝑟𝑛 𝑜𝑛 𝑑𝑎𝑡𝑒 𝑥] =

We neglect the leap year.

Based on the fact that we are dealing with equally probable events, we evaluate the probability requested as the ratio of the favorable configurations over all the possible configurations.

Number of possible configurations: 365 n , since the each person can be born in any day of the year, and to combine all this cases we use the basic principle of counting  multiplications of number of possible cases.

Number of favorable configurations: again we apply the counting principle:

  • the first person interviewed can be born in any day of the year  365 cases
  • the second person, to fulfill the requirement, cannot be born in the same day as the first, so he/she is left with 364 options
  • with the same logic the third has 363 options and so on …

We apply the basic principle of counting and obtain: 365·364·363·…· (365 -n +1).

We then obtain the result:

𝑃[𝑛 𝑝𝑒𝑟𝑠𝑜𝑛𝑠 𝑎𝑙𝑙 𝑏𝑜𝑟𝑛 𝑖𝑛 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑡 𝑑𝑎𝑦𝑠] =

INTERESTING FACT : this probability becomes less than 50% with n =23 (smaller number than what you would have thought) and for n =50 it is just 3%.

Ex from final (to show that sometimes is better to evaluate the complementary)

You are going to a restaurant that offers 4 main dishes, 3 side salads and 5 desserts. In one of the salads there are peanuts, as well as in 2 desserts, and you are allergic to peanuts. If you let the chef decide a menu of three courses (main dish + salad + dessert) for you, what is the probability that this dinner will send you to the hospital?

Since no info is given on how the menu is composed by the chef, we suppose a random choice so that each dish of the same category is equally probable. We use the basic principle of counting:

Total possible configurations (menu): 4 mains · 3 sides · 5 desserts = 60

Since you go to the hospital with at least one dish with peanuts, but also with more than one, various configurations should be considered, and it becomes easy to forget something along the way. Better to evaluate the complementary event  no peanuts in the menu.

Number of configurations with no peanuts: 4 mains · 2 sides · 3 desserts = 24

Therefore 24/60 is the probability of NOT going to the hospital and 36/60 is the probability requested.

AT HOME: try to solve the same exercise evaluating directly the probability requested.

Statistical independent events

Exercise from finals

You go buy scratch cards (gratta e vinci). You know that:

  • 1 card out of 2 will make you win 10 €
  • 2 cards out of 10 will make you win 50 €
  • 1 card out of 10 will make you win 100 €

If you buy two scratch cards, what is the probability that you will win AT LEAST 100 €?

First thing is to define correctly the events for which we have information on probability, and then identify the event to be evaluated.

𝑃[𝑤𝑖𝑛 10€] = 𝑃[𝐴 1 ] =

𝑃[𝑤𝑖𝑛 50€] = 𝑃[𝐴 2 ] =

𝑃[𝑤𝑖𝑛 100€] = 𝑃[𝐴 3 ] =

𝑃[𝑛𝑜𝑡 𝑤𝑖𝑛] = 𝑃[𝐴 4 ] = 1 − ∑ 𝑃[𝐴𝑖]

3

𝑖=

Each purchase of a scratch card is an event that is statistically independent from the other, so the two events considered have the properties of statistically independent events  the probability of the intersection is the product of probability.

There are many ways of winning at least 100€ with two scratch cards, and the probability of each possible way has to be summed to consider the union of all these events. The single event is itself the intersection of two events, and the corresponding probabilities are to be multiplied.

The only difficulty is not to forget some cases, especially remembering that (Ai, Aj) is a different event from (Aj, Ai), when i≠j:

𝑃[𝑤𝑖𝑛 𝑛𝑜𝑡ℎ𝑖𝑛𝑔 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛 100€] = 𝑃[𝐴 4 ]𝑃[𝐴 3 ] =

𝑃[𝑤𝑖𝑛 10€ 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛 100€] = 𝑃[𝐴 1 ]𝑃[𝐴 3 ] =

𝑃[𝑤𝑖𝑛 50€ 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛 50€] = 𝑃[𝐴 2 ]𝑃[𝐴 2 ] =

𝑃[𝑤𝑖𝑛 50€ 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛 100€] = 𝑃[𝐴 2 ]𝑃[𝐴 3 ] =

𝑃[𝑤𝑖𝑛 100€ 𝑎𝑛𝑑 𝑡ℎ𝑒𝑛 𝑎𝑛𝑦 𝑜𝑡ℎ𝑒𝑟 𝑐𝑎𝑠𝑒] = 𝑃[𝐴 3 ]𝑃[𝑆] =

The sum of these probabilities gives 0.23.

NOTE: this is the same statistical situation of rolling two dices with only four sides (0 10 50 and 100), not balanced (different probability for each side), and the probability requested is to get at least 100.

Exercise on sequence of statistically independent events

Analysis of the various situations that may occur when gambling. If I play one single number at the roulette the probability of winning is:

𝑃[𝑤𝑖𝑛] = 𝑃[𝑊] =

And the probability that the number does not come out is the complementary:

𝑃[𝑛𝑜𝑡 𝑤𝑖𝑛] = 𝑃[𝑊𝑐] =

CASE 1: probability of winning two times in a row (each round is statistically independent from the other)

𝑃[𝑤𝑖𝑛 𝑡𝑤𝑖𝑐𝑒] = 𝑃[𝑊]𝑃[𝑊] = 0.

CASE 2: probability of playing 4 times and winning ONLY once - need to consider all different sequences

𝑃[𝑤𝑖𝑛 𝑂𝑁𝐿𝑌 𝑂𝑁𝐶𝐸 𝑜𝑛 4 𝑡𝑟𝑖𝑒𝑠] = 𝑃[𝑊]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐] + 𝑃[𝑊𝑐]𝑃[𝑊]𝑃[𝑊𝑐]𝑃[𝑊𝑐]

  • 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊]𝑃[𝑊𝑐] + 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊] = 4𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊] = 0.

CASE 3: probability of playing 4 times and winning once at the fourth time

𝑃[𝑝𝑙𝑎𝑦 4 𝑡𝑖𝑚𝑒𝑠 𝑎𝑛𝑑 𝑤𝑖𝑛 𝑜𝑛𝑐𝑒 𝑎𝑡 𝑡ℎ𝑒 𝑒𝑛𝑑] = 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊] = 0.

CASE 4: probability of playing 4 times and winning AT LEAST once – easier to evaluate complementary, because many different cases should be considered

𝑃[𝑤𝑖𝑛 𝐴𝑇𝐿𝐸𝐴𝑆𝑇 𝑂𝑁𝐶𝐸 𝑜𝑛 4 𝑡𝑟𝑖𝑒𝑠] = 1 − 𝑃[𝑛𝑒𝑣𝑒𝑟 𝑤𝑖𝑛] = 1 − 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐] = 1 − 0.8962 = 0.

NOTE: this case includes CASE 2 + all the situations where you win more than once

AT HOME: try to solve the same exercise evaluating directly the probability requested.

CASE 5: probability of winning, having decided to play a maximum of 4 times and to stop the moment you win once

𝑃[𝑤𝑖𝑛 𝑂𝑁𝐶𝐸 𝑤𝑖𝑡ℎ 𝑎 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑜𝑓 4 𝑡𝑟𝑖𝑒𝑠] = 𝑃[𝑊] + 𝑃[𝑊𝑐]𝑃[𝑊] + 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊] + 𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊𝑐]𝑃[𝑊] = 0.

Note: it converges to one when infinite tries … and it is statistically equivalent to CASE 4! The equivalence is clear if you factorize P[W] from the expression of CASE5 and remember that P[W]=1-P[Wc].

Bayes formula

Ex1.23 Vicario Levi (explain the misleading/mistake on the book)

A medical test to diagnose a rare disease has the following performance:

  • Sensitivity: the test is positive for 95% of the cases affected
  • Morbidity: this disease affects 0.5% of the population
  • False positive: the test is positive even though the patient is healthy in 4% of the cases (THIS DATA IS NOT GIVEN IN THE BOOK AND IS INDUCED UNCORRECTLY FROM THE OTHER DATA !)

Question: probability of getting a correct diagnosis for a patient (i.e., the probability that, being the test positive, the patient is actually sick in reality).

Let us define correctly the events and probabilities involved:

A= person is sick

T= test is positive

Morbidity: 𝑃[𝑎 𝑝𝑒𝑟𝑠𝑜𝑛 𝑖𝑛 𝑡ℎ𝑒 𝑝𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑖𝑠 𝑠𝑖𝑐𝑘] = 𝑃[𝐴] = 0.

Sensitivity  𝑃[𝑡𝑒𝑠𝑡 𝑖𝑠 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑏𝑒𝑖𝑛𝑔 𝑡ℎ𝑒 𝑝𝑒𝑟𝑠𝑜 𝑠𝑖𝑐𝑘] = 𝑃[𝑇|𝐴] = 0.

False positive  𝑃[𝑡𝑒𝑠𝑡 𝑖𝑠 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑏𝑒𝑖𝑛𝑔 𝑡ℎ𝑒 𝑝𝑒𝑟𝑠𝑜𝑛 ℎ𝑒𝑎𝑙𝑡ℎ𝑦] = 𝑃[𝑇|𝐴𝑐] = 0. 04

ERROR ON VICARIO LEVI : there is an incorrect statement on the book saying that

𝑃[𝑇|𝐴] + 𝑃[𝑇|𝐴𝑐] = 1 (this is how on the book they introduce the false positive from the sensitivity)

This NOT TRUE. The only correct relation that we can introduce is

𝑃[𝑇|𝐴] + 𝑃[𝑇𝑐|𝐴] = 1

In other words the complementary event of T is still the complementary also in the “reduced” sample space given by the event A that poses the condition.

This can be proved:

𝑃[𝑇|𝐴] + 𝑃[𝑇𝑐|𝐴] =

𝑃[𝑇 ∩ 𝐴]

𝑃[𝐴]

𝑃[𝑇𝑐^ ∩ 𝐴]

𝑃[𝐴]

𝑃[(𝑇 ∪ 𝑇𝑐) ∩ 𝐴]

𝑃[𝐴]

𝑃[𝑆 ∩ 𝐴]

𝑃[𝐴]

𝑃[𝐴]

𝑃[𝐴]

While it cannot be done for the statement reported on the book. Therefore, the info on false positive needs to be given as a separate input data.

END OF COMMENT ON THE ERROR

Going back to the exercise… The probability requested is a conditional probability: probability that, being the test positive, the person is really sick  P[A|T]. I can apply the Bayes formula because the event A and its complementary are mutually exclusive and exhaustive:

𝑃[𝐴|𝑇] =

𝑃[𝑇|𝐴]𝑃[𝐴]

𝑃[𝑇|𝐴]𝑃[𝐴] + 𝑃[𝑇|𝐴𝑐]𝑃[𝐴𝑐^ ]

So, even if you get the test positive, the probability of being actually sick is rather small, due to the low morbidity of the disease as compared to the false positive. If we reduce the false positive by one order of magnitude (0.4%) so that it is in the same order as the morbidity, the requested probability becomes 54%.

Ex 1.24 Vicario Levi (importance of how to correctly introduce statistical hypotheses when data are missing)

You have box containing marbles, and you do not know whether they are all white or half white and half black. You extract one marble and it is white, what is then the probability that they are all white?

Definition of events:

W = all marbles are white;

H = they are half and half=Wc

These two events are mutually exclusive and exhaustive

B= I extract one white marble

Probability requested is

𝑃[ℎ𝑎𝑣𝑖𝑛𝑔 𝑒𝑥𝑡𝑟𝑎𝑐𝑡𝑒𝑑 𝑜𝑛𝑒 𝑤ℎ𝑖𝑡𝑒 𝑚𝑎𝑟𝑏𝑙𝑒, 𝑡ℎ𝑒𝑦 𝑎𝑟𝑒 𝑎𝑙𝑙 𝑤ℎ𝑖𝑡𝑒] = 𝑃[𝑊|𝐵]

I may use the Bayes formula because the events are satisfying the hypothesis, but we need to introduce some reasonable number for the missing probabilities.

Known data:

𝑃[𝑏𝑒𝑖𝑛𝑔 𝑎𝑙𝑙 𝑤ℎ𝑖𝑡𝑒, 𝐼 𝑒𝑥𝑡𝑟𝑎𝑐𝑡 𝑜𝑛𝑒 𝑤ℎ𝑖𝑡𝑒 ] = 𝑃[𝐵|𝑊] = 1

𝑃[𝑏𝑒𝑖𝑛𝑔 ℎ𝑎𝑙𝑓 𝑎𝑛𝑑 ℎ𝑎𝑙𝑓, 𝐼 𝑒𝑥𝑡𝑟𝑎𝑐𝑡 𝑜𝑛𝑒 𝑤ℎ𝑖𝑡𝑒 ] = 𝑃[𝐵|𝑊𝑐] =

What is assumed, not having other info:

𝑃[𝑊] = 𝑃[𝑊𝑐^ ] =

Basically, no preference for the option that they are all white or half and half is introduced.

Application of Bayes formula

𝑃[𝑊|𝐵] =

𝑃[𝐵|𝑊]𝑃[𝑊]

𝑃[𝐵|𝑊]𝑃[𝑊] + 𝑃[𝐵|𝐻]𝑃[𝐻]

And therefore

𝑃[𝐻|𝐵] = 𝑃[𝑊𝑐|𝐵] = 1 − 𝑃[𝑊|𝐵] =