σμ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
  • 日本語
  • 中文
Particle filtering and non-stationary time series skill›Module 2 · Particle filters›Topic 2.4·~1 hr 10 minAdvanced

Stochastic volatility filtering

Skill positionModule 2 of 3 · Topic 4 of 5
2.4 Stochastic volatility filtering
—Lab score— / 100Total XP—Streak—

Volatility you cannot see

Returns come in calm stretches and in storms, so the spread of a return changes from day to day, and nobody reports it. The stochastic volatility model treats the log of the variance, hth_tht​, as a hidden state. It moves as a first-order autoregression around a long-run level μ\muμ: a fraction φ\varphiφ of yesterday's gap stays, and a fresh shock of size σ\sigmaσ arrives. The return is a bell curve with variance ehte^{h_t}eht​. Using the log keeps the variance positive and makes shocks multiply it. Three numbers describe the model: the level μ\muμ, the persistence φ\varphiφ (near 111 means volatility shocks last) and the volatility of volatility σ\sigmaσ.

ht=μ+φ (ht−1−μ)+σ ηt,rt=eht/2 εt,sd(h)=σ1−φ2h_t=\mu+\varphi\,(h_{t-1}-\mu)+\sigma\,\eta_t,\qquad r_t=e^{h_t/2}\,\varepsilon_t,\qquad \mathrm{sd}(h)=\frac{\sigma}{\sqrt{1-\varphi^{2}}}ht​=μ+φ(ht−1​−μ)+σηt​,rt​=eht​/2εt​,sd(h)=1−φ2​σ​(1)

The hidden state sits inside an exponential, so the observation is a non-linear function of it and the Kalman filter has no exact answer. A bootstrap particle filter does. Start the particles from the long-run distribution of hhh. Each day, move every particle with the autoregression, weight it by the normal density of the return with variance ehe^{h}eh, and resample when the effective sample size is low. The filtered volatility is the square root of the weighted average of ehe^{h}eh, and multiplying by 252\sqrt{252}252​ turns a daily figure into an annual one. The average of the particle likelihoods also gives the log-likelihood of the parameters, which the next topic uses.

Numbers for one dayTake μ=−8.85\mu=-8.85μ=−8.85 (an annual volatility of 19%19\%19%), φ=0.98\varphi=0.98φ=0.98 and σ=0.15\sigma=0.15σ=0.15. The long-run spread of hhh is 0.15/1−0.982=0.7540.15/\sqrt{1-0.98^2}=0.7540.15/1−0.982​=0.754. A particle at h=−8h=-8h=−8 means a daily variance e−8e^{-8}e−8 and an annual volatility 252 e−8=29.1%\sqrt{252\,e^{-8}}=29.1\%252e−8​=29.1%. Its prediction for tomorrow has mean −8.85+0.98×0.85=−8.017-8.85+0.98\times0.85=-8.017−8.85+0.98×0.85=−8.017. If the return is −2%-2\%−2%, its normal density is 12.012.012.0. A −3%-3\%−3% return is 505050 times more likely under h=−8h=-8h=−8 than under a calm particle with h=−9.5h=-9.5h=−9.5, so the stormy particle gets 505050 times the weight.

On the 5,4045{,}4045,404 SPY returns since 2005, with μ=ln⁡(r2‾)=−8.85\mu=\ln(\overline{r^{2}})=-8.85μ=ln(r2)=−8.85, φ=0.98\varphi=0.98φ=0.98, σ=0.15\sigma=0.15σ=0.15 and 100010001000 particles, the filtered annual volatility averages 8.7%8.7\%8.7% in 2017 and 30.8%30.8\%30.8% in 2008, and peaks at 79.5%79.5\%79.5% on 15 October 2008. The log-likelihood is 17,75217{,}75217,752, against 16,25216{,}25216,252 for a constant volatility, a gain of about 1,5001{,}5001,500. The effective sample size has a median of 966966966 out of 100010001000, but it falls to 3.33.33.3 on 10 October 2018 (−3.2%-3.2\%−3.2% after a calm spell, the filtered volatility jumping from 7.9%7.9\%7.9% to 18.9%18.9\%18.9%). After calm, almost no particle has a high enough volatility to explain a shock.

  • Hidden state is the log-variance: it keeps the variance positive and makes shocks multiply it.
  • Weights favour the volatility that explains the return: a big return lifts the stormy particles and a small one lifts the calm ones.
  • Watch the ESS after calm: a big surprise can leave very few useful particles.

Lab · what's graded

  • The long-run spread15 pts
  • Annual volatility of a particle10 pts
  • The predicted mean15 pts
  • A normal density10 pts
  • A weight ratio15 pts
  • Why the log-variance10 pts
  • Match the vocabulary10 pts
  • Why not just use the return15 pts
0/ 8 answered
Tasks
1Numeric answer15 ptsNot answered

With φ=0.98\varphi=0.98φ=0.98 and σ=0.15\sigma=0.15σ=0.15, the standard deviation of the log-variance in the long run is σ/1−φ2\sigma/\sqrt{1-\varphi^{2}}σ/1−φ2​. What is it? Give three decimals.

s=s =s=accepted: ± 0.003
2Numeric answer10 ptsNot answered

A particle has h=−8h=-8h=−8, so its daily variance is e−8=0.000335e^{-8}=0.000335e−8=0.000335. What is its annual volatility 252×0.000335\sqrt{252\times0.000335}252×0.000335​ in percent? Give one decimal.

v=v =v=accepted: ± 0.3
3Numeric answer15 ptsNot answered

A particle has h=−8h=-8h=−8 today, with μ=−8.85\mu=-8.85μ=−8.85 and φ=0.98\varphi=0.98φ=0.98. What is the mean of tomorrow's hhh, μ+φ(h−μ)\mu+\varphi(h-\mu)μ+φ(h−μ)? Give three decimals.

h=h =h=accepted: ± 0.003
4Numeric answer10 ptsNot answered

With h=−8h=-8h=−8 the return has standard deviation 0.01830.01830.0183. The normal density of a return of −0.02-0.02−0.02 is e−z2/20.01832π\dfrac{e^{-z^{2}/2}}{0.0183\sqrt{2\pi}}0.01832π​e−z2/2​ with z=−0.02/0.0183z=-0.02/0.0183z=−0.02/0.0183. Give its value to one decimal.

f=f =f=accepted: ± 0.2
5Numeric answer15 ptsNot answered

A return of −3%-3\%−3% has density 5.705.705.70 under the stormy particle (h=−8h=-8h=−8) and 0.1130.1130.113 under the calm particle (h=−9.5h=-9.5h=−9.5). How many times larger is the weight of the stormy particle? Give the ratio to the nearest whole number.

n=n =n=accepted: ± 1.5
6Choice10 ptsNot answered

Why does the model put a random walk-like process on the log of the variance rather than on the variance itself?

7Match10 ptsNot answered

Match each parameter or quantity with its meaning.

Pick the partner of each item on the left.

Level mu
Persistence phi
Volatility of volatility sigma
Hidden log-variance h
8Explain in words15 ptsNot answered

On 16 March 2020 SPY fell 11.6%11.6\%11.6%, yet the filtered annual volatility was 69%69\%69%, not 184%184\%184%. In one or two sentences, explain why the filter does not equate volatility with the size of one day's return.

Math modeKeyboard or LaTeX inputTask 1 of 8 · 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