2.x β Chapter 2 summary and quiz
2.x β Chapter 2 summary and quiz#
Chapter summary#
In this chapter, we explored conditional probability, one of the most important concepts in probability theory and quantitative finance. Conditional probability allows us to update our beliefs about events when we receive new information.
Key concepts#
- Conditional Probability: The probability of an event given that another event has occurred - Conditional Probability
- Dependent Events: Events that influence each otherβs probabilities
- Multiplication Rule: Formula for calculating joint probabilities using conditional probabilities
- Chain Rule: Extension to multiple events
- Conditional Outcomes: Outcomes whose probabilities depend on other events
What we learned#
-
Conditional Probability and Dependent Events (2.1):
- Definition: (provided )
- Multiplication rule:
- Relationship to independence: if and only if and are independent
- Chain rule for multiple events:
-
Conditional Outcomes and Applications (2.2):
- Conditional outcomes in complex scenarios
- Probability trees for visualizing conditional scenarios
- Law of Total Probability (introduction):
- Conditional expectations:
- Applications to risk assessment, portfolio management, and trading strategies
Applications in quantitative finance#
- Risk Assessment: Adjusting default probabilities based on economic conditions
- Portfolio Management: Calculating portfolio returns conditional on market regimes
- Trading Strategies: Evaluating signal accuracy under different market conditions
- Credit Analysis: Understanding default probabilities given borrower characteristics
- Market Analysis: Modeling stock movements conditional on market conditions
Important formulas#
| Concept | Formula |
|---|---|
| Conditional Probability | |
| Multiplication Rule | |
| Chain Rule (2 events) | |
| Chain Rule (n events) | |
| Independence (conditional) | if and only if independent |
| Law of Total Probability | (for mutually exclusive, exhaustive ) |
| Conditional Expectation |
Next steps#
In Chapter 3, weβll formally learn Bayesβ Theorem and the Law of Total Probability, which provide powerful tools for:
- Updating probabilities when new information arrives
- Reversing conditional probabilities
- Making decisions under uncertainty
- Understanding how evidence affects our beliefs
These concepts are fundamental for quantitative finance applications like risk modeling, signal processing, and decision-making under uncertainty.
Quiz time#
Question #1
A fair die is rolled. Let:
- = βRoll an even numberβ
- = βRoll a number greater than 3β
Calculate:
Show Solution
Sample space:
- (even numbers)
- (numbers > 3)
- (even numbers > 3)
Since all outcomes are equally likely:
Using conditional probability formula:
Interpretation:
- Given an even number, thereβs a chance itβs greater than 3
- Given a number greater than 3, thereβs a chance itβs even
Question #2
Two cards are drawn from a standard deck without replacement. Calculate:
Show Solution
-
-
After drawing one ace, 3 aces remain out of 51 cards:
-
Using multiplication rule:
Question #3
A stockβs movement depends on market conditions:
- Bull market (probability 0.6): Stock goes up with probability 0.8
- Bear market (probability 0.4): Stock goes up with probability 0.2
Calculate:
- (unconditional probability)
Show Solution
Let:
- = βBull marketβ:
- = βBear marketβ:
- = βStock goes upβ
Part 1: Unconditional probability using Law of Total Probability:
Part 2: Reversing the conditional probability (using the formula weβll learn as Bayesβ Theorem in Chapter 3):
Interpretation:
- The unconditional probability of the stock going up is 56%
- If the stock goes up, thereβs an 85.7% chance weβre in a bull market
Question #4
A trading strategy has two signals:
- Signal 1 is correct with probability 0.7
- Signal 2 is correct with probability 0.6
- If Signal 1 is correct, Signal 2 is correct with probability 0.8
- If Signal 1 is incorrect, Signal 2 is correct with probability 0.3
Calculate:
Show Solution
Let:
- = βSignal 1 correctβ:
- = βSignal 2 correctβ: ,
Part 1: Both signals correct
Part 2: At least one signal correct
First, calculate using Law of Total Probability:
Now use addition rule:
Part 3: Reverse conditional probability
Interpretation:
- Both signals are correct 56% of the time
- At least one signal is correct 79% of the time
- If Signal 2 is correct, Signal 1 is also correct 86.2% of the time
Question #5
A portfolio contains stocks from two sectors:
- Technology (60% of portfolio): Expected return 12%
- Finance (40% of portfolio): Expected return 8%
Calculate the unconditional expected return of the portfolio.
Show Solution
Let:
- = βTechnology sectorβ:
- = βFinance sectorβ:
Using Law of Total Expectation:
Interpretation: The unconditional expected return is 10.4%, which is a weighted average of the sector-specific expected returns.
Question #6
Three cards are drawn from a standard deck without replacement. Calculate the probability that all three are aces.
Show Solution
Using the chain rule:
Interpretation: The probability of drawing three aces in a row (without replacement) is approximately 0.018% (1 in 5,525).
Question #7
Write Python code to:
- Calculate conditional probability
- Calculate joint probability using multiplication rule
- Check if events are independent using conditional probability
- Calculate unconditional probability using Law of Total Probability
Show Solution
def conditional_probability(p_intersection, p_given):
"""Calculate P(B | A) = P(A β© B) / P(A)"""
if p_given == 0:
return None
return p_intersection / p_given
def joint_probability(p_a, p_b_given_a):
"""Calculate P(A β© B) = P(A) * P(B | A)"""
return p_a * p_b_given_a
def are_independent_conditional(p_a, p_b, p_b_given_a, tolerance=1e-6):
"""Check independence using conditional probability: P(B | A) = P(B)"""
if p_a == 0:
return None
return abs(p_b_given_a - p_b) < tolerance
def law_of_total_probability(conditional_probs, prior_probs):
"""Calculate P(B) = sum of P(B | A_i) * P(A_i)"""
if len(conditional_probs) != len(prior_probs):
raise ValueError("Lists must have same length")
return sum(c * p for c, p in zip(conditional_probs, prior_probs))
# Example 1: Conditional probability
p_intersection = 0.3
p_given = 0.6
p_conditional = conditional_probability(p_intersection, p_given)
print(f"P(B | A) = {p_conditional:.2f}")
# Example 2: Joint probability
p_a = 0.6
p_b_given_a = 0.5
p_joint = joint_probability(p_a, p_b_given_a)
print(f"P(A β© B) = {p_joint:.2f}")
# Example 3: Check independence
p_b = 0.5
is_independent = are_independent_conditional(p_a, p_b, p_b_given_a)
print(f"Are independent? {is_independent}")
# Example 4: Law of Total Probability
conditional_probs = [0.8, 0.2] # P(up | bull), P(up | bear)
prior_probs = [0.6, 0.4] # P(bull), P(bear)
p_unconditional = law_of_total_probability(conditional_probs, prior_probs)
print(f"P(up) = {p_unconditional:.2f}")
Output:
P(B | A) = 0.50
P(A β© B) = 0.30
Are independent? True
P(up) = 0.56