σμ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
  • 日本語
  • 中文
Hidden Markov Models skill›Module 1 · Chains and hidden states›Topic 1.2·~45 minIntermediate

Hidden states and emissions

Skill positionModule 1 of 3 · Topic 2 of 2
1.2 Hidden states and emissions
—Lab score— / 100Total XP—Streak—

The state is hidden, the move is seen

In a market you never see whether the day is Calm or Stormy. You only see the size of the move: say Small or Large. A hidden Markov model (HMM) has three parts. The initial probabilities π\piπ say how likely each state is on day one. The transition matrix AAA says how the hidden state moves. The emission probabilities Bj(o)B_j(o)Bj​(o) say how likely each observation ooo is when the state is jjj. Here a calm day gives a small move with probability 0.90.90.9 and a stormy day gives a large move with probability 0.70.70.7, and π=(0.6, 0.4)\pi=(0.6,\,0.4)π=(0.6,0.4).

P(s1,…,sT, o1,…,oT)=πs1Bs1(o1)∏t=2TAst−1st Bst(ot)P(s_1,\dots,s_T,\,o_1,\dots,o_T)=\pi_{s_1}B_{s_1}(o_1)\prod_{t=2}^{T}A_{s_{t-1}s_t}\,B_{s_t}(o_t)P(s1​,…,sT​,o1​,…,oT​)=πs1​​Bs1​​(o1​)t=2∏T​Ast−1​st​​Bst​​(ot​)(1)

The formula multiplies the start, then for each later day the chance of the state move and the chance of the observed move. The catch is that we only see the ooo's. A large move is more likely on a stormy day, but it can also happen on a calm one, so one observation is only evidence about the state, never proof. The rest of this skill is about turning a sequence of observations into beliefs about the hidden states: how likely is the data, which state is each day in, and what are the model's numbers.

One path, one probabilityTake the days Small, Large, Large and the hidden path Calm, Stormy, Stormy. Its probability is 0.6×0.90.6\times0.90.6×0.9 (start calm, small move) times 0.1×0.70.1\times0.70.1×0.7 (switch to stormy, large move) times 0.8×0.70.8\times0.70.8×0.7 (stay stormy, large move), which is 0.02120.02120.0212. The chance that day one is a small move at all is 0.6×0.9+0.4×0.3=0.660.6\times0.9+0.4\times0.3=0.660.6×0.9+0.4×0.3=0.66, and given a small move the chance that day one was calm is 0.54/0.66=0.820.54/0.66=0.820.54/0.66=0.82.
  • An HMM is three things: start probabilities π\piπ, transitions AAA and emission probabilities BBB.
  • Hidden versus seen: the states are never observed, only the emissions are.
  • One observation is evidence, not proof, because every state can produce every outcome.

Lab · what's graded

  • A path and its observations15 pts
  • A small move on day one15 pts
  • Was day one calm?15 pts
  • A large move tomorrow15 pts
  • Generating data from an HMM10 pts
  • Match the parts of an HMM15 pts
  • Why one observation is not proof15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

What is the probability of the hidden path Calm, Stormy, Stormy together with the observations Small, Large, Large, that is 0.6⋅0.9⋅0.1⋅0.7⋅0.8⋅0.70.6\cdot0.9\cdot0.1\cdot0.7\cdot0.8\cdot0.70.6⋅0.9⋅0.1⋅0.7⋅0.8⋅0.7? Give four decimals.

p=p =p=accepted: ± 0.0002
2Numeric answer15 ptsNot answered

What is the probability that day one shows a small move, πCBC(s)+πSBS(s)\pi_CB_C(s)+\pi_SB_S(s)πC​BC​(s)+πS​BS​(s) with 0.6⋅0.9+0.4⋅0.30.6\cdot0.9+0.4\cdot0.30.6⋅0.9+0.4⋅0.3?

p=p =p=accepted: ± 0.005
3Numeric answer15 ptsNot answered

Given a small move on day one, what is the probability that the day was calm, 0.54/0.660.54/0.660.54/0.66? Give three decimals.

p=p =p=accepted: ± 0.003
4Numeric answer15 ptsNot answered

Today is calm. What is the probability that tomorrow shows a large move, ACCBC(g)+ACSBS(g)A_{CC}B_C(g)+A_{CS}B_S(g)ACC​BC​(g)+ACS​BS​(g) with 0.9⋅0.1+0.1⋅0.70.9\cdot0.1+0.1\cdot0.70.9⋅0.1+0.1⋅0.7?

p=p =p=accepted: ± 0.003
5Order the steps10 ptsNot answered

Put the steps of generating one day of data 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. 1Move to tomorrow's state using a row of A
  2. 2Draw today's observation from the row of B
  3. 3Draw the first state from the start probabilities
  4. 4Record the observation and keep the state hidden
6Match15 ptsNot answered

Match each part with its meaning.

Pick the partner of each item on the left.

π\piπ
AAA
BBB
Observation
7Explain in words15 ptsNot answered

In one or two sentences, explain why seeing one large move does not tell you for sure that the market is stormy.

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