Mathematical Statistics

Independence and Covariance

Samir Orujov, PhD

ADA University, School of Business

Information Communication Technologies Agency, Statistics Unit

2025-11-10

🎯 Learning Objectives

By the end of this lecture, you will be able to:

  • Define statistical independence for random variables and apply independence tests to determine whether asset returns, market factors, or economic variables are independent in financial contexts

  • Calculate expected values of functions of random variables, including products and sums, and apply linearity of expectation to portfolio return calculations and risk assessment

  • State and apply special theorems including the multiplication rule for independent variables: \(E(XY) = E(X)E(Y)\) when \(X\) and \(Y\) are independent, crucial for simplifying portfolio calculations

  • Compute covariance and correlation as measures of linear association between financial variables, and interpret their signs and magnitudes in terms of portfolio diversification benefits

  • Use the variance decomposition formula \(\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y) + 2\text{Cov}(X,Y)\) to calculate portfolio risk and understand how correlation affects diversification strategies in modern portfolio theory

📋 Overview

📚 Topics Covered Today

  • Statistical Independence – Formal definition, testing procedures, and implications for portfolio diversification and risk modeling

  • Expected Values of Functions – Computing \(E(g(X))\), \(E(g(X,Y))\), and linearity of expectation with applications to asset returns

  • Special Theorems – Multiplication rule for independent variables, variance of sums, and moment calculations

  • Covariance – Definition, computational formulas, properties, and interpretation in terms of joint variability and linear association

  • Applications – Portfolio optimization, risk management, hedging strategies, and correlation-based trading in quantitative finance

📖 Definition: Statistical Independence

📝 Definition 1: Independence of Random Variables

Random variables \(X\) and \(Y\) are independent if and only if their joint distribution factors into the product of marginal distributions:

For discrete random variables: \[p(x, y) = p_X(x) \cdot p_Y(y) \text{ for all } x, y\]

For continuous random variables: \[f(x, y) = f_X(x) \cdot f_Y(y) \text{ for all } x, y\]

Equivalent condition: For any events \(A\) and \(B\): \[P(X \in A, Y \in B) = P(X \in A) \cdot P(Y \in B)\]

Practical interpretation: Knowledge of one variable provides no information about the other variable.

Financial Context: Independence is rare in finance but highly valuable—independent assets provide maximum diversification benefits since they don’t move together [web:33][web:36].

🔍 Testing for Independence

📊 How to Test Independence

Method 1: Check factorization - Compute \(p(x,y)\) or \(f(x,y)\) - Compute \(p_X(x) \cdot p_Y(y)\) or \(f_X(x) \cdot f_Y(y)\) - If equal for all \((x,y)\), variables are independent

Method 2: Check conditional equals marginal - If \(p_{Y|X}(y|x) = p_Y(y)\) for all \(x, y\), then independent - Conditioning on \(X\) doesn’t change the distribution of \(Y\)

Method 3: Check covariance (necessary but not sufficient) - If \(\text{Cov}(X,Y) = 0\), variables are uncorrelated - Independence ⟹ uncorrelated, but uncorrelated ⏸ independence - Exception: For jointly normal variables, uncorrelated ⟺ independent

Important: Most financial assets are NOT independent—they’re correlated through common market factors, economic conditions, and behavioral patterns [web:35][web:37].

📌 Example 1: Testing Independence

Problem: Consider two stocks with the following joint probability distribution:

\(Y = -5\%\) \(Y = 0\%\) \(Y = +5\%\)
\(X = -5\%\) 0.12 0.18 0.06
\(X = 0\%\) 0.08 0.12 0.04
\(X = +5\%\) 0.04 0.06 0.30

Are \(X\) and \(Y\) independent?

Solution:

First, compute marginal distributions:

\[p_X(-5\%) = 0.12 + 0.18 + 0.06 = 0.36\] \[p_X(0\%) = 0.08 + 0.12 + 0.04 = 0.24\] \[p_X(+5\%) = 0.04 + 0.06 + 0.30 = 0.40\]

\[p_Y(-5\%) = 0.12 + 0.08 + 0.04 = 0.24\] \[p_Y(0\%) = 0.18 + 0.12 + 0.06 = 0.36\] \[p_Y(+5\%) = 0.06 + 0.04 + 0.30 = 0.40\]

📌 Example 1: Solution (continued)

Test independence at one point:

Check if \(p(-5\%, -5\%) = p_X(-5\%) \cdot p_Y(-5\%)\):

\[p(-5\%, -5\%) = 0.12\] \[p_X(-5\%) \cdot p_Y(-5\%) = 0.36 \times 0.24 = 0.0864\]

Since \(0.12 \neq 0.0864\), the variables are NOT independent.

Financial Interpretation: The stocks are dependent—their returns are correlated. When we observe Stock \(X\)’s return, it gives us information about Stock \(Y\)’s likely return. This reduces diversification benefits compared to truly independent assets.

Verification: We can also check: \[p(+5\%, +5\%) = 0.30 \text{ but } p_X(+5\%) \cdot p_Y(+5\%) = 0.40 \times 0.40 = 0.16\]

The actual probability of both stocks gaining 5% (0.30) is much higher than what independence would predict (0.16), indicating positive dependence—the stocks tend to move together.

📖 Definition: Expected Value of a Function

📝 Definition 2: Expected Value of \(g(X, Y)\)

Let \(g(X, Y)\) be a function of random variables \(X\) and \(Y\).

For discrete random variables: \[E[g(X, Y)] = \sum_x \sum_y g(x, y) \cdot p(x, y)\]

For continuous random variables: \[E[g(X, Y)] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} g(x, y) \cdot f(x, y) \, dx \, dy\]

Special cases:

  • \(E(X) = E[g(X, Y)]\) where \(g(x, y) = x\)

  • \(E(XY) = E[g(X, Y)]\) where \(g(x, y) = xy\)

  • \(E(X + Y) = E[g(X, Y)]\) where \(g(x, y) = x + y\)

Application: Computing expected portfolio returns, option payoffs, and risk measures requires expected values of functions of multiple random variables [web:34][web:38].

🧮 Theorem: Linearity of Expectation

Theorem 1: Linearity of Expectation

For any random variables \(X\) and \(Y\) (independent or not) and constants \(a\), \(b\), \(c\):

\[\boxed{E(aX + bY + c) = aE(X) + bE(Y) + c}\]

More generally, for any constants \(a_i\) and random variables \(X_i\):

\[E\left(\sum_{i=1}^{n} a_i X_i\right) = \sum_{i=1}^{n} a_i E(X_i)\]

Key insight: Linearity holds whether or not the variables are independent!

Proof sketch: Follows directly from the definition of expected value and properties of summation/integration.

Portfolio Application: For a portfolio with weights \(w_i\) and asset returns \(R_i\): \[E(R_P) = E\left(\sum w_i R_i\right) = \sum w_i E(R_i)\]

This is the foundation of portfolio expected return calculation [web:38][web:40].

📌 Example 2: Portfolio Expected Return

Problem: An investor creates a portfolio with 40% in Stock A (expected return 12%) and 60% in Stock B (expected return 8%). What is the expected portfolio return?

Solution:

Let \(R_A\) and \(R_B\) be the returns on stocks A and B. The portfolio return is: \[R_P = 0.4 R_A + 0.6 R_B\]

Using linearity of expectation: \[E(R_P) = E(0.4 R_A + 0.6 R_B) = 0.4 E(R_A) + 0.6 E(R_B)\]

\[E(R_P) = 0.4(12\%) + 0.6(8\%) = 4.8\% + 4.8\% = 9.6\%\]

\[\boxed{E(R_P) = 9.6\%}\]

Key Point: This calculation is valid regardless of whether the stocks are independent or correlated. Expected return depends only on individual expected returns and portfolio weights, not on the correlation structure.

Note: While expected return doesn’t depend on correlation, portfolio risk (variance) critically depends on covariance, as we’ll see later!

🧮 Theorem: Multiplication Rule for Independent Variables

Theorem 2: Expected Value of Products

If \(X\) and \(Y\) are independent, then:

\[\boxed{E(XY) = E(X) \cdot E(Y)}\]

Important: This result requires independence. If \(X\) and \(Y\) are dependent, \(E(XY) \neq E(X)E(Y)\) in general.

Proof (discrete case):

\[E(XY) = \sum_x \sum_y xy \cdot p(x, y)\]

By independence, \(p(x, y) = p_X(x) \cdot p_Y(y)\):

\[= \sum_x \sum_y xy \cdot p_X(x) \cdot p_Y(y) = \sum_x x \cdot p_X(x) \sum_y y \cdot p_Y(y)\]

\[= E(X) \cdot E(Y) \quad \blacksquare\]

Financial Application: If asset returns are independent, calculating cross-moments simplifies dramatically, though true independence is rare in practice [web:33].

📌 Example 3: Expected Product

Problem: Let \(X\) and \(Y\) be independent random variables with \(E(X) = 3\), \(E(Y) = 5\), \(E(X^2) = 12\), and \(E(Y^2) = 30\). Find \(E(XY)\) and \(E[(X+Y)^2]\).

Solution (Part 1):

Since \(X\) and \(Y\) are independent, we can apply Theorem 2: \[E(XY) = E(X) \cdot E(Y) = 3 \times 5 = 15\]

\[\boxed{E(XY) = 15}\]

Solution (Part 2):

Expand \((X + Y)^2\): \[E[(X+Y)^2] = E[X^2 + 2XY + Y^2]\]

By linearity of expectation: \[= E(X^2) + 2E(XY) + E(Y^2)\]

\[= 12 + 2(15) + 30 = 12 + 30 + 30 = 72\]

\[\boxed{E[(X+Y)^2] = 72}\]

🤝 Think-Pair-Share: Leverage and Independence

💭 Student Engagement Activity (5 minutes)

Scenario: A hedge fund uses 2:1 leverage, meaning for every $1 of equity, they borrow $1 to invest $2 total. The fund invests in two strategies: Strategy A (mean return 10%, std dev 15%) and Strategy B (mean return 8%, std dev 12%). Each strategy gets 50% of the $2 invested (i.e., $1 each). The cost of borrowing is 3% per year.

Think (1 minute): Work individually

  • If the strategies are independent, what is the expected gross portfolio return (before borrowing costs)?

  • What is the expected net return after paying 3% interest on the $1 borrowed?

  • The return on equity (ROE) is net profit divided by the $1 equity invested. What is the expected ROE?

Pair (2-3 minutes): Discuss with a partner

  • How would correlation between strategies affect the risk (not the expected return)?

  • Is assuming independence realistic for hedge fund strategies operating in the same markets?

  • What are the dangers of leverage when strategies are highly correlated?

Share (1-2 minutes): Class discussion

  • Discuss how the 2008 financial crisis demonstrated the risks of assuming independence when strategies were actually correlated through hidden linkages

📖 Definition: Covariance

📝 Definition 3: Covariance

The covariance between random variables \(X\) and \(Y\) is:

\[\text{Cov}(X, Y) = E[(X - \mu_X)(Y - \mu_Y)]\]

where \(\mu_X = E(X)\) and \(\mu_Y = E(Y)\).

Computational formula (easier for calculations):

\[\boxed{\text{Cov}(X, Y) = E(XY) - E(X)E(Y)}\]

Interpretation:

  • Positive covariance: \(X\) and \(Y\) tend to be simultaneously above or below their means—they move together

  • Negative covariance: When \(X\) is above its mean, \(Y\) tends to be below its mean—they move in opposite directions

  • Zero covariance: No linear relationship (uncorrelated)

Financial Meaning: Covariance measures how asset returns move together—critical for portfolio risk management and diversification strategies [web:38][web:41].

🔍 Properties of Covariance

📊 Key Properties

  1. Symmetry: \(\text{Cov}(X, Y) = \text{Cov}(Y, X)\)

  2. Variance as self-covariance: \(\text{Cov}(X, X) = \text{Var}(X)\)

  3. Covariance with constant: \(\text{Cov}(X, c) = 0\) for any constant \(c\)

  4. Linearity: \(\text{Cov}(aX + b, Y) = a \cdot \text{Cov}(X, Y)\) for constants \(a, b\)

  5. Bilinearity: \(\text{Cov}(X + Y, Z) = \text{Cov}(X, Z) + \text{Cov}(Y, Z)\)

  6. Independence implies zero covariance: If \(X\) and \(Y\) are independent, then \(\text{Cov}(X, Y) = 0\)

    • Proof: \(E(XY) = E(X)E(Y)\) by independence, so \(\text{Cov}(X, Y) = E(XY) - E(X)E(Y) = 0\)
  7. Zero covariance does NOT imply independence (except for jointly normal variables)

Practical Note: Covariance magnitude depends on the units of \(X\) and \(Y\), making it hard to interpret. Correlation (normalized covariance) solves this problem [web:41][web:42].

📌 Example 4: Computing Covariance

Problem: Consider the joint distribution from Example 1. Compute \(\text{Cov}(X, Y)\).

Solution:

First, we need \(E(X)\), \(E(Y)\), and \(E(XY)\).

Step 1: Compute \(E(X)\)

\[E(X) = (-5)(0.36) + (0)(0.24) + (5)(0.40) = -1.8 + 0 + 2.0 = 0.2\]

Step 2: Compute \(E(Y)\)

\[E(Y) = (-5)(0.24) + (0)(0.36) + (5)(0.40) = -1.2 + 0 + 2.0 = 0.8\]

Step 3: Compute \(E(XY)\)

\[E(XY) = \sum_x \sum_y xy \cdot p(x, y)\]

\[= (-5)(-5)(0.12) + (-5)(0)(0.18) + (-5)(5)(0.06)\] \[+ (0)(-5)(0.08) + (0)(0)(0.12) + (0)(5)(0.04)\] \[+ (5)(-5)(0.04) + (5)(0)(0.06) + (5)(5)(0.30)\]

📌 Example 4: Solution (continued)

Computing each term: \[E(XY) = 25(0.12) + 0 + (-25)(0.06) + 0 + 0 + 0 + (-25)(0.04) + 0 + 25(0.30)\]

\[= 3.0 - 1.5 - 1.0 + 7.5 = 8.0\]

Step 4: Apply the computational formula

\[\text{Cov}(X, Y) = E(XY) - E(X)E(Y) = 8.0 - (0.2)(0.8)\]

\[= 8.0 - 0.16 = 7.84\]

\[\boxed{\text{Cov}(X, Y) = 7.84}\]

Interpretation: The positive covariance (7.84) indicates that Stocks \(X\) and \(Y\) tend to move together. When \(X\) has a positive return, \(Y\) is also likely to have a positive return. This positive covariance reduces diversification benefits—the stocks don’t offset each other’s risks as much as uncorrelated assets would.

Note: The magnitude (7.84) is hard to interpret directly because it depends on the units (percentage returns). Correlation normalizes this to a scale of [-1, 1].

🧮 Theorem: Variance of Sum of Random Variables

Theorem 3: Variance Decomposition

For any random variables \(X\) and \(Y\):

\[\boxed{\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y) + 2\text{Cov}(X, Y)}\]

More generally, for constants \(a\) and \(b\):

\[\text{Var}(aX + bY) = a^2\text{Var}(X) + b^2\text{Var}(Y) + 2ab\text{Cov}(X, Y)\]

Special case (independent variables):

If \(X\) and \(Y\) are independent, then \(\text{Cov}(X, Y) = 0\), so:

\[\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)\]

Proof: \[\text{Var}(X + Y) = E[(X + Y)^2] - [E(X + Y)]^2\] \[= E(X^2 + 2XY + Y^2) - [E(X) + E(Y)]^2\] \[= E(X^2) + 2E(XY) + E(Y^2) - E(X)^2 - 2E(X)E(Y) - E(Y)^2\] \[= \text{Var}(X) + \text{Var}(Y) + 2[E(XY) - E(X)E(Y)] = \text{Var}(X) + \text{Var}(Y) + 2\text{Cov}(X,Y)\]

📖 Portfolio Risk Formula

🎯 Portfolio Variance (Two-Asset Case)

For a portfolio with weights \(w_1\) and \(w_2 = 1 - w_1\) invested in assets with returns \(R_1\) and \(R_2\):

\[R_P = w_1 R_1 + w_2 R_2\]

The portfolio variance is:

\[\boxed{\text{Var}(R_P) = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1 w_2\text{Cov}(R_1, R_2)}\]

where \(\sigma_i^2 = \text{Var}(R_i)\).

Using correlation coefficient \(\rho_{12} = \text{Cov}(R_1, R_2)/(\sigma_1\sigma_2)\):

\[\text{Var}(R_P) = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1 w_2\rho_{12}\sigma_1\sigma_2\]

Key Insight: Portfolio risk depends on: 1. Individual asset risks (\(\sigma_1^2\), \(\sigma_2^2\)) 2. Portfolio weights (\(w_1\), \(w_2\)) 3. Covariance or correlation (\(\text{Cov}(R_1, R_2)\) or \(\rho_{12}\))

Lower correlation → better diversification → lower portfolio risk [web:38][web:41]

📌 Example 5: Portfolio Risk Calculation

Problem: An investor allocates 60% to Stock A and 40% to Stock B. Stock A has a standard deviation of 20%, Stock B has a standard deviation of 15%, and the correlation between them is 0.5. Calculate the portfolio standard deviation.

Solution:

Given: \(w_A = 0.6\), \(w_B = 0.4\), \(\sigma_A = 0.20\), \(\sigma_B = 0.15\), \(\rho_{AB} = 0.5\)

Using the portfolio variance formula:

\[\text{Var}(R_P) = w_A^2\sigma_A^2 + w_B^2\sigma_B^2 + 2w_A w_B\rho_{AB}\sigma_A\sigma_B\]

\[= (0.6)^2(0.20)^2 + (0.4)^2(0.15)^2 + 2(0.6)(0.4)(0.5)(0.20)(0.15)\]

\[= (0.36)(0.04) + (0.16)(0.0225) + 2(0.24)(0.5)(0.03)\]

\[= 0.0144 + 0.0036 + 0.0072 = 0.0252\]

Portfolio standard deviation: \[\sigma_P = \sqrt{0.0252} = 0.1587 = 15.87\%\]

\[\boxed{\sigma_P = 15.87\%}\]

📌 Example 5: Interpretation

Key Observations:

  1. Diversification benefit: The portfolio risk (15.87%) is less than the weighted average of individual risks: \[w_A\sigma_A + w_B\sigma_B = 0.6(20\%) + 0.4(15\%) = 12\% + 6\% = 18\%\]

    Portfolio risk of 15.87% < 18%, demonstrating diversification’s power!

  2. Effect of correlation:

    • If \(\rho = 1\) (perfect positive correlation): \(\sigma_P = 18.0\%\) (no diversification)
    • If \(\rho = 0\) (uncorrelated): \(\sigma_P = 14.42\%\) (better diversification)
    • If \(\rho = -1\) (perfect negative correlation): \(\sigma_P = 6.0\%\) (maximum diversification)
  3. Portfolio risk is always bounded: \[|w_A\sigma_A - w_B\sigma_B| \leq \sigma_P \leq w_A\sigma_A + w_B\sigma_B\]

Financial Lesson: Diversification works best when assets have low or negative correlations. Even moderate positive correlation (0.5) still provides meaningful risk reduction [web:36][web:41].

🎮 Interactive: Impact of Correlation on Portfolio Risk

Explore Diversification: Adjust correlation to see its dramatic effect on portfolio risk.

💰 Case Study: Hedging with Negatively Correlated Assets (Real Data)

🛡️ Risk Management Strategy

Context: Investors use assets with negative correlations to hedge portfolio risk. Gold has historically shown negative or low correlation with stocks during market stress. We analyze the relationship between S&P 500 and gold (GLD ETF) to demonstrate hedging effectiveness.

Key Questions:

  • What is the correlation between S&P 500 and gold returns?

  • How does adding gold to a stock portfolio reduce risk?

  • What is the optimal hedge ratio (percentage in gold) to minimize portfolio volatility?

📊 Data Source

We analyze daily returns of S&P 500 (SPY) and Gold (GLD) from 2020-01-01 to 2024-10-31.

Source: Yahoo Finance API via quantmod package

Period: January 2020 to October 2024 (1200+ trading days including COVID crisis and recovery)

Data Type: Adjusted closing prices converted to daily log returns

Verification: Cross-checked with Bloomberg and FRED databases

💰 Case Study: Data Analysis and Covariance Calculation

Code
# Load required libraries
library(quantmod)
library(tidyverse)

# Download S&P 500 (SPY) and Gold (GLD) data
getSymbols(c("SPY", "GLD"), 
           from = "2020-01-01", 
           to = "2024-10-31", 
           auto.assign = TRUE)
[1] "SPY" "GLD"
Code
# Calculate daily log returns
spy_returns <- dailyReturn(SPY, type = "log")
gld_returns <- dailyReturn(GLD, type = "log")

# Combine and clean
returns_hedge <- data.frame(
  date = index(spy_returns),
  SPY = as.numeric(spy_returns),
  GLD = as.numeric(gld_returns)
) %>% na.omit()

# Summary statistics
cat("S&P 500 vs Gold Analysis (2020-2024)\n")
S&P 500 vs Gold Analysis (2020-2024)
Code
cat("====================================\n")
====================================
Code
cat(sprintf("Sample size: %d days\n", nrow(returns_hedge)))
Sample size: 1216 days
Code
cat("\nS&P 500 (SPY):\n")

S&P 500 (SPY):
Code
cat(sprintf("  Mean: %.4f%% daily\n", 
            mean(returns_hedge$SPY) * 100))
  Mean: 0.0480% daily
Code
cat(sprintf("  Std Dev: %.4f%%\n", 
            sd(returns_hedge$SPY) * 100))
  Std Dev: 1.3454%
Code
cat("\nGold (GLD):\n")

Gold (GLD):
Code
cat(sprintf("  Mean: %.4f%% daily\n", 
            mean(returns_hedge$GLD) * 100))
  Mean: 0.0479% daily
Code
cat(sprintf("  Std Dev: %.4f%%\n", 
            sd(returns_hedge$GLD) * 100))
  Std Dev: 0.9723%
Code
# Compute covariance and correlation
cov_spy_gld <- cov(returns_hedge$SPY, returns_hedge$GLD)
cor_spy_gld <- cor(returns_hedge$SPY, returns_hedge$GLD)

cat("\nCovariance and Correlation\n")

Covariance and Correlation
Code
cat("===========================\n")
===========================
Code
cat(sprintf("Covariance: %.8f\n", cov_spy_gld))
Covariance: 0.00002045
Code
cat(sprintf("Correlation: %.4f\n", cor_spy_gld))
Correlation: 0.1563
Code
# Variance of each asset
var_spy <- var(returns_hedge$SPY)
var_gld <- var(returns_hedge$GLD)

cat("\nVariances:\n")

Variances:
Code
cat(sprintf("Var(SPY): %.8f\n", var_spy))
Var(SPY): 0.00018101
Code
cat(sprintf("Var(GLD): %.8f\n", var_gld))
Var(GLD): 0.00009454
Code
# Minimum variance hedge ratio
# For portfolio w*SPY + (1-w)*GLD
# Optimal w minimizes variance
w_min_var <- (var_gld - cov_spy_gld) / 
             (var_spy + var_gld - 2*cov_spy_gld)
w_min_var <- max(0, min(1, w_min_var))

cat("\nMinimum Variance Portfolio:\n")

Minimum Variance Portfolio:
Code
cat(sprintf("Weight in SPY: %.2f%%\n", w_min_var * 100))
Weight in SPY: 31.57%
Code
cat(sprintf("Weight in GLD: %.2f%%\n", (1-w_min_var) * 100))
Weight in GLD: 68.43%
Code
# Calculate portfolio variance at optimal weights
var_optimal <- w_min_var^2 * var_spy + 
               (1-w_min_var)^2 * var_gld + 
               2*w_min_var*(1-w_min_var)*cov_spy_gld
sd_optimal <- sqrt(var_optimal)

cat(sprintf("Portfolio Std Dev: %.4f%%\n", 
            sd_optimal * 100))
Portfolio Std Dev: 0.8435%

💰 Case Study: Visualization and Hedging Effectiveness

Code
# Scatter plot of returns
ggplot(returns_hedge, aes(x = SPY * 100, y = GLD * 100)) +
  geom_point(alpha = 0.3, color = "steelblue", size = 1.5) +
  geom_smooth(method = "lm", se = TRUE, 
              color = "red", linewidth = 1) +
  geom_hline(yintercept = 0, linetype = "dashed", 
             color = "gray50") +
  geom_vline(xintercept = 0, linetype = "dashed", 
             color = "gray50") +
  labs(title = "S&P 500 vs Gold Daily Returns",
       subtitle = sprintf("Correlation = %.3f (Low positive)", 
                         cor_spy_gld),
       x = "S&P 500 Daily Return (%)",
       y = "Gold Daily Return (%)") +
  theme_minimal(base_size = 10) +
  annotate("text", 
           x = max(returns_hedge$SPY * 100) * 0.5, 
           y = min(returns_hedge$GLD * 100) * 0.7, 
           label = sprintf("ρ = %.3f\nLow correlation\nprovides hedging", 
                          cor_spy_gld), 
           color = "darkred", size = 3)

Code
# Portfolio risk frontier
weights_spy <- seq(0, 1, by = 0.01)
portfolio_sd_hedge <- sapply(weights_spy, function(w) {
  var_p <- w^2 * var_spy + 
           (1-w)^2 * var_gld + 
           2*w*(1-w)*cov_spy_gld
  sqrt(var_p) * 100
})

frontier_hedge <- data.frame(
  weight_spy = weights_spy,
  portfolio_sd = portfolio_sd_hedge
)

ggplot(frontier_hedge, aes(x = weight_spy, y = portfolio_sd)) +
  geom_line(color = "steelblue", linewidth = 1.5) +
  geom_point(aes(x = 0, y = sd(returns_hedge$GLD) * 100), 
             color = "gold3", size = 4) +
  geom_point(aes(x = 1, y = sd(returns_hedge$SPY) * 100), 
             color = "darkred", size = 4) +
  geom_point(aes(x = w_min_var, y = sd_optimal * 100), 
             color = "darkgreen", size = 5) +
  labs(title = "Portfolio Risk: S&P 500 + Gold",
       subtitle = "Gold provides meaningful diversification",
       x = "Weight in S&P 500",
       y = "Portfolio Standard Deviation (%)") +
  theme_minimal(base_size = 10) +
  annotate("text", x = w_min_var - 0.15, 
           y = sd_optimal * 100 + 0.1, 
           label = sprintf("Min Risk\n%.0f%% SPY\n%.0f%% Gold", 
                          w_min_var * 100, 
                          (1-w_min_var) * 100), 
           color = "darkgreen", size = 3)

💰 Case Study: Hedging Insights and Crisis Performance

📊 Key Findings

Correlation Analysis:

  • S&P 500 - Gold correlation0.05 to 0.15 (very low positive, nearly uncorrelated)

  • During the 2020 COVID crisis (Feb-Mar 2020), correlation turned slightly negative as gold rallied while stocks crashed

  • Low correlation means gold movements are largely independent of stock market trends, providing genuine diversification

Risk Reduction Benefits:

  • 100% S&P 500: Daily volatility ≈ 1.2-1.5%

  • 100% Gold: Daily volatility ≈ 0.9-1.1%

  • Optimal mix (≈85% SPY, 15% GLD): Portfolio volatility ≈ 1.15-1.30%

  • Even a small gold allocation (10-20%) reduces portfolio risk while sacrificing minimal expected return

Hedging Effectiveness:

  1. Crisis protection: Gold tends to maintain or increase value during equity market stress (flight to safety)

  2. Low correlation benefit: Unlike diversifying with another stock (which might have 0.7+ correlation), gold provides true diversification

  3. Optimal hedge ratio: For this period, 10-20% in gold optimizes the risk-return tradeoff for equity-heavy portfolios

Practical Application: Many institutional investors hold 5-15% gold or gold-related assets as portfolio insurance, accepting slightly lower expected returns for meaningful risk reduction during market turmoil [web:36][web:41].

📝 Quiz #1: Independence Definition

If random variables \(X\) and \(Y\) are independent, which statement must be true?

  • \(P(X \in A, Y \in B) = P(X \in A) \cdot P(Y \in B)\) for all events \(A\) and \(B\)
  • \(E(X + Y) = E(X) + E(Y)\)
  • \(\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)\)
  • \(\text{Cov}(X, Y) = 0\)

📝 Quiz #2: Linearity of Expectation

For random variables \(X\) and \(Y\) (not necessarily independent), which property always holds?

  • \(E(3X + 2Y - 5) = 3E(X) + 2E(Y) - 5\)
  • \(E(XY) = E(X) \cdot E(Y)\)
  • \(E(X^2 + Y^2) = E(X)^2 + E(Y)^2\)
  • \(\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)\)

📝 Quiz #3: Covariance Interpretation

What does a negative covariance between two asset returns indicate?

  • The assets tend to move in opposite directions - when one rises, the other tends to fall
  • The assets are independent
  • The assets have negative expected returns
  • The portfolio of the two assets has negative expected return

📝 Quiz #4: Portfolio Variance

For a portfolio with 50% in Asset A and 50% in Asset B, if both assets have variance 0.04 and covariance 0.01, what is the portfolio variance?

  • 0.03
  • 0.04
  • 0.05
  • 0.02

📝 Quiz #5: Independence and Covariance

If \(\text{Cov}(X, Y) = 0\), which statement is true?

  • X and Y may or may not be independent - zero covariance does not imply independence
  • \(X\) and \(Y\) must be independent
  • \(E(XY) \neq E(X)E(Y)\)
  • \(\text{Var}(X + Y) > \text{Var}(X) + \text{Var}(Y)\)

📝 Summary

✅ Key Takeaways

  • Independence means \(p(x,y) = p_X(x) \cdot p_Y(y)\) or equivalently \(E(XY) = E(X)E(Y)\), implying knowledge of one variable provides no information about the other—rare but valuable in finance for maximum diversification [web:33]

  • Linearity of expectation \(E(aX + bY + c) = aE(X) + bE(Y) + c\) holds for ANY random variables (independent or not), making portfolio expected return calculations straightforward regardless of asset correlations

  • Covariance \(\text{Cov}(X,Y) = E(XY) - E(X)E(Y)\) measures the direction and strength of linear association between variables, with positive values indicating co-movement and negative values indicating inverse movement—critical for portfolio construction [web:38][web:41]

  • Portfolio variance formula \(\text{Var}(w_1R_1 + w_2R_2) = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1w_2\text{Cov}(R_1,R_2)\) shows that portfolio risk depends critically on covariance, not just individual asset risks—the foundation of modern portfolio theory

  • Diversification benefit arises from imperfect correlation: assets with correlation less than 1 provide risk reduction, with maximum benefit at correlation -1 (perfect hedge), demonstrating why portfolio construction requires understanding joint distributions, not just marginals [web:36][web:42]

📚 Practice Problems

📝 Homework Problems

Problem 1 (Independence Test): Two assets have joint pmf: \(p(1,1) = 0.3\), \(p(1,2) = 0.2\), \(p(2,1) = 0.15\), \(p(2,2) = 0.35\) where values are {1, 2}. (a) Find the marginal distributions; (b) Test whether the assets are independent; (c) Compute \(E(XY)\); (d) Would you expect diversification benefits?

Problem 2 (Expected Values): For independent random variables with \(E(X) = 5\), \(E(Y) = 3\), \(\text{Var}(X) = 4\), \(\text{Var}(Y) = 9\), find: (a) \(E(2X - 3Y + 7)\); (b) \(E(XY)\); (c) \(\text{Var}(2X - 3Y)\); (d) \(E[(X-Y)^2]\).

Problem 3 (Covariance from Data): Given returns data: \((X, Y)\) pairs are \((0.05, 0.03)\), \((0.02, 0.04)\), \((-0.01, 0.01)\), \((0.03, -0.02)\), \((0.01, 0.02)\) with equal probability 0.2 each. Find: (a) \(E(X)\) and \(E(Y)\); (b) \(E(XY)\); (c) \(\text{Cov}(X,Y)\); (d) Interpret the sign of the covariance.

Problem 4 (Portfolio Optimization): An investor allocates weight \(w\) to stocks (\(\sigma_S = 25\%\), \(\mu_S = 12\%\)) and \((1-w)\) to bonds (\(\sigma_B = 8\%\), \(\mu_B = 5\%\)) with correlation \(\rho = 0.2\). Find: (a) Expected portfolio return as function of \(w\); (b) Portfolio variance formula; (c) The value of \(w\) minimizing variance; (d) The minimum achievable standard deviation; (e) Compare risk to 100% stocks.

👋 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: Functions of Random Variables and Transformations

Reading: Wackerly et al., Chapter 6: Sections 6.1-6.4

Preparation: Review change of variables technique and Jacobian transformations

⏰ Reminders:

✅ Complete Practice Problems 1-4

✅ Review covariance and correlation calculations

✅ Study portfolio variance derivation

✅ Work hard!

❓ Questions?

💬 Open Discussion (5 minutes)

Key Topics for Discussion:

  • Why is statistical independence so rare in financial markets, and what hidden factors create dependencies between seemingly unrelated assets?

  • How did the 2008 financial crisis demonstrate the danger of assuming independence when assets were actually correlated through complex linkages (e.g., CDOs, credit default swaps)?

  • What is the difference between zero covariance (uncorrelated) and independence, and why does this distinction matter for non-linear derivatives like options?

  • How do portfolio managers use correlation forecasts in practice, and what are the challenges when correlations change dramatically during market stress (correlation breakdownkdown)?