σμ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 1 · Hidden states that move›Topic 1.1·~45 minAdvanced

State-space models revisited

Skill positionModule 1 of 3 · Topic 1 of 2
1.1 State-space models revisited
—Lab score— / 100Total XP—Streak—

Tracking something you cannot see

The beta of a stock, its volatility, the fair level of a spread: nobody can read these numbers off a screen. What you see each day is a price or a return, which is the hidden quantity plus noise. A state-space model writes this down with two equations. The state xtx_txt​ is the hidden quantity and it moves a little every day. The observation yty_tyt​ is what you actually measure. The simplest case is the local level model: the state does a random walk, and each observation is the state plus measurement noise.

xt=xt−1+wt,  wt∼N(0,q),yt=xt+vt,  vt∼N(0,r)x_t=x_{t-1}+w_t,\ \ w_t\sim N(0,q),\qquad y_t=x_t+v_t,\ \ v_t\sim N(0,r)xt​=xt−1​+wt​,  wt​∼N(0,q),yt​=xt​+vt​,  vt​∼N(0,r)(1)

Here qqq is how much the state wanders in one day, and rrr is how noisy one observation is. Three questions come up again and again. Prediction asks where the state will be tomorrow before you see tomorrow's data. Filtering asks where the state is now, after seeing today's observation. Smoothing asks where it was in the past, once more data has arrived. A trader who needs a live number can only use filtering. All three keep the belief as a bell curve with a mean and a variance. Predicting makes the variance bigger by qqq, because the state may have moved. Seeing an observation makes it smaller, because it carries information.

A first look with numbersStart with the belief x0∼N(0,2)x_0\sim N(0,2)x0​∼N(0,2), and let q=0.5q=0.5q=0.5 and r=1r=1r=1. After one day of motion, with no data yet, the variance of x1x_1x1​ is 2+0.5=2.52+0.5=2.52+0.5=2.5. The observation adds its own noise, so y1y_1y1​ has predictive variance 2.5+1=3.52.5+1=3.52.5+1=3.5 and mean 000. The chance that y1y_1y1​ comes out above 222 is the chance that a standard normal is above 2/3.5=1.072/\sqrt{3.5}=1.072/3.5​=1.07, about 14%14\%14%. Without data, the variance keeps growing by 0.50.50.5 per day: after four days it is 2+4×0.5=42+4\times0.5=42+4×0.5=4.
  • State versus observation: the state is hidden and moves slowly; the observation is noisy and arrives every day.
  • Predict then update: the prediction step adds uncertainty qqq; the update step uses the data to remove some of it.
  • Same idea as a hidden Markov model: there the state has a few values, here it is a number on a line.

Lab · what's graded

  • One step of motion15 pts
  • Variance of an observation15 pts
  • Four days without data15 pts
  • A large observation10 pts
  • Which quantities are hidden10 pts
  • The filter cycle10 pts
  • Match the vocabulary10 pts
  • Why filter at all15 pts
0/ 8 answered
Tasks
1Numeric answer15 ptsNot answered

The belief about x0x_0x0​ is N(0,2)N(0,2)N(0,2) and the state moves with q=0.5q=0.5q=0.5. What is the variance of x1x_1x1​ before any data arrives?

P=P =P=accepted: ± 0.01
2Numeric answer15 ptsNot answered

The state has variance 2.52.52.5 and the measurement noise has variance r=1r=1r=1. What is the predictive variance of the observation y1y_1y1​?

S=S =S=accepted: ± 0.01
3Numeric answer15 ptsNot answered

Start from variance 222 and let the state move for four days with q=0.5q=0.5q=0.5 and no observations. What is the variance of x4x_4x4​?

P4=P4 =P4=accepted: ± 0.01
4Numeric answer10 ptsNot answered

The observation y1y_1y1​ is N(0,3.5)N(0,3.5)N(0,3.5). The standardised value of 222 is z=1.07z=1.07z=1.07. Using that the standard normal has P(Z>1.07)≈0.143P(Z>1.07)\approx0.143P(Z>1.07)≈0.143, give the chance that y1y_1y1​ is above 222 to three decimals.

p=p =p=accepted: ± 0.003
5Choice10 ptsNot answered

Which of these are hidden states, never read directly from the market? Pick all that apply.

6Order the steps10 ptsNot answered

Put the steps of one filter cycle in order.

Drag to reorder, or focus an item, press Space to lift it, the arrow keys to move it and Space to drop it.

  1. 1Use the observation to update the belief
  2. 2Start with yesterday's belief
  3. 3Repeat tomorrow with the new belief
  4. 4Observe today's value
  5. 5Predict where the state has moved
7Match10 ptsNot answered

Match each term with its meaning.

Pick the partner of each item on the left.

State noise q
Measurement noise r
Filtering
Smoothing
8Explain in words15 ptsNot answered

In one or two sentences, explain why combining a prediction with an observation, as a filter does, gives a better estimate of the hidden state than the latest noisy observation alone.

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