2. STOCHASTIC MODELS
N. Li - SJTU 2
Sample space
Consider any experiment affected by randomness, the sample space Ω is the set
of all its possible outcomes.
Example: Flipping a coin
Ω = 𝐻, 𝑇
where H and T mean head and tail, respectively.
Example: Rolling two dice
Ω =
(1,1) ⋯ (1,6)
⋮ ⋱ ⋮
(6,1) ⋯ (6,6)
Example: Measuring the life time of an industrial robot
Ω = 0, ∞)
3. STOCHASTIC MODELS
N. Li - SJTU 3
Events
An event is any subset of the sample space Ω.
The event 𝐸 occurs when the outcome of the experiment lies in the set 𝐸 ⊆ Ω.
Example: Flipping a coin
If 𝐸 = {𝐻}, then 𝐸 is the event that a head appears on the flip of the coin.
Example: Rolling two dice
If 𝐸 = {7}, then 𝐸 is the event that a seven appears on the roll of the dice.
Example: Measuring the life time of an industrial robot
If 𝐸 = (5, ∞), then 𝐸 is ?
4. STOCHASTIC MODELS
N. Li - SJTU 4
Example
A more complex event is the odd event when rolling a die:
𝐸 = {1,3,5} ⊂ Ω.
If the outcome of the experiment is 4, then the event 𝐸 has not occurred.
If the outcome of the experiment is 5, then the event 𝐸 has occurred.
5. STOCHASTIC MODELS
N. Li - SJTU 5
Logics of events
𝐸
𝐸𝑐
𝐹
𝐸
At least one of the two events occurs
(union)
Two events occur jointly
(intersection)
𝐹
𝐸
An event does not occur (complement)complement运算是基于samp
We use set theory to define new events from the natural events (i.e., the
outcomes of the experiment).
6. STOCHASTIC MODELS
N. Li - SJTU 6
Logics of events
Events 𝐸 and 𝐹 are incompatible if 𝐸 ∩ 𝐹 = {∅}. In this case the two events are
also called incompatible. Set {∅} is the impossible event.
Event 𝐸 implies event 𝐹 if 𝐸 ⊂ 𝐹
Events 𝐸1, 𝐸2, … , 𝐸𝑛 are mutually incompatible and exhaustive if 𝑖=1
𝑛
𝐸𝑖 = Ω
and 𝑖=1
𝑛
𝐸𝑖 = ∅
𝐹
𝐸
𝐹
𝐸
7. STOCHASTIC MODELS
N. Li - SJTU 7
Union of events
Given any two events 𝐸 and 𝐹 of the same sample space Ω, we define 𝐸 ∪ 𝐹 as
the new event consisting of all outcomes that are either in 𝐸 or in 𝐹 or both in 𝐸
and 𝐹.
Example: Flipping a coin
If 𝐸 = {𝐻} and 𝐹 = {𝑇} , then 𝐸 ∪ 𝐹 = 𝐻, 𝑇 = Ω is the certain event.
Example: Rolling two dice
If 𝐸 = {6,7} and 𝐹 = {5,6} , then 𝐸 ∪ 𝐹 = {5,6,7}
Example: Measuring the life time of an industrial robot
If 𝐸 = 0,1) and 𝐹 = (0.5,2), then 𝐸 ∪ 𝐹=?
8. STOCHASTIC MODELS
N. Li - SJTU 8
Intersection of events
Given any two events 𝐸 and 𝐹 of the same sample space Ω, we define 𝐸 ∩ 𝐹 as
the new event consisting of all outcomes that are either in 𝐸 or in 𝐹.
Example: Flipping a coin
If 𝐸 = {𝐻} and 𝐹 = {𝑇} , then 𝐸 ∩ 𝐹 = ∅ is the impossible event.
Example: Rolling a dice
If 𝐸 = {6,7} and 𝐹 = {5,6} , then 𝐸 ∩ 𝐹 = {6}
Example: Measuring the life time of an industrial robot
If 𝐸 = 0,1) and 𝐹 = (0.5,2), then 𝐸 ∩ 𝐹=?
9. STOCHASTIC MODELS
N. Li - SJTU 9
Probability space
A probability space is defined by (Ω, ℱ, 𝑃) as follows:
Ω is the sample space.
ℱ is a collection of subsets of Ω called the event space. It is chosen so as to satisfy
the following conditions:
• If 𝐴 is an event (i.e., 𝐴 ∈ ℱ), then the complement of 𝐴 is also an event (i.e.,
𝐴𝑐
∈ ℱ).
• If 𝐴1, 𝐴2, . . . are all events, then their union is also an event.
𝑃 is a probability measure mapping events/outcomes into the interval 0,1].
Note: ℱ guarantees that we can assign a probability measure to any event
𝐴 ∈ ℱ. Later on, we will always assume that the event space contains all subsets of
Ω.
10. STOCHASTIC MODELS
N. Li - SJTU 10
Probabilities
Consider an experiment with sample space Ω, the probability that the event 𝐸 ∈
ℱ occurs is a number 𝑃(𝐸) satisfying:
1. 0 ≤ 𝑃 𝐸 ≤ 1
2. 𝑃 Ω = 1
3. For any sequence of events 𝐸1, 𝐸2, … , 𝐸𝑛 that are mutually exclusive (i.e.,
𝐸𝑛 ∩ 𝐸𝑚 = ∅, 𝑛 ≠ 𝑚), then
𝑃
𝑛=1
∞
𝐸𝑛 =
𝑛=1
∞
𝑃(𝐸𝑛)
Intuitive interpretation: if our experiment is repeated over and over again, then
(with probability 1) the proportion of time that event 𝐸 occurs will just be 𝑃(𝐸).
11. STOCHASTIC MODELS
N. Li - SJTU 11
Probabilities
Example: Flipping a coin
𝑃 𝐻 = P 𝑇 =
1
2
Suppose to repeat the experiment, what’s 𝑃({(𝐻, 𝐻)}) ?
𝑃({(𝐻, 𝐻)}) =¼
Example: Rolling one die
𝑃 1 = 𝑃 2 = 𝑃 3 = 𝑃 4 = 𝑃 5 = 𝑃 6 =
1
6
Note: in doing this, we are implicitly assuming symmetry in the sample space
(also known as the principal of insufficient reason as defined by Bernoulli).
12. STOCHASTIC MODELS
N. Li - SJTU 12
Probability of union of 2 events
Given two events not mutually exclusive:
𝑃 𝐸 ∪ 𝐹 = 𝑃 𝐸 + 𝑃 𝐹 − 𝑃(𝐸 ∩ 𝐹)
Example: Flipping two coins
Ω = 𝐻, 𝐻 , 𝐻, 𝑇 , 𝑇, 𝐻 , 𝑇, 𝑇 , 𝐸 = 𝐻, 𝐻 , 𝐻, 𝑇 , 𝐹 = { 𝐻, 𝐻 , 𝑇, 𝐻 }
𝑃 𝐸 ∪ 𝐹 =?
If we consider 𝐸 and 𝐸𝑐 that are mutually exclusive:
𝑃 𝐸𝑐 = 1 − 𝑃(𝐸)
This formula can be generalized to 𝑛 events (next slide).
𝐹
𝐸 𝐸 ∩ 𝐹
𝑃(𝐸)+𝑃(𝐹)−𝑃(𝐸∩𝐹)=1/2+1/2−1/4=3/4
13. STOCHASTIC MODELS
N. Li - SJTU 13
Probability of union of n events
Given 𝑛 events not mutually exclusive:
𝑃 𝐸1 ∪ 𝐸2 ∪ ⋯ ∪ 𝐸𝑛 =
𝑖
𝑃(𝐸𝑖) −
𝑖,𝑗
𝑃 𝐸𝑖 ∩ 𝐸𝑗 +
𝑖,𝑗,𝑘
𝑃 𝐸𝑖 ∩ 𝐸𝑗 ∩ 𝐸𝑘 +
−
𝑖,𝑗,𝑘,𝑙
𝑃 𝐸𝑖 ∩ 𝐸𝑗 ∩ 𝐸𝑘 ∩ 𝐸𝑙 + ⋯ + −1 𝑛+1𝑃(𝐸1 ∩ 𝐸2 ∩ ⋯ ∩ 𝐸𝑛)
14. STOCHASTIC MODELS
N. Li - SJTU 14
Conditional probabilities( )
What is the probability that event 𝐸 occurs given that we know event 𝐹 has
occurred ?
𝑃 𝐸|𝐹 =
𝑃(𝐸 ∩ 𝐹)
𝑃(𝐹)
Obviously, that is defined only for 𝑃 𝐹 > 0.
Practically speaking, 𝐹 becomes the new sample space and 𝐸 ∩ 𝐹 is scaled to it.
𝐹
𝐸
15. STOCHASTIC MODELS
N. Li - SJTU 15
Example
A family has two children. What is the conditional probability that both are boys
given that at least one of them is a boy ? Assume that all outcomes are equally
likely.
16. STOCHASTIC MODELS
N. Li - SJTU 16
Example
Bev can either take a course in computers or in chemistry. If Bev takes the
computer course, then she will receive an A grade with probability 1/2; if she
takes the chemistry course then she will receive an A grade with probability 1/3.
Bev decides to base her decision on the flip of a fair coin. What is the probability
that Bev will get an A in chemistry ?
17. STOCHASTIC MODELS
N. Li - SJTU 17
Suppose that each of three men at a party throws his hat into the center of the
room. The hats are first mixed up and then each man randomly selects a hat.
What is the probability that none of the three men selects his own hat?
Example
18. STOCHASTIC MODELS
N. Li - SJTU 18
Independence
The two events 𝐸 and 𝐹 are independent if:
𝑃 𝐸 ∩ 𝐹 = 𝑃 𝐸 𝑃(𝐹)
Therefore,
𝑃 𝐸|𝐹 =
𝑃(𝐸 ∩ 𝐹)
𝑃(𝐹)
= 𝑃(𝐸)
Two events that are not independent are said to be dependent.
Example: Rolling two dice
Event 𝐸 = sum is 6 and event 𝐹 = first die equals 4
𝑃 4,2 =
1
36
≠ 𝑃 𝐸 𝑃 𝐹 =
5
36
⋅
1
6
=
5
216
This means that events 𝐸 and 𝐹 are not independent.
19. STOCHASTIC MODELS
N. Li - SJTU 19
Independence
Are two disjoint events independent ?
If 𝐸 implies 𝐹, are the two events independent ?
𝐹
𝐸
𝐸
𝐹
20. STOCHASTIC MODELS
N. Li - SJTU 20
Independence
Generalizing to multiple events:
𝑃
∀𝑛
𝐸𝑛 =
∀𝑛
𝑃(𝐸𝑛)
Be careful,
Pairwise independent events can be jointly dependent
Jointly independent events can be pairwise dependent.
21. STOCHASTIC MODELS
N. Li - SJTU 21
Independence
Consider events 𝐸, 𝐹 and 𝐺. The couples of events 𝐸 and 𝐹, 𝐸 and 𝐺, 𝐹 and 𝐺 are
independent but it could be 𝑃 𝐸 ∩ 𝐹 ∩ 𝐺 ≠ 𝑃 𝐸 𝑃 𝐹 𝑃(𝐺).
Example
Consider a random experiment consisting of the draw of an integer number
between 1 and 4, where the four outcomes are equally likely.
Then, consider events 𝐴 = 1,2 , 𝐵 = 1,3 and 𝐶 = 1,4 .
What about their independence ?
𝑃 𝐴 ∩ 𝐵 = 𝑃 𝐴 ∩ 𝐶 = 𝑃 𝐵 ∩ 𝐶 = 𝑃 𝑜𝑢𝑡𝑐𝑜𝑚𝑒 𝑖𝑠 1 = 1
4 = 𝑃 𝐴 𝑃 𝐵 =
𝑃 𝐴 𝑃 𝐶 = 𝑃 𝐵 𝑃(𝐶) Pairwise independent
𝑃 𝐴 ∩ 𝐵 ∩ 𝐶 = 𝑃 𝑜𝑢𝑡𝑐𝑜𝑚𝑒 𝑖𝑠 1 = 1
4 ≠ 𝑃 𝐴 𝑃 𝐵 𝑃(𝐶) =
1
8
Triwise dependent
22. STOCHASTIC MODELS
N. Li - SJTU 22
Independence
What about the other way around ?
Example
Consider a three-dimensional space and events corresponding to a ball being
placed at a point characterized by three coordinates (𝑋, 𝑌, 𝑍). The possible
points are (1,0,0), (0,1,0), (0,0,1), (1,1,0), 1,1,1 with probabilities 1/8, 1/
8, 3/8, 2/8 and 1/8, respectively.
Define events 𝐴 = {𝑋 = 1}, 𝐵 = {𝑌 = 1} and 𝐶 = {𝑍 = 1}, what about their
independence ?
24. STOCHASTIC MODELS
N. Li - SJTU 24
Total probability theorem
Let 𝐸 and 𝐹 be events. We may express 𝑃(𝐸) as:
𝑃 𝐸 = 𝑃 𝐸 𝐹 𝑃 𝐹 + 𝑃 𝐸 𝐹𝑐
𝑃 𝐹𝑐
Absolute probabilities are weighted averages of conditional probabilities.
Proof
𝐸 = 𝐸 ∩ Ω = 𝐸 ∩ 𝐹 ∪ 𝐹𝐶 = 𝐸 ∩ 𝐹 ∪ 𝐸 ∩ 𝐹𝐶
𝐸 ∩ 𝐹 and 𝐸 ∩ 𝐹𝐶 are mutually exclusive, thus:
𝑃 𝐸 = P 𝐸 ∩ 𝐹 + 𝑃 𝐸 ∩ 𝐹𝐶 = P 𝐸|𝐹 𝑃 𝐹 + P 𝐸|𝐹𝐶 𝑃 𝐹𝐶
25. STOCHASTIC MODELS
N. Li - SJTU 25
Total probability theorem
Generalizing, if 𝐹1, 𝐹2, … , 𝐹𝑛 are mutually exclusive events such that
𝑖=1
𝑛
𝐹𝑖 = Ω, then:
𝑃 𝐸 =
𝑖=1
𝑛
𝑃 𝐸 𝐹𝑖 𝑃(𝐹𝑖)
Example
𝑃 𝐸 = 𝑃 𝐸 𝐹1 𝑃 𝐹1 + 𝑃 𝐸 𝐹2 𝑃 𝐹2 +𝑃 𝐸 𝐹3 𝑃 𝐹3 +𝑃 𝐸 𝐹4 𝑃 𝐹4
𝐹1
𝐹2
𝐹3
𝐹4 𝐸
26. STOCHASTIC MODELS
N. Li - SJTU 26
Bayes Theorem
Given two events 𝐸 and 𝐹, we can obtain:
𝑃 𝐹|𝐸 =
𝑃 𝐸|𝐹 𝑃(𝐹)
𝑃(𝐸)
Proof
𝑃 𝐹 𝐸 =
𝑃(𝐹 ∩ 𝐸)
𝑃(𝐸)
=
𝑃(𝐸 ∩ 𝐹)
𝑃(𝐸)
=
𝑃 𝐸 𝐹 𝑃(𝐹)
𝑃(𝐸)
𝐹
𝐸
𝐸 ∩ 𝐹
Bayes Theorem
27. STOCHASTIC MODELS
N. Li - SJTU 27
Bayes Formula
Using the total probability theorem we obtain the Bayes formula:
𝑃 𝐹
𝑗|𝐸 =
𝑃(𝐸|𝐹
𝑗)𝑃(𝐹
𝑗)
𝑖=1
𝑛
𝑃(𝐸|𝐹𝑖)𝑃(𝐹𝑖)
28. STOCHASTIC MODELS
N. Li - SJTU 28
Example: multiple choice test
In answering a question on a multiple-choice test a student either knows the
answer or guesses. Let 𝑝 be the probability that she knows the answer and 1 − 𝑝
the probability that she guesses.
Assume that a student who guesses at the answer will be correct with probability
1/𝑚, where 𝑚 is the number of multiple choice alternatives.
What is the conditional probability that a student knew the answer to a question
given that (s)he answered it correctly ?
𝐾 = 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 𝑘𝑛𝑜𝑤𝑠 𝑡ℎ𝑒 𝑎𝑛𝑠𝑤𝑒𝑟 , 𝐶 = 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 𝑎𝑛𝑠𝑤𝑒𝑟𝑠 𝑞𝑢𝑒𝑠𝑡𝑖𝑜𝑛 𝑐𝑜𝑟𝑟𝑒𝑐𝑡𝑙𝑦
Data: 𝑃 𝐾 = 𝑝, 𝑃 𝐾𝑐 = 1 − 𝑝, 𝑃 𝐶 𝐾𝑐 = 1
𝑚
𝑃 𝐾 𝐶 =
𝑃 𝐶 𝐾 𝑃(𝐾)
𝑃 𝐶 𝐾 𝑃 𝐾 + 𝑃 𝐶 𝐾𝑐 𝑃(𝐾𝑐)
=
𝑝
𝑝 +
1 − 𝑝
𝑚
=
𝑚𝑝
1 + 𝑝(𝑚 − 1)
As 𝑚 → ∞ 𝑃 𝐾 𝐶 →1 and 𝑃 𝐾𝑐 𝐶 →0 for any positive 𝑝
29. STOCHASTIC MODELS
N. Li - SJTU 29
Example: gender test
A quick and easy test is able to predict the gender of a baby very early during
childbearing. Unfortunately, the test is not 100% reliable:
If the unborn child is a male, the result of the test is “male” with a probability
of 90%
If the unborn child is a female, the result of the test is “female” with a
probability of 70%
Frances tries the test, and the result is “female”. Marie tries the test, and the
result is “male”. Between Frances and Marie, which one should be more
confident about the gender of her child ?
30. STOCHASTIC MODELS
N. Li - SJTU 30
Example: TV program
Consider a quite popular TV program, in which the participant sits in front of
three boxes A, B and C. One of the boxes contains a prize and a guy, who has no
clue has to choose one. Say that he chooses A.
The presenter knows where the prize is. He opens box C and shows that it does
not contain the prize.
Then, he offers the participant the possibility of giving up the previous choice
and switching to B.
Should the participant accept the offer ?
31. STOCHASTIC MODELS
N. Li - SJTU 31
Summary
The student acquire information about:
Sample space, events, Logics of events, probabilities
Conditional probabilities
Independence
Total probability theorem
Bayes Theorem