Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Probability and Statistics ì

for Computer Science

“A major use of probability in


statistical inference is the
updating of probabilities when
certain events are observed” –
Prof. M.H. DeGroot
Credit: wikipedia

Hongye Liu, Teaching Assistant Prof, CS361, UIUC,9.5.2023


Warm up
1) 10 people quene
10x9x8 x .... x 1 =

10 !

4
of queue
2) out 10

10x9x8x7 =2
S out of 10
group
3)
so !
!
- 6 !
is
I redundency factor
work at home
Warm up (II)
✺Fill the blanks:
“I am an avid vegetarian and I enjoy eating all day
long, people admire my appetite and like to watch
me eat.” I am a _ _ _ _ _. How many ways are there
to rearrange these 5 letters? ______. If you draw 2
letters from them, how many outcomes (order
matters) are there that are without “a”?
Objectives

✺Probability
✺ Probability calculation
✺ Conditional Probability
✺Bayes rule
✺Independence
Venn Diagrams of events as sets

Ω E1 E2

E1 ∪ E2 E1 ∩ E2 E1 c E1 − E2
Senate Committee problem

The United States Senate contains two senators


from each of the 50 states. If a committee of
eight senators is selected at random, what is the
probability that it will contain at least one of the
two senators from IL?
EC :

more of
2 IL Get
ins-H
10 =

(8)
IEl PCER1-P(EY= 1-
E
L 2013 -- -

Probability: Birthday problem


✺ Among 30 people, what is the probability that
at least 2 of them celebrate their birthday on
the same day? Assume that there is no
February 29 and each day of the year is equally
likely to be a birthday.
them share
Ea :
more of

1021 :
365x365-- ↳
=

3653
363 365 !
1 =4 36 -

- -
=
:

-
30
335 !
Counting may not work
✺This is one important reason to use
the method of reasoning with
properties
What if the event has infinite
outcomes
✺ Tossing a fair coin until head appears
✺ Coin is tossed at least 3 times
This event includes infinite # of outcomes.
And the outcomes don’t have equal
E is is TB
probability. :

zadisi & God


is H3
-
O TTTH, TTTTH….
TTH,
↳ a
joint event
Conditional Probability
✺Motivation of conditional
probability
Conditional Probability
✺Example:
An insurance company knows in a
population of 100 thousands females,
89.835% expect to live to age 60, while
57.062% can expect to live to 80. Given a
woman at the age of 60, what is the
probability that she lives to 80?
Conditional Probability
✺Given the condition she isO
60
already, the size of the sample
space for the outcomes has
changed to
89,835 instead of 100,000
000

101 =
100,

e IEso
Gret so
1E60l=

lEgol=

D(ESo(E60)
-
= I /

Int
In = 289835
-
Conditional Probability
✺ The probability of A given B
Ω P (A ∩ B)
P (A|B) =
P (B)
B
A∩B
A
P (B) != 0
A

The “Size” analogy


Conditional Probability
A : a woman 57, 062
P (A|B) = = 0.6352
lives to 80 89, 835
B : a woman is -6w
at 60 now P (A ∩ B) 1021
P (A|B) = --

89 835
P (B) -
,

lo

0 .
6352
57, 062
While P (A) =
100, 000
= 0.57062
Conditional Probability: die example

Throw 5-sided fair Y 5


die twice. 4
3
A : max(X, Y ) = 4 2 D
B : min(X, Y ) = 2 1
1 2 3 4 5
X
P (A|B) =? =
P(B)
=

E
Conditional probability, that is?

P (A ∩ B)
P (A|B) = P (B) != 0
P (B)
probability It satisfies
!
Still a

raxioms (
p(2) An
=

P(AIB) +
P(APB) =

? PoE -B
P(a)
-

PLB)
P(A UAzlB)
,
= ? if ApnAz =

P
(B)
=

P(A , +

P(A -)B)
Multiplication rule using conditional
probability
✺ Joint event
P (A ∩ B)
P (A|B) = P (B) =
! 0
P (B)
-

⇒ P (A ∩ B) = P (A|B)P (B)
T
carditional
N
prior
Multiplication using conditional
probability
(A ∩ B) = 00
⇒ P& P (A|B)P (B)
/ p(meat/soups
0.5
C
meat↓
~P(sompumeat) ?

p(Soup) 0.3 =Pssoups 1) Meat/somp3 ·

↓ soup fish 8 X 5 0
4
=

0
=0
-
.

0.8 -

0.2
Cr
vegetable Disoup
fish >
(start) meets
meat ? Pssoup
0.3 =

0.2 0.4 +P soup ~ vers


Juice fish
2
84 0 5
.
+ 0 2x0 .

0
.

0.3 vegetable
Multiplication using conditional
probability
⇒ P (A ∩ B) = P (A|B)P (B) Ment -

Simp PCA/B > meat


prior
0.5
PB) = ?
p(AB)
P(B
! soup 0.3 fish )
PcAnD)
-
0.8 ?
p(B)
=
0.2
vegetable
(start)
0.3
meat P(A B) =
1 -

P(AI)
0.2 0.4
Juice fish A meat B :
soup
P(D)
:

D :

juice
0.3 vegetable
Multiplication using conditional
probability
⇒ P (A ∩ B) = P (A|B)P (B) 0 6 ice cream

/P(AIB
.

meat cheesecake
0.5 8 4
Cheesecake
-

2
P(B
! 0.3
:

soup fish
0.8
0.2
vegetable P(C(B) = ?
(start)
meat
0.3
0.2 0.4
Juice fish
P(D)
0.3 vegetable
A : meat B :

soup D :
juice
Symmetry of joint event in terms of
conditional prob.
P (A ∩ B)
P (A|B) = P (B) != 0
P (B)
= As

p>B(A) P(A)
⇒ P (A ∩ B) = P (A|B)P (B)
⇒ P (B ∩ A) = P (B|A)P (A)
Symmetry of joint event in terms of
conditional prob.

∵ P (B ∩ A) = P (A ∩ B)

P (A|B)P (B) = P (B|A)P (A)
The famous Bayes rule
P (A|B)P (B) = P (B|A)P (A)

⇒ P (B|A)P (A)
P (A|B) =
P (B)
P' ) PIAS
PLAID)
.

P(D>
Thomas Bayes (1701-1761)
Bayes rule: lemon cars
There are two car factories, A and B, that
supply the same dealer. Factory A produced
1000 cars, of which 10 were lemons. Factory B
produced 2 cars and both were lemons. You
bought a car that turned out to be a lemon.
What is the probability that it came from 2

factory B? P>LIB) PCB) if 1007


·
-

--
P>BK)
=

12

p() -

1003
Simulation of Conditional
Probability

http://www.randomservices.or
g/random/apps/ConditionalPr
obabilityExperiment.html
Additional References
✺ Charles M. Grinstead and J. Laurie Snell
"Introduction to Probability”
✺ Morris H. Degroot and Mark J. Schervish
"Probability and Statistics”
Assignments
✺ Work on Module Week 3 on Canvas
✺ Next time: More on independence and
conditional probability
See you next time

See You!

You might also like