Understand correlation between instruments
What Is Correlation?
WHY this range? Correlation normalizes covariance by the volatility of each asset, creating a dimensionless measure. The math forces it between -1 and +1.
Derivation from First Principles
Let's build the correlation formula step by step.
Step 1: Define returns For two instruments A and B over n periods:
- Returns:
- Returns:
Step 2: Measure how they vary together Covariance captures joint movement:
WHY n-1? Bessel's correction for sample variance (unbiased estimator). We're using sample data, not the entire population.
WHAT does this mean? Each term is:
- Positive when both returns are above or below their means (move together)
- Negative when one is above and one is below (move opposite)
- Zero when at mean
Step 3: Normalize by volatility Covariance depends on the assets' scales. A stock at ₹5000 has larger absolute moves than one at ₹50. We need a scale-free measure.
Standard deviation of returns:
HOW to normalize? Divide covariance by both standard deviations:
WHY does this work? Dividing by scales the covariance to [-1, +1]. Think of it as measuring "covariance per unit of volatility." The Cauchy–Schwarz inequality guarantees , so always.
Expanded form:

Real-World Examples
| Day | Infosys Return | TCS Return |
|---|---|---|
| 1 | +2.1% | +1.8% |
| 2 | -1.5% | -1.2% |
| 3 | +0.8% | +1.1% |
| ... | ... | ... |
Step 1: Calculate mean returns
Step 2: Calculate deviations and products
- Day 1:
- Day 2:
WHY these multiplications? Positive products mean they moved in the same direction (both up or both down).
Step 3: Sum and divide by n-1
- (numerator sum ≈ 44.7 over the 20 days)
Step 4: Calculate standard deviations
Step 5: Compute correlation
WHY this step? We must keep . Since the maximum possible covariance is , the covariance cannot exceed 2.7. A correlation of 0.87 corresponds to — consistent and valid. (An earlier draft mistakenly used Cov = 3.09, which would give an impossible ρ = 1.14 > 1; that's a red flag your covariance is wrong.)
Interpretation: Strong positive correlation (0.87). When Infosys rises, TCS usually rises too. They're in the same sector, face similar macro factors.
WHAT does -0.3 mean?
- Negative: They tend to move in opposite directions
- Weak: The relationship isn't strong; gold can rise while Nifty rises too
WHY negative? Gold is a "safe haven" asset. When stock markets crash (fear), investors flee to gold. When markets boom (greed), they sell gold for equities.
Trading implication: Holding both provides diversification. If Nifty drops 10%, gold might rise 3%, cushioning your portfolio.
WHY negative? Oil is airlines' biggest cost. When crude spikes, airline profits shrink and stocks fall.
HOW to trade this?
- Hedge: Long airline stocks? Buy crude oil futures as insurance
- Pairs trade: If correlation breaks (oil up, airlines up), bet on mean reversion
Step-by-step pairs trade:
- Identify the divergence: Oil up 20%, IndiGo unchanged (expected IndiGo down 12% based on historical ρ = -0.6)
- Short IndiGo (expecting catch-up decline)
- Long oil futures (protection if oil continues rising)
- Exit when correlation normalizes
Common Mistakes
Why it feels right: Negative correlation means when one goes up, the other tends to go down. That sounds like cause and effect.
The fix: Correlation measures association, not causation. Both might be driven by a third factor (risk sentiment, inflation expectations). The correlation could even be coincidental.
Steel-man: You observe that every time gold rises, Nifty falls within days. That temporal pattern suggests causation, but correlation alone doesn't prove it. You need a mechanism: "Risk-off sentiment → sell stocks, buy gold."
Why it feels right: You calculate correlation on historical data, and it's high. Extrapolating seems reasonable.
The fix: Correlation is dynamic. It changes with:
- Market regimes: During crashes, all correlations spike toward +1 (everything falls together)
- Company events: Infosys scandal → TCS decouples
- Macro shifts: New regulations affect one sector differently
HOW to handle it: Use rolling correlation (e.g., 60-day window) to track changes. Recalculate monthly.
Why it feels right: Pearson correlation measures linear relationships. Low ρ means no straight-line pattern.
The fix: Assets can have strong non-linear relationships even with ρ near zero. Example: VIX (volatility index) and Nifty. When Nifty drops sharply, VIX spikes (non-linear, convex). Zero linear correlation does not imply statistical independence — only under joint normality does it. Two variables can be perfectly dependent yet have ρ = 0.
WHAT to do: Supplement with rank correlation (Spearman's ρ) or visual scatter plots.
Why it feels right: Diversification reduces risk. More uncorrelated assets = less risk.
The fix: Two issues:
- Diminishing returns: Beyond 15-20 stocks, additional diversification adds minimal benefit
- Systemic risk remains: In a market crash, correlations converge to +1. Your "diversified" portfolio crashes together.
Steel-man: You're right that low correlation helps in normal times. But you're underestimating tail risk. Better: Mix asset classes (stocks, bonds, commodities) not just stocks.
How to Use Correlation in Trading
1. Portfolio Construction
- Goal: Maximize return for given risk
- Method: Combine assets with ρ < 0.5. If A and B have ρ = 0, portfolio variance = (cross-term vanishes). If ρ = 1, variance = (much higher).
Formula for two-asset portfolio volatility:
WHY the cross-term? The captures joint movement. When ρ = 0, this vanishes (linear risks don't reinforce).
2. Risk Management
- Concentrated risk: If all your stocks have ρ > 0.8, you're exposed to sector risk
- Hedge: Add negatively correlated assets (gold, inverse ETFs)
3. Pairs Trading
- Find highly correlated pairs (ρ > 0.9)
- When correlation temporarily breaks, bet on mean reversion
- Example: HDFC Bank and ICICI Bank usually move together. If HDFC drops 5% on earnings miss but ICICI unchanged, short ICICI (expecting catch-up decline)
4. Regime Detection
- Monitor average correlation across portfolio
- Rising correlations: Market stress (risk-off), reduce exposure
- Falling correlations: Normal market, safe to add risk
Calculation Tools
Quick correlation in Excel:
=CORREL(A2:A21, B2:B21)
Rolling correlation: Use 60-day windows, shift by 1 day, plot the time series.
Python (for algorithmic traders):
import pandas as pd
df['rolling_corr'] = df['stock_a'].rolling(60).corr(df['stock_b'])Or: "Correlation is between -1 and 1, like my mood swings between 'ugh' and 'yay'."
Recall Feynman Technique: Explain to a 12-Year-Old
Imagine you and your best friend walk to school every day. Correlation is like noticing: "Do we trip at the same time?"
If every time you trip, your friend trips too, that's perfect positive correlation (+1). You're walking in sync.
If whenever you trip, your friend stays steady (and vice versa), that's perfect negative correlation (-1). You're opposites.
If your tripping has nothing to do with your friend's tripping in a straight-line way, that's zero correlation (0). But careful — maybe you both trip only near the same weird crack in the road, just in a twisty pattern the simple "same time" rule can't catch. So zero correlation doesn't always mean truly unrelated!
In stocks, correlation tells you: "If Stock A falls, will Stock B fall too?" If they're correlated, they're like friends who trip together. If you own both, you're in double trouble. But if they're negatively correlated, one falls while the other rises—you're safer!
Connections
- Diversification-and-portfolio-theory – Correlation is the foundation of diversification; Markowitz portfolio theory uses correlation matrices
- Beta-and-systematic-risk – Beta measures correlation between a stock and the market
- Hedging-strategies – Negative correlation enables hedging (e.g., long stocks, short index futures)
- Pairs-trading – Exploits temporary correlation breakdowns in historically correlated instruments
- Volatility-and-standard-deviation – Correlation combines with volatilities to compute portfolio risk
- Covariance-matrix – Multi-asset correlation requires covariance matrices
- Asset-allocation – Strategic allocation depends on cross-asset correlations (stocks-bonds-gold)
#flashcards/stock-market
What does a correlation coefficient of +1 mean between two instruments?
What does a correlation coefficient of -1 mean?
What is the formula for correlation coefficient between A and B?
Why do we divide covariance by standard deviations to get correlation?
Does ρ = 0 mean two instruments are statistically independent?
If Tech Stock A and Tech Stock B have correlation 0.85, what does this tell a trader?
Why can a valid correlation never exceed +1 or fall below -1?
Why is "correlation is stable" a dangerous assumption?
How does negative correlation between gold and Nifty help in portfolio construction?
Why might correlation between crude oil and airline stocks be negative?
In pairs trading, when do you enter a position?
What does rising average correlation across your portfolio signal?
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, correlation ka core idea bilkul simple hai — jab do stocks ya instruments market mein saath-saath move karte hain, tab ek ko dekh kar doosre ke baare mein andaza lag jaata hai. Jaise Infosys aur TCS dono tech companies hain, toh aksar saath upar-neeche hoti hain — yeh positive correlation hai. Agar tech upar jaaye aur oil neeche, toh woh negative correlation hai. Correlation coefficient (ρ) bas ek number hai -1 se +1 ke beech jo yeh "dance" measure karta hai: +1 matlab bilkul saath, -1 matlab exactly ulta, aur 0 matlab koi linear rishta nahi.
Formula banane ka logic bhi seedha hai. Pehle hum covariance nikaalte hain jo batata hai do returns ek saath kaise vary karte hain — jab dono apne mean se upar ya dono neeche hote hain toh product positive aata hai (saath move), aur ek upar ek neeche toh negative. Problem yeh hai ki covariance scale pe depend karta hai — ₹5000 wala stock bade absolute moves karega ₹50 wale ke muqable. Isliye hum covariance ko dono ki standard deviation se divide karte hain taaki ek scale-free, clean number mile jo hamesha -1 aur +1 ke beech rahe (Cauchy-Schwarz inequality yeh guarantee deti hai).
Yeh cheez matter kyun karti hai? Kyunki diversification tabhi kaam karta hai jab aapke assets ek saath crash na ho. Agar aapne 5 stocks khareede lekin sab highly correlated hain, toh aapne actually risk kam nahi kiya — sab ek saath gir sakte hain! Ek important warning yaad rakhna: ρ = 0 ka matlab sirf "no linear relationship" hai, iska matlab yeh nahi ki dono independent hain — unke beech U-shape jaisa non-linear rishta ho sakta hai. Isliye number ke saath hamesha scatter plot bhi dekh lena, taaki tumhein poori picture mile.