Docsity

Probability Theory: Conditional Probability and Bayes' Theorem, Exercises of Stochastic Processes

Toggle sidebar
bg1
16
Chapter 2: Probability
The aim of this chapter is to revise the basic rules of probability. By the end
of this chapter, you should be comfortable with:
•conditional probability, and what you can and can’t do with conditional
expressions;
•the Partition Theorem and Bayes’ Theorem;
•First-Step Analysis for finding the probability that a process reaches some
state, by conditioning on the outcome of the first step;
•calculating probabilities for continuous and discrete random variables.
2.1 Sample spaces and events
Definition: Asample space, Ω, is a
set of possible outcomes of a random
experiment.
Definition: An event,A, is a
subset of the sample space.
This means that event Ais simply
a collection of outcomes.
Example:
Random experiment: Pick a person in this class at random.
Sample space: Ω = {
all people in class
}
Event A:A={
all males in class
}
.
Definition: Event Aoccurs if
the outcome of the random experiment is a member
of the set
A
.
In the example above, event Aoccurs if
the person we pick is male.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Probability Theory: Conditional Probability and Bayes' Theorem and more Exercises Stochastic Processes in PDF only on Docsity!

Chapter 2: Probability

The aim of this chapter is to revise the basic rules of probability. By the end of this chapter, you should be comfortable with:

  • conditional probability, and what you can and can’t do with conditional expressions;
  • the Partition Theorem and Bayes’ Theorem;
  • First-Step Analysis for finding the probability that a process reaches some state, by conditioning on the outcome of the first step;
  • calculating probabilities for continuous and discrete random variables.

2.1 Sample spaces and events

Definition: A sample space, Ω, is a set of possible outcomes of a random

experiment.

Definition: An event, A, is a subset of the sample space.

This means that event A is simply a collection of outcomes.

Example:

Random experiment: Pick a person in this class at random.

Sample space: Ω = { all people in class}

Event A: A = { all males in class}.

Definition: Event A occurs if the outcome of the random experiment is a member

of the set A.

In the example above, event A occurs if the person we pick is male.

2.2 Probability Reference List

The following properties hold for all events A, B.

  • P(∅) = 0.
  • 0 ≤ P(A) ≤ 1.
  • Complement: P(A) = 1 − P(A).
  • Probability of a union: P(A ∪ B) = P(A) + P(B) − P(A ∩ B). For three events A, B, C: P(A∪B∪C) = P(A)+P(B)+P(C)−P(A∩B)−P(A∩C)−P(B∩C)+P(A∩B∩C).

If A and B are mutually exclusive, then P(A ∪ B) = P(A) + P(B).

  • Conditional probability: P(A | B) =

P(A ∩ B)

P(B)

  • Multiplication rule: P(A^ ∩^ B) =^ P(A^ |^ B)P(B) =^ P(B^ |^ A)P(A).
  • The Partition Theorem: if B 1 , B 2 ,... , Bm form a partition of Ω, then

P(A) =

∑^ m

i=

P(A ∩ Bi) =

∑^ m

i=

P(A | Bi)P(Bi) for any event A.

As a special case, B and B partition Ω, so: P(A) = P(A ∩ B) + P(A ∩ B) = P(A | B)P(B) + P(A | B)P(B) for any A, B.

  • Bayes’ Theorem: P(B | A) =

P(A | B)P(B)

P(A)

More generally, if B 1 , B 2 ,... , Bm form a partition of Ω, then

P(Bj | A) =

P(A | Bj )P(Bj) ∑m i=1 P(A^ |^ Bi)P(Bi)^

for any j.

  • Chains of events: for any events A 1 , A 2 ,... , An,

P(A 1 ∩A 2 ∩.. .∩An) = P(A 1 )P(A 2 | A 1 )P(A 3 | A 2 ∩A 1 )... P(An | An− 1 ∩.. .∩A 1 ).

In the above example, we could replace ‘skiing’ with any attribute B. We have:

P(skis) =

skiers in class

class

; P(skis | female) =

female skiers in class

females in class

so:

P(B) =

B’s in class

total # people in class

and:

P(B | female) =

female B’s in class

total # females in class

in class who are B and female

in class who are female

Likewise, we could replace ‘female’ with any attribute A:

P(B | A) =

number in class who are B and A number in class who are A

This is how we get the definition of conditional probability:

P(B | A) =

P(B and A) P(A).

P(B ∩ A)

P(A)

By conditioning on event A, we have changed the sample space to the set of A’s only.

Definition: Let A and B be events on the same sample space: so A ⊆ Ω and B ⊆ Ω. The conditional probability of event B, given event A, is

P(B | A) =

P(B ∩ A)

P(A)

Multiplication Rule: (Immediate from above). For any events A and B,

P(A ∩ B) = P(A | B)P(B) = P(B | A)P(A) = P(B ∩ A).

Conditioning as ‘changing the sample space’ The idea that “conditioning” = “changing the sample space” can be very helpful in understanding how to manipulate conditional probabilities.

Any ‘unconditional’ probability can be written as a conditional probability:

P(B) = P(B | Ω).

Writing P(B) = P(B | Ω) just means that we are looking for the probability of event B, out of all possible outcomes in the set Ω.

In fact, the symbol P belongs to the set Ω: it has no meaning without Ω. To remind ourselves of this, we can write P = PΩ.

Then P(B) = P(B | Ω) = PΩ(B).

Similarly, P(B | A) means that we are looking for the probability of event B, out of all possible outcomes in the set A.

So A is just another sample space. Thus we can manipulate conditional probabilities P( · | A) just like any other probabilities, as long as we always stay inside the same sample space A.

The trick: Because we can think of A as just another sample space, let’s write

P( · | A) = PA( · ) Note: NOT standard notation!

Then we can use PA just like P, as long as we remember to keep the A subscript on EVERY P that we write.

  1. Which of the following is true? (a) P(B | A) = 1 − P(B | A). (b) P(B | A) = P(B) − P(B | A).

Solution:

P(B | A) = PA(B) = 1 − PA(B) = 1 − P(B | A).

Thus the correct answer is (a).

  1. Which of the following is true? (a) P(B ∩ A) = P(A) − P(B ∩ A). (b) P(B ∩ A) = P(B) − P(B ∩ A).

Solution:

P(B ∩ A) = P(B | A)P(A) = PA(B)P(A)

1 − PA(B)

P(A)

= P(A) − P(B | A)P(A)

= P(A) − P(B ∩ A).

Thus the correct answer is (a).

  1. True or false: P(B | A) = 1 − P(B | A)?

Answer: False. P(B | A) = PA(B). Once we have PA, we are stuck with it! There is no easy way of converting from PA to P (^) A: or anything else. Probabilities in one sample space (PA) cannot tell us anything about probabilities in a different sample space (P (^) A).

Exercise: if we wish to express P(B | A) in terms of only B and A, show that

P(B | A) =

P(B) − P(B | A)P(A)

1 − P(A)

. Note that this does not simplify nicely!

2.4 The Partition Theorem (Law of Total Probability)

Definition: Events A and B are mutually exclusive, or disjoint, if A ∩ B = ∅.

This means events A and B cannot happen together. If A happens, it excludes B from happening, and vice-versa.

If A and B are mutually exclusive, P(A ∪ B) = P(A) + P(B). For all other A and B, P(A ∪ B) = P(A) + P(B) − P(A ∩ B).

Definition: Any number of events B 1 , B 2 ,... , Bk are mutually exclusive if every

pair of the events is mutually exclusive: ie. Bi ∩ Bj = ∅ for all i, j with i 6 = j.

Definition: A partition of Ω is a collection of mutually exclusive events whose union is Ω.

That is, sets B 1 , B 2 ,... , Bk form a partition of Ω if

Bi ∩ Bj = ∅ for all i, j with i 6 = j ,

and

⋃^ k

i=

Bi = B 1 ∪ B 2 ∪... ∪ Bk = Ω.

B 1 ,... , Bk form a partition of Ω if they have no overlap and collectively cover all possible outcomes.

Intuition behind the Partition Theorem:

The Partition Theorem is easy to understand because it simply states that “the whole is the sum of its parts.”

A

A ∩ B 1 A^ ∩^ B 2

A ∩ B 3 A ∩ B 4

P(A) = P(A ∩ B 1 ) + P(A ∩ B 2 ) + P(A ∩ B 3 ) + P(A ∩ B 4 ).

2.5 Bayes’ Theorem: inverting conditional probabilities

Bayes’ Theorem allows us to “invert” a conditional statement, ie. to express

P(B | A) in terms of P(A | B).

Theorem 2.5: Bayes’ Theorem

For any events A and B: P(B | A) =

P(A | B)P(B)

P(A)

Proof: P(B ∩ A) = P(A ∩ B) P(B | A)P(A) = P(A | B)P(B) (multiplication rule)

∴ P(B | A) =

P(A | B)P(B)

P(A)

Extension of Bayes’ Theorem Suppose that B 1 , B 2 ,... , Bm form a partition of Ω. By the Partition Theorem,

P(A) =

∑^ m

i=

P(A | Bi)P(Bi).

Thus, for any single partition member Bj , put B = Bj in Bayes’ Theorem to obtain:

P(Bj | A) = P(A | Bj )P(Bj) P(A)

∑P(A^ |^ Bj)P(Bj^ ) m i=1 P(A^ |^ Bi)P(Bi)

A

B 1 B 2

B 3 B 4

Special case: m = 2

Given any event B, the events B and B form a partition of Ω. Thus:

P(B | A) =

P(A | B)P(B)

P(A | B)P(B) + P(A | B)P(B)

Example: In screening for a certain disease, the probability that a healthy person wrongly gets a positive result is 0.05. The probability that a diseased person wrongly gets a negative result is 0.002. The overall rate of the disease in the population being screened is 1%. If my test gives a positive result, what is the probability I actually have the disease?

2.6 First-Step Analysis for calculating probabilities in a process

In a stochastic process, what happens at the next step depends upon the cur- rent state of the process. We often wish to know the probability of eventually reaching some particular state, given our current position.

Throughout this course, we will tackle this sort of problem using a technique called First-Step Analysis.

The idea is to consider all possible first steps away from the current state. We derive a system of equations that specify the probability of the eventual outcome given each of the possible first steps. We then try to solve these equations for the probability of interest.

First-Step Analysis depends upon conditional probability and the Partition Theorem. Let S 1 ,... , Sk be the k possible first steps we can take away from our current state. We wish to find the probability that event E happens eventually. First-Step Analysis calculates P(E) as follows:

P(E) = P(E|S 1 )P(S 1 ) +... + P(E|Sk)P(Sk).

Here, P(S 1 ),... , P(Sk) give the probabilities of taking the different first steps 1 , 2 ,... , k.

Example: Tennis game at Deuce. Venus and Serena are playing tennis, and have reached the score Deuce (40-40). (Deuce comes from the French word Deux for ‘two’, meaning that each player needs to win two consecutive points to win the game.)

For each point, let:

p = P(Venus wins point), q = 1 − p = P(Serena wins point).

Assume that all points are independent.

Let v be the probability that Venus wins the game eventually, starting from Deuce. Find v.

VENUS WINS (W)

VENUS AHEAD (A)

VENUS BEHIND (B)

p

q

p p

q q

VENUS LOSES (L)

DEUCE (D)

Use First-step analysis. The possible steps starting from Deuce are:

  1. Venus wins the next point (probability p): move to state A;
  2. Venus loses the next point (probability q): move to state B.

Let V be the event that Venus wins EVENTUALLY starting from Deuce, so v = P(V | D). Starting from Deuce (D), the possible steps are to states A and B. So: v = P(Venus wins | D) = P(V | D) = PD(V ) = PD(V | A)PD(A) + PD(V | B)PD(B) = P(V | A)p + P(V | B)q. (⋆)

Now we need to find P(V | A), and P(V | B), again using First-step analysis:

P(V | A) = P(V | W )p + P(V | D)q = 1 × p + v × q = p + qv. (a)

Similarly,

P(V | B) = P(V | L)q + P(V | D)p = 0 × q + v × p = pv. (b)

Substituting (a) and (b) into (⋆), v = (p + qv)p + (pv)q v = p^2 + 2pqv v(1 − 2 pq) = p^2

v = p^2 1 − 2 pq

Note: Because p + q = 1, we have:

1 = (p + q)^2 = p^2 + q^2 + 2pq. So the final probability that Venus wins the game is:

v =

p^2 1 − 2 pq

p^2 p^2 + q^2

Note how this result makes intuitive sense. For the game to finish from Deuce, either Venus has to win two points in a row (probability p^2 ), or Serena does (probability q^2 ). The ratio p^2 /(p^2 + q^2 ) describes Venus’s ‘share’ of the winning probability.

First-step analysis as the Partition Theorem:

Our approach to finding v = P(Venus wins) can be summarized as: P(Venus wins) = v =

first steps

P(V | first step)P(first step).

First-step analysis is just the Partition Theorem:

The sample space is Ω = { all possible routes from Deuce to the end }.

An example of a sample point is: D → A → D → B → D → B → L. Another example is: D → B → D → A → W.

The partition of the sample space that we use in first-step analysis is: R 1 = { all possible routes from Deuce to the end that start with D → A} R 2 = { all possible routes from Deuce to the end that start with D → B}

Then first-step analysis simply states: P(V ) = P(V | R 1 )P(R 1 ) + P(V | R 2 )P(R 2 ) = PD(V | A)PD(A) + PD(V | B)PD(B).

Notation for quick solutions of first-step analysis problems

Defining a helpful notation is central to modelling with stochastic processes. Setting up well-defined notation helps you to solve problems quickly and easily. Defining your notation is one of the most important steps in modelling, because it provides the conversion from words (which is how your problem starts) to mathematics (which is how your problem is solved).

Several marks are allotted on first-step analysis questions for setting up a well-defined and helpful notation.

VENUS WINS (W) VENUS AHEAD (A) VENUS BEHIND (B) p

q

p p

q (^) q LOSES (L)^ VENUS

DEUCE (D)

Here is the correct way to formulate and solve this first-step analysis problem.

Need the probability that Venus wins eventually, starting from Deuce.

  1. Define notation: let vD = P(Venus wins eventually | start at state D) vA = P(Venus wins eventually | start at state A) vB = P(Venus wins eventually | start at state B)
  2. First-step analysis:v D =^ pvA +^ qvB (a) vA = p × 1 + qvD (b) vB = pvD + q × 0 (c)

Information given: p 0 = P(R | currently has $0) = 1 , pN = P(R | currently has $N ) = 0.

First-step analysis:

px = P(R | has $x)

= 12 P

R | has $(x + 1)

+ 12 P

R | has $(x − 1)

= 12 px+1 + 12 px− 1 (⋆)

True for x = 1, 2 ,... , N − 1 , with boundary conditions p 0 = 1, pN = 0.

Solution of difference equation (⋆):

px = 12 px+1 + 12 px− 1 for x = 1, 2 ,... , N − 1 ; p 0 = 1 (⋆) pN = 0.

We usually solve equations like this using the theory of 2nd-order difference equations. For this special case we will also verify the answer by two other methods.

1. Theory of linear 2nd order difference equations

Theory tells us that the general solution of (⋆) is px = A + Bx for some constants

A, B and for x = 0, 1 ,... , N. Our job is to find A and B using the boundary

conditions:

px = A + Bx for constants A and B and for x = 0, 1 ,... , N.

So

p 0 = A + B × 0 = 1 ⇒ A = 1 ; pN = A + B × N = 1 + BN = 0 ⇒ B = −

N

So our solution is: px = A + B x = 1 −

x N

for x = 0, 1 ,... , N.

For Stats 325, you will be told the general solution of the 2nd-order difference equation and expected to solve it using the boundary conditions.

For Stats 721, we will study the theory of 2nd-order difference equations. You will be able to derive the general solution for yourself before solving it.

Question: What is the probability that the gambler wins (ends with $N), starting with $x?

P

ends with $N

= 1−P

ends with $ 0

= 1−px =

x N

for x = 0, 1 ,... , N.

  1. Solution by inspection

The problem shown in this section is the symmetric Gambler’s Ruin, where the probability is 12 of moving up or down on any step. For this special case, we can solve the difference equation by inspection.

We have:

px = 12 px+1 + 12 px− 1 1 2 px^ +^

1 2 px^ =^

1 2 px+1^ +^

1 2 px−^1

Rearranging: px− 1 − px = px − px+1. Boundaries: p 0 = 1, pN = 0.

1 2 N

(^1) ( − p ) same size for each

p =N 0

0

px−1 x

p = 0 1

x

There are N steps to go down

from p 0 = 1 to pN = 0.

Each step is the same size,

because

(px− 1 − px) = (px − px+1) for all x.

So each step has size 1 /N ,

⇒ p 0 = 1 , p 1 = 1 − 1 /N ,

p 2 = 1 − 2 /N , etc.

So

px = 1 −

x N

as before.