σμ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
  • 日本語
  • 中文
statsmodels skill›Module 3 · Cross-sections and tails›Topic 3.3·~1 hr 40 minAdvanced

Capstone: factor premia estimated with Fama–MacBeth

Skill positionModule 3 of 3 · Topic 3 of 3
3.3 Capstone: factor premia estimated with Fama–MacBeth
—Lab score— / 100Total XP—Streak—

From characteristics to prices

In this capstone you estimate what the stock market pays for three simple traits, 12-month momentum, last month's return and 12-month volatility, and you decide how much to believe the answer. You turn daily closes into monthly returns of the single stocks, build for every stock-month the traits known at that date and the return that follows, and run the Fama–MacBeth procedure: one cross-sectional regression of next-month returns on the standardised traits for every month, then the mean of the monthly slopes with its standard errors. Statsmodels does the regressions and you write the rest.

Two details make the answer honest. The standard error of the mean slope must respect that monthly slopes can be autocorrelated, so you code the Newey–West t-statistic yourself, with Bartlett weights. And a premium is only interesting if it survives the known factors, so you form a long-short portfolio on volatility and regress its monthly return on the Fama–French market, size and value factors with a HAC covariance. The intercept of that regression, its alpha, is what remains unexplained.

λₜ=OLS(yₜ₊₁; zₜ), λ̂=1/TΣₜλₜ, t=λ̂/(√(ω̂/T))
What the real data sayOver 307 months from January 2001 to July 2026 and about 56 single stocks a month, the average monthly price of volatility is +0.27% (plain t=2.00, Newey–West t=1.99, about 3.2% a year), momentum +0.18% (t=1.68) and short-term reversal -0.07% (t=-0.83), which cannot be told from zero. A single pooled regression would give volatility t=5.47. The volatility premium is the same in both halves of the sample (0.27% a month). A long-short portfolio that buys the highest-volatility fifth and sells the lowest fifth earns 0.79% a month, and after the market, size and value factors it keeps an alpha of 0.73% a month with t=2.06. The stock list is today's large companies, so survivorship flatters the high-volatility winners and the true premium is smaller.
  • Two passes: monthly cross-sectional regressions first, then the mean and spread of the monthly slopes.
  • Robust errors: a Newey–West t-statistic for the mean slope and a HAC covariance for the alpha regression.
  • Survivorship bias: a list of today's winners flatters the premium, so quote it as an upper bound.

Lab · what's graded

  • Monthly returns10 pts
  • The stock-month panel15 pts
  • One month's prices10 pts
  • The first pass10 pts
  • A Newey–West t-statistic15 pts
  • The second pass10 pts
  • A long-short portfolio10 pts
  • Alpha against the factors10 pts
  • The whole study10 pts
Explorer · lab-sx-10
▾ lab-sx-10
▾ data
…
bash · in-browser
learner@quantcraft:~/lab-sx-10$
Python not loaded yetPythonLn 1, Col 1Spaces: 4UTF-8

Reset this topic?

Everything in lab-sx-10 goes back to the starter files and the terminal is cleared. Your current solution will be lost — this can't be undone.

Will be reset
  • main.py → starter code
  • Terminal history and test output
  • Unsubmitted changes
Will be kept
  • Best lab score
  • Your XP and streak
  • Lecture progress and notes

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