σμ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
  • 日本語
  • 中文
Statistics skill›Module 3 · Models and regression›Topic 3.1·~55 minIntermediate

Maximum likelihood

Skill positionModule 3 of 4 · Topic 1 of 4
3.1 Maximum likelihood
—Lab score— / 100Total XP—Streak—

The parameters that make the data most likely

Suppose you believe the data come from a family of distributions with an unknown parameter θ\thetaθ (the mean and variance of a normal, the rate of a Poisson). The likelihood L(θ)=∏if(xi;θ)L(\theta)=\prod_i f(x_i;\theta)L(θ)=∏i​f(xi​;θ) is the probability, as a function of θ\thetaθ, of the data you actually saw. Maximum likelihood estimation picks the θ^\hat\thetaθ^ that makes the observed data most probable. It is the workhorse behind regression, volatility models and most of machine learning.

ℓ(θ)=∑i=1nln⁡f(xi;θ),θ^=arg⁡max⁡θ ℓ(θ),∂ℓ∂θ∣θ^=0\ell(\theta)=\sum_{i=1}^{n}\ln f(x_i;\theta),\qquad \hat\theta=\arg\max_\theta\,\ell(\theta),\qquad \frac{\partial\ell}{\partial\theta}\Big|_{\hat\theta}=0ℓ(θ)=i=1∑n​lnf(xi​;θ),θ^=argθmax​ℓ(θ),∂θ∂ℓ​​θ^​=0(1)

In practice you maximise the log-likelihood ℓ\ellℓ: a product of many small numbers underflows and is awkward to differentiate, while the sum of logs is stable and has the same maximiser, because the logarithm is increasing. Setting the derivative to zero gives closed forms for the standard cases. For a Poisson sample λ^=xˉ\hat\lambda=\bar xλ^=xˉ. For a Bernoulli sample p^\hat pp^​ is the proportion of successes. For a normal sample μ^=xˉ\hat\mu=\bar xμ^​=xˉ and σ^2=1n∑(xi−xˉ)2\hat\sigma^2=\frac1n\sum(x_i-\bar x)^2σ^2=n1​∑(xi​−xˉ)2, dividing by nnn rather than n−1n-1n−1, which makes the variance estimate slightly too small in small samples.

Three quick maximum likelihood estimatesTrade counts per minute of 2,4,3,32,4,3,32,4,3,3 give a Poisson rate λ^=12/4=3\hat\lambda=12/4=3λ^=12/4=3. Twelve winning trades out of 40 give p^=12/40=0.3\hat p=12/40=0.3p^​=12/40=0.3, whose log-likelihood is 12ln⁡0.3+28ln⁡0.7≈−24.43512\ln0.3+28\ln0.7\approx-24.43512ln0.3+28ln0.7≈−24.435; any other ppp gives a lower value. For 1,2,3,4,51,2,3,4,51,2,3,4,5 the normal MLE is μ^=3\hat\mu=3μ^​=3 and σ^2=10/5=2\hat\sigma^2=10/5=2σ^2=10/5=2, while the unbiased sample variance is 10/4=2.510/4=2.510/4=2.5: the MLE is slightly smaller, and the difference fades as nnn grows.
  • Likelihood: the probability of the observed data as a function of the parameter.
  • MLE: the parameter that maximises it; maximise the log-likelihood for stability.
  • Properties: consistent and asymptotically normal under mild conditions, but not always unbiased in small samples.
A good fit to the wrong model is still wrongMaximum likelihood finds the best parameters inside the family you chose. If daily returns are fat-tailed and you fit a normal, you get the best normal, and its variance will still understate crash risk. Compare the fitted model with the data (tail counts, histograms) before trusting it, and consider a heavier-tailed family such as the Student-ttt.

Lab · what's graded

  • A Poisson rate10 pts
  • A normal variance15 pts
  • A win rate10 pts
  • A log-likelihood15 pts
  • What MLE does15 pts
  • Properties of the MLE15 pts
  • Why maximise the log-likelihood20 pts
0/ 7 answered
Tasks
1Numeric answer10 ptsNot answered

Trade counts in four minutes are 2, 4, 3 and 3. What is the maximum likelihood estimate of the Poisson rate?

λ^=\hat\lambda =λ^=accepted: ± 0.001
2Numeric answer15 ptsNot answered

For the sample 1, 2, 3, 4, 5, what is the maximum likelihood estimate of the normal variance (divide by n)?

σ^2=\hat\sigma^{2} =σ^2=accepted: ± 0.001
3Numeric answer10 ptsNot answered

12 of 40 trades won. What is the maximum likelihood estimate of the win probability?

p^=\hat p =p^​=accepted: ± 0.001
4Numeric answer15 ptsNot answered

Evaluate the log-likelihood 12 ln(p) + 28 ln(1 - p) at p = 0.3 (natural logarithm). Give it to three decimals.

ℓ=\ell =ℓ=accepted: ± 0.01
5Choice15 ptsNot answered

What does maximum likelihood estimation choose?

6Choice15 ptsNot answered

Select every true statement.

7Explain in words20 ptsNot answered

In two sentences, say why we maximise the log-likelihood instead of the likelihood.

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