Mathematical Statistics

Chapter 5: Multivariate Distributions โ€“ Conditional Distributions & Independence

Samir Orujov, PhD

ADA University, School of Business

Information Communication Technologies Agency, Statistics Unit

2026-02-22

๐ŸŽฏ Learning Objectives

๐Ÿ“š By the end of this lecture, you will be able to:

  • Derive conditional probability functions for discrete random variables

  • Calculate conditional density functions for continuous random variables

  • Apply the definition of independence to verify whether random variables are independent

  • Use the factorization theorem to quickly check independence

  • Interpret conditional distributions in portfolio risk and asset allocation scenarios

๐Ÿ“ฑ Attendance Check-in

๐Ÿ“‹ Overview

๐Ÿ“š Topics Covered Today

  • Conditional Distributions (Discrete) โ€“ Probability given information about another variable

  • Conditional Distributions (Continuous) โ€“ Conditional density functions

  • Independent Random Variables โ€“ Definition and properties

  • Factorization Theorem โ€“ Quick test for independence

  • Case Study โ€“ Conditional analysis of banking sector returns

๐Ÿ“– Why Conditional Distributions?

๐ŸŽฏ Motivation

Understanding how one variable behaves given information about another is crucial for prediction, risk management, and decision-making.

Finance Applications:

  • Credit risk given macroeconomic conditions
  • Stock returns given market movements
  • Default probability given credit rating
  • Portfolio VaR given stress scenarios

Azerbaijan Context:

  • Oil revenue given OPEC decisions
  • Manat volatility given oil prices
  • PASHA Bank profitability given interest rates
  • Insurance claims given weather events

๐Ÿ“– Definition: Conditional Probability Function (Discrete)

๐Ÿ“ Definition 5.5: Conditional Probability Function

If \(Y_1\) and \(Y_2\) are jointly discrete random variables with joint probability function \(p(y_1, y_2)\) and marginal probability functions \(p_1(y_1)\) and \(p_2(y_2)\), then the conditional discrete probability function of \(Y_1\) given \(Y_2\) is:

\[p(y_1|y_2) = P(Y_1 = y_1 | Y_2 = y_2) = \frac{p(y_1, y_2)}{p_2(y_2)}\]

provided that \(p_2(y_2) > 0\).

Key insight: This is Bayesโ€™ rule \(P(A|B) = P(A \cap B)/P(B)\) applied to random variables!

๐Ÿ“Œ Example 1: Portfolio Asset Selection

Problem: A fund manager selects 2 assets from a pool of 3 tech stocks, 2 bank stocks, and 1 commodity ETF. Let \(Y_1\) = number of tech stocks, \(Y_2\) = number of bank stocks selected. Find \(P(Y_1 = 1 | Y_2 = 1)\).

Solution: From the joint distribution:

\(y_1 \backslash y_2\) 0 1 2 Total
0 0 2/15 1/15 3/15
1 3/15 6/15 0 9/15
2 3/15 0 0 3/15
Total 6/15 8/15 1/15 1

\[P(Y_1 = 1 | Y_2 = 1) = \frac{p(1,1)}{p_2(1)} = \frac{6/15}{8/15} = \frac{6}{8} = \frac{3}{4}\]

๐Ÿ“Œ Example 1: Complete Conditional Distribution

Problem: Find the complete conditional distribution of \(Y_1\) (tech stocks) given \(Y_2 = 1\) (one bank stock selected).

\[P(Y_1 = 0 | Y_2 = 1) = \frac{2/15}{8/15} = \frac{1}{4}\]

\[P(Y_1 = 1 | Y_2 = 1) = \frac{6/15}{8/15} = \frac{3}{4}\]

\[P(Y_1 = 2 | Y_2 = 1) = \frac{0}{8/15} = 0\]

Portfolio Interpretation:

Given one bank stock in portfolio:

  • 25% chance of zero tech stocks
  • 75% chance of one tech stock
  • 0% chance of two tech stocks

Verification: \(\frac{1}{4} + \frac{3}{4} + 0 = 1\) โœ“

๐Ÿ“– Definition: Conditional Density Function (Continuous)

๐Ÿ“ Definition 5.7: Conditional Density Function

Let \(Y_1\) and \(Y_2\) be jointly continuous random variables with joint density \(f(y_1, y_2)\) and marginal densities \(f_1(y_1)\) and \(f_2(y_2)\).

For any \(y_2\) such that \(f_2(y_2) > 0\), the conditional density of \(Y_1\) given \(Y_2 = y_2\) is:

\[f(y_1|y_2) = \frac{f(y_1, y_2)}{f_2(y_2)}\]

Similarly: \(f(y_2|y_1) = \frac{f(y_1, y_2)}{f_1(y_1)}\) when \(f_1(y_1) > 0\)

Note: The conditional density is undefined when the marginal density equals zero!

๐Ÿ“Œ Example 2: Trading Volume Given Liquidity

Problem: Let \(Y_2\) = available liquidity (millions AZN), \(Y_1\) = actual trade volume (\(Y_1 \leq Y_2\)). Joint density: \[f(y_1, y_2) = \begin{cases} 1/2, & 0 \leq y_1 \leq y_2 \leq 2 \\ 0, & \text{elsewhere} \end{cases}\]

Find \(f(y_1|y_2)\).

Solution: First find the marginal density of liquidity \(f_2(y_2)\): \[f_2(y_2) = \int_0^{y_2} \frac{1}{2} \, dy_1 = \frac{y_2}{2}, \quad 0 \leq y_2 \leq 2\]

Then: \[f(y_1|y_2) = \frac{1/2}{y_2/2} = \frac{1}{y_2}, \quad 0 \leq y_1 \leq y_2\]

Interpretation: Given liquidity \(y_2\), trade volume is uniform on \([0, y_2]\)!

๐Ÿ“Œ Example 2: Conditional Probability Calculation

Problem: Find \(P(Y_1 \leq 0.5 | Y_2 = 1.5)\) โ€” probability trade volume โ‰ค 0.5M given liquidity of 1.5M AZN.

Solution: Using \(f(y_1|y_2 = 1.5) = \frac{1}{1.5}\) for \(0 \leq y_1 \leq 1.5\):

\[P(Y_1 \leq 0.5 | Y_2 = 1.5) = \int_0^{0.5} \frac{1}{1.5} \, dy_1 = \frac{0.5}{1.5} = \frac{1}{3}\]

Compare with higher liquidity \(Y_2 = 2\)M: \[P(Y_1 \leq 0.5 | Y_2 = 2) = \int_0^{0.5} \frac{1}{2} \, dy_1 = \frac{1}{4}\]

Trading Insight: More liquidity โ†’ lower probability of small trades!

๐Ÿ“– Definition: Independent Random Variables

๐Ÿ“ Definition 5.8: Independence

Let \(Y_1\) have distribution function \(F_1(y_1)\), \(Y_2\) have distribution function \(F_2(y_2)\), and let \((Y_1, Y_2)\) have joint distribution function \(F(y_1, y_2)\).

Then \(Y_1\) and \(Y_2\) are independent if and only if:

\[F(y_1, y_2) = F_1(y_1) \cdot F_2(y_2)\]

for every pair of real numbers \((y_1, y_2)\).

If \(Y_1\) and \(Y_2\) are not independent, they are said to be dependent.

Portfolio Intuition: Joint CDF factors into a product of marginal CDFs โ†’ no information about one asset tells you anything about the other!

๐Ÿงฎ Theorem: Characterization of Independence

Theorem 5.4: Independence via Probability/Density Functions

Discrete case: \(Y_1\) and \(Y_2\) are independent if and only if: \[p(y_1, y_2) = p_1(y_1) \cdot p_2(y_2) \quad \text{for all } (y_1, y_2)\]

Continuous case: \(Y_1\) and \(Y_2\) are independent if and only if: \[f(y_1, y_2) = f_1(y_1) \cdot f_2(y_2) \quad \text{for all } (y_1, y_2)\]

Key insight: Independence means the joint distribution factors into the product of marginals for ALL values โ€” essential for portfolio diversification theory!

๐Ÿ“Œ Example 3: Testing Independence (Loan Defaults)

Problem: A bank has two independent loan portfolios. Let \(Y_1\) = default category for portfolio 1, \(Y_2\) = default category for portfolio 2 (each rated 1-6 risk levels). Each has uniform distribution. Are \(Y_1\) and \(Y_2\) independent?

Since portfolios are managed independently: \(p(y_1, y_2) = 1/36\) for all \(y_1, y_2 \in \{1,2,3,4,5,6\}\).

Marginals: \(p_1(y_1) = 1/6\) and \(p_2(y_2) = 1/6\)

Check: \(p_1(y_1) \cdot p_2(y_2) = \frac{1}{6} \cdot \frac{1}{6} = \frac{1}{36} = p(y_1, y_2)\) โœ“

Conclusion: \(Y_1\) and \(Y_2\) are INDEPENDENT.

Banking interpretation: Separately managed portfolios โ†’ diversification benefit!

๐Ÿ“Œ Example 4: Dependence in Portfolio Selection

Problem: In Example 1 (asset selection), are \(Y_1\) (tech stocks) and \(Y_2\) (bank stocks) independent?

From the joint distribution: \(p(0, 0) = 0\)

But marginals give: \(p_1(0) = 3/15\) and \(p_2(0) = 6/15\)

\[p_1(0) \cdot p_2(0) = \frac{3}{15} \cdot \frac{6}{15} = \frac{2}{25} \neq 0 = p(0, 0)\]

Conclusion: \(Y_1\) and \(Y_2\) are DEPENDENT.

Portfolio intuition: If we select zero tech stocks, we must have selected bank stocks or the commodity ETF!

๐Ÿ“Œ Example 5: Testing Independence (Stock Returns)

Problem: Let \(Y_1\) = normalized return of AAPL, \(Y_2\) = normalized return of a commodity ETF. Joint density: \(f(y_1, y_2) = 6y_1y_2^2\) for \(0 \leq y_1 \leq 1, 0 \leq y_2 \leq 1\). Are they independent?

Find marginals: \[f_1(y_1) = \int_0^1 6y_1y_2^2 \, dy_2 = 6y_1 \cdot \frac{1}{3} = 2y_1, \quad 0 \leq y_1 \leq 1\]

\[f_2(y_2) = \int_0^1 6y_1y_2^2 \, dy_1 = 6y_2^2 \cdot \frac{1}{2} = 3y_2^2, \quad 0 \leq y_2 \leq 1\]

Check: \(f_1(y_1) \cdot f_2(y_2) = 2y_1 \cdot 3y_2^2 = 6y_1y_2^2 = f(y_1, y_2)\) โœ“

Conclusion: \(Y_1\) and \(Y_2\) are INDEPENDENT โ€” great for diversification!

๐Ÿ“Œ Example 6: Dependent Bond Returns

Problem: Let \(Y_1\) = short-term bond return, \(Y_2\) = long-term bond return, where short-term never exceeds long-term. Joint density: \(f(y_1, y_2) = 2\) for \(0 \leq y_2 \leq y_1 \leq 1\). Are they independent?

Find marginals: \[f_1(y_1) = \int_0^{y_1} 2 \, dy_2 = 2y_1, \quad f_2(y_2) = \int_{y_2}^1 2 \, dy_1 = 2(1-y_2)\]

Check: \(f_1(y_1) \cdot f_2(y_2) = 4y_1(1-y_2) \neq 2 = f(y_1, y_2)\)

Conclusion: \(Y_1\) and \(Y_2\) are DEPENDENT.

Key observation: The triangular region \(0 \leq y_2 \leq y_1 \leq 1\) signals dependence โ€” term structure creates relationship!

๐Ÿงฎ Theorem: Factorization Criterion

Theorem 5.5: Quick Test for Independence

Let \(Y_1\) and \(Y_2\) have a joint density \(f(y_1, y_2)\) that is positive if and only if \(a \leq y_1 \leq b\) and \(c \leq y_2 \leq d\), for constants \(a, b, c, d\); and \(f(y_1, y_2) = 0\) otherwise.

Then \(Y_1\) and \(Y_2\) are independent if and only if: \[f(y_1, y_2) = g(y_1) \cdot h(y_2)\]

where \(g(y_1)\) is a nonnegative function of \(y_1\) alone and \(h(y_2)\) is a nonnegative function of \(y_2\) alone.

Risk Management Insight: Support must be rectangular. Non-rectangular support (like budget constraints) โ†’ typically dependent!

๐Ÿ“Œ Example 7: Interest Rate Factorization

Problem: Let \(Y_1\) = normalized US interest rate, \(Y_2\) = normalized EU interest rate. Joint density: \(f(y_1, y_2) = 2y_1\) for \(0 \leq y_1 \leq 1, 0 \leq y_2 \leq 1\). Are they independent?

Step 1: Check the region โ€” \([0,1] \times [0,1]\) is rectangular โœ“

Step 2: Can we factor?

\[f(y_1, y_2) = 2y_1 = \underbrace{y_1}_{g(y_1)} \cdot \underbrace{2}_{h(y_2)}\]

Yes! The joint density factors.

Conclusion: \(Y_1\) and \(Y_2\) are INDEPENDENT.

Economic note: If central banks set rates independently, this model applies!

๐ŸŽฎ Interactive: Why Support Shape Determines Independence

๐Ÿค Think-Pair-Share: Independence Check

๐Ÿ’ญ Activity (4 minutes)

Problem: A portfolio model has joint density \(f(y_1, y_2) = 24y_1y_2\) for normalized returns where \(0 < y_1 < 1\), \(0 < y_2 < 1\), and \(y_1 + y_2 < 1\) (budget constraint).

๐Ÿง  Think (1 min):

  • What shape is the support region?
  • Can the density factor?

๐Ÿ‘ซ Pair (2 min):

  • Sketch the region together
  • Discuss: rectangular or not?

๐Ÿ—ฃ๏ธ Share (1 min):

  • Conclusion: Independent or dependent?
  • Why?

๐Ÿ’ฐ Case Study: Conditional Analysis of Bank Returns

๐Ÿ“Š Show Data Loading Code
library(tidyverse)
library(tidyquant)

# Get Azerbaijan-relevant bank stocks: JPM and BAC
# (similar to PASHA Bank and Kapital Bank dynamics)
symbols <- c("JPM", "BAC")
prices <- tq_get(symbols, from = "2022-01-01")

returns <- prices %>%
  group_by(symbol) %>%
  tq_transmute(select = adjusted,
               mutate_fun = periodReturn,
               period = "daily") %>%
  pivot_wider(names_from = symbol, 
              values_from = daily.returns) %>%
  na.omit()

# Conditional analysis: JPM given BAC quartiles
returns <- returns %>%
  mutate(
    BAC_state = case_when(
      BAC < quantile(BAC, 0.25) ~ "BAC Down (Q1)",
      BAC > quantile(BAC, 0.75) ~ "BAC Up (Q4)",
      TRUE ~ "BAC Normal"
    )
  )

# Conditional statistics
cond_stats <- returns %>%
  group_by(BAC_state) %>%
  summarise(
    `Mean JPM (%)` = mean(JPM) * 100,
    `SD JPM (%)` = sd(JPM) * 100,
    n = n()
  )

knitr::kable(cond_stats, digits = 3,
             caption = "JPM Returns Conditional on BAC State")
JPM Returns Conditional on BAC State
BAC_state Mean JPM (%) SD JPM (%) n
BAC Down (Q1) -1.504 1.353 259
BAC Normal 0.174 0.898 519
BAC Up (Q4) 1.499 1.400 259
๐Ÿ“Š Show Visualization Code
# Visualize conditional distributions
ggplot(returns, aes(x = JPM, fill = BAC_state)) +
  geom_density(alpha = 0.5) +
  labs(title = "Conditional Density: f(JPM | BAC state)",
       subtitle = "Bank sector dependence",
       x = "JPM Daily Return",
       y = "Density",
       fill = "Condition") +
  theme_minimal(base_size = 14) +
  scale_fill_manual(values = c("red", "gray50", "green4"))

๐Ÿ’ฐ Case Study: Testing Independence

๐Ÿ“Š Show Chi-Square Test Code
# Statistical test for independence
returns_discrete <- returns %>%
  mutate(
    JPM_cat = cut(JPM, breaks = 5),
    BAC_cat = cut(BAC, breaks = 5)
  )

# Contingency table and chi-square test
cont_table <- table(returns_discrete$JPM_cat, 
                    returns_discrete$BAC_cat)
chi_test <- chisq.test(cont_table)

cat("Chi-Square Test for Independence:\n")
Chi-Square Test for Independence:
๐Ÿ“Š Show Chi-Square Test Code
cat("Xยฒ =", round(chi_test$statistic, 2), "\n")
Xยฒ = 914.15 
๐Ÿ“Š Show Chi-Square Test Code
cat("df =", chi_test$parameter, "\n")
df = 16 
๐Ÿ“Š Show Chi-Square Test Code
cat("p-value <", format.pval(chi_test$p.value), "\n\n")
p-value < < 2.22e-16 
๐Ÿ“Š Show Chi-Square Test Code
cat("Conclusion:", 
    ifelse(chi_test$p.value < 0.05, 
           "REJECT Hโ‚€ โ†’ Returns are DEPENDENT", 
           "Cannot reject Hโ‚€"))
Conclusion: REJECT Hโ‚€ โ†’ Returns are DEPENDENT
๐Ÿ“Š Show Scatter Plot Code
# Scatter plot showing dependence
ggplot(returns, aes(x = BAC, y = JPM)) +
  geom_point(alpha = 0.4, color = "steelblue") +
  geom_smooth(method = "lm", color = "red", se = TRUE) +
  labs(title = "JPM vs BAC Daily Returns",
       subtitle = paste("Correlation:", 
                        round(cor(returns$JPM, returns$BAC), 3)),
       x = "BAC Daily Return",
       y = "JPM Daily Return") +
  theme_minimal(base_size = 14) +
  geom_hline(yintercept = 0, linetype = "dashed", alpha = 0.5) +
  geom_vline(xintercept = 0, linetype = "dashed", alpha = 0.5)

๐Ÿ’ฐ Case Study: Key Findings

๐Ÿ“Š Analysis Results

Conditional Behavior:

  • When BAC falls, JPM tends to fall
  • Conditional mean shifts significantly
  • Conditional volatility also changes

Independence Test:

  • Chi-square strongly rejects independence
  • Clear positive dependence
  • Returns move together

Portfolio Implications:

  1. Diversification limited: Same-sector stocks dependent
  2. Risk modeling: Must use joint distributions
  3. Stress testing: Conditional analysis essential

๐Ÿ“ Quiz #1: Conditional Probability

If \(p(1,2) = 0.15\) and \(p_2(2) = 0.30\), what is \(P(Y_1 = 1 | Y_2 = 2)\)?

  • 0.50
  • 0.15
  • 0.30
  • 0.45

๐Ÿ“ Quiz #2: Independence Condition

For continuous random variables, which condition is equivalent to independence?

  • \(f(y_1, y_2) = f_1(y_1) \cdot f_2(y_2)\) for all \((y_1, y_2)\)
  • \(f(y_1|y_2) = f_2(y_2)\) for all \(y_2\)
  • \(f(y_1, y_2) = f_1(y_1) + f_2(y_2)\) for all \((y_1, y_2)\)
  • \(f(y_1, y_2) > 0\) for all \((y_1, y_2)\)

๐Ÿ“ Quiz #3: Factorization Theorem

\(f(y_1, y_2) = 12y_1^2y_2\) for \(0 \leq y_1 \leq 1, 0 \leq y_2 \leq 1\). Are \(Y_1\) and \(Y_2\) independent?

  • Yes, because \(f(y_1,y_2) = g(y_1) \cdot h(y_2)\) with rectangular support
  • No, because the powers are different
  • No, because the constant 12 cannot be split
  • Cannot determine without computing marginals

๐Ÿ“ Quiz #4: Dependent Variables

\(f(y_1, y_2) = 8y_1y_2\) for \(0 < y_1 < y_2 < 1\). Why are \(Y_1\) and \(Y_2\) dependent?

  • The region of support is not rectangular
  • The density cannot be factored
  • The coefficient 8 is too large
  • The marginal densities donโ€™t exist

๐Ÿ“ Summary

โœ… Key Takeaways

  • Conditional distributions describe behavior of one variable given information about another

  • Discrete case: \(p(y_1|y_2) = p(y_1, y_2)/p_2(y_2)\) when \(p_2(y_2) > 0\)

  • Continuous case: \(f(y_1|y_2) = f(y_1, y_2)/f_2(y_2)\) when \(f_2(y_2) > 0\)

  • Independence: Joint = Product of marginals for ALL values

  • Factorization theorem: Rectangular support + density factors โ†’ independence

๐Ÿ“š Practice Problems

๐Ÿ“ Homework Problems

Problem 1 (Conditional Discrete): Using the portfolio asset selection example, find the complete conditional distribution of \(Y_2\) (bank stocks) given \(Y_1 = 1\) (one tech stock selected).

Problem 2 (Conditional Continuous): If stock returns have \(f(y_1, y_2) = 4y_1y_2\) for \(0 < y_1 < 1, 0 < y_2 < 1\), find \(f(y_1|y_2)\) and verify itโ€™s a valid density.

Problem 3 (Independence): A risk model has \(f(y_1, y_2) = 2\) for \(0 < y_1 + y_2 < 1\). Determine if the risk factors are independent.

Problem 4 (Azerbaijan Application): Download SOCAR and Brent crude oil price data. Test whether their daily returns are independent using a chi-square test.

๐Ÿ“ฑ Late Check-in

๐Ÿ‘‹ Thank You!

๐Ÿ“ฌ Contact Information:

Samir Orujov, PhD

Assistant Professor

School of Business, ADA University

๐Ÿ“ง Email: sorujov@ada.edu.az

๐Ÿข Office: D312

โฐ Office Hours: By appointment

๐Ÿ“… Next Class:

Topic: Expected Values, Covariance, and Correlation

Reading: Chapter 5, Sections 5.5-5.8

Preparation: Review variance and expected value formulas

โฐ Reminders:

  • โœ… Complete Practice Problems 1-4
  • โœ… Review integration by parts
  • โœ… Think about correlation vs dependence

โ“ Questions?

๐Ÿ’ฌ Open Discussion

Key Topics for Discussion:

  • How does conditional expectation relate to regression?

  • Can two variables be dependent but have zero correlation?

  • How do we use independence in portfolio theory?

  • Whatโ€™s the relationship between statistical independence and economic independence?