σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Matrix Decompositions skill›Module 3 · Covariance and PCA›Topic 3.3·~55 minIntermediate

PCA on yield curves

Skill positionModule 3 of 5 · Topic 3 of 3
3.3 PCA on yield curves
—Lab score— / 100Total XP—Streak—

A whole yield curve in three numbers

US Treasury yields come in a dozen maturities from one month to thirty years, and they all move every day. Yet they do not move independently: a shock to the policy rate ripples smoothly along the curve. That makes the daily yield changes an ideal case for PCA. The principal components of the covariance matrix of yield changes have a stable, readable shape that traders have named for decades.

Δyt≈s1,t q1+s2,t q2+s3,t q3,Var⁡(sj)=λj\Delta\mathbf y_t\approx s_{1,t}\,\mathbf q_1+s_{2,t}\,\mathbf q_2+s_{3,t}\,\mathbf q_3,\qquad \operatorname{Var}(s_j)=\lambda_jΔyt​≈s1,t​q1​+s2,t​q2​+s3,t​q3​,Var(sj​)=λj​(1)

The first component q1\mathbf q_1q1​ has loadings of the same sign at every maturity: when it is positive the whole curve shifts up, which traders call the level (the loadings are larger in the middle of the curve than at the very short end, because short rates follow the policy rate more tightly). The second changes sign once, short end one way and long end the other, so it tilts the curve: the slope. The third changes sign twice, the two ends moving against the middle, so it bends the curve: the curvature. Because the curve is smooth, three scores rebuild almost every daily move, and a position can be hedged against these three risks instead of against a dozen separate yields. Run PCA on changes in yields, not on levels: levels are persistent and nearly non-stationary, and their first component would just trace the slow drift of the average rate.

What 5,158 trading days sayTake the daily changes of ten Treasury yields (3 months to 30 years) from March 2006 to October 2026. The principal components explain 75.6%75.6\%75.6%, 13.7%13.7\%13.7% and 6.3%6.3\%6.3% of the variance, together 95.5%95.5\%95.5%, and the fourth adds only 1.9%1.9\%1.9%. The second component's loading runs from about −0.54-0.54−0.54 at 3 months to +0.32+0.32+0.32 at 30 years, a slope; the third is +0.60+0.60+0.60 at 3 months, about −0.40-0.40−0.40 at 2 years and +0.37+0.37+0.37 at 30 years, a curvature. A move of scores (5,−2,1)(5,-2,1)(5,−2,1) basis points changes the 10-year yield by 5(0.4)−2(0.2)+1(0.1)=1.75(0.4)-2(0.2)+1(0.1)=1.75(0.4)−2(0.2)+1(0.1)=1.7 basis points, if its three loadings are 0.40.40.4, 0.20.20.2 and 0.10.10.1.
  • Level: all loadings share one sign; the whole curve moves up or down together.
  • Slope: the loadings change sign once; the short and long ends move in opposite directions.
  • Curvature: the loadings change sign twice; the ends move against the middle.
Use changes, not levelsBecause yields trend for years, a PCA of levels reports mostly that trend and the loadings drift with the sample period. Differences remove it. The same logic applies to prices: use returns. Data note: the 30-year yield was not published from February 2002 to February 2006, so the lab data starts after that gap, and the bars you will use later are adjusted, survivor-biased prices.

Lab · what's graded

  • Name the components15 pts
  • Explained variance of three components15 pts
  • Rebuild a yield move15 pts
  • How many components10 pts
  • Levels or changes15 pts
  • What a one-factor hedge leaves15 pts
  • Why so few factors15 pts
0/ 7 answered
Tasks
1Match15 ptsNot answered

Match each principal component of the yield changes to its description.

Pick the partner of each item on the left.

First component
Second component
Third component
2Numeric answer15 ptsNot answered

The first three components explain 75.6%, 13.7% and 6.3% of the variance. What do they explain together, in percent?

total=total =total=accepted: ± 0.2
3Numeric answer15 ptsNot answered

The scores of a day are (5, -2, 1) basis points and the 10-year yield has loadings 0.4, 0.2 and 0.1 on the three components. By how many basis points does the 10-year yield change?

change=change =change=accepted: ± 0.02
4Numeric answer10 ptsNot answered

The first four components explain 75.6%, 13.7%, 6.3% and 1.9%. How many components are needed to explain at least 95% of the variance?

components=components =components=accepted: ± 0.01
5Choice15 ptsNot answered

Why is yield-curve PCA run on daily changes in yields rather than on yield levels?

6Choice15 ptsNot answered

A bond portfolio is hedged to be neutral to the first component (level) only. What risk remains?

7Explain in words15 ptsNot answered

In one or two sentences, say why three components can describe a curve of a dozen yields.

Math modeKeyboard or LaTeX inputTask 1 of 7 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub