σμ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
  • 日本語
  • 中文
Probability skill›Module 5 · Dependence and real tails›Topic 5.1·~55 minIntermediate

Markov chains

Skill positionModule 5 of 5 · Topic 1 of 3
5.1 Markov chains
—Lab score— / 100Total XP—Streak—

A process with a one-step memory

A Markov chain moves between a finite set of states, and the next state depends only on the current one: P(Xt+1=j∣Xt=i, earlier history)=PijP(X_{t+1}=j\mid X_t=i,\ \text{earlier history})=P_{ij}P(Xt+1​=j∣Xt​=i, earlier history)=Pij​. The whole model is the transition matrix PPP, whose rows are probability distributions (each row sums to 1). Markets are often described as switching between regimes such as calm and turbulent, or bull and bear, and a Markov chain is the simplest model of that switching.

P(n)=Pn,πP=π,∑iπi=1P^{(n)}=P^{n},\qquad \boldsymbol\pi P=\boldsymbol\pi,\qquad \sum_i\pi_i=1P(n)=Pn,πP=π,i∑​πi​=1(1)

The nnn-step transition probabilities are the entries of the matrix power PnP^{n}Pn, which is matrix multiplication of the previous linear algebra topics at work. A stationary distribution π\boldsymbol\piπ satisfies πP=π\boldsymbol\pi P=\boldsymbol\piπP=π: if the chain starts with it, it keeps it forever. For a chain in which every state can reach every other (irreducible) and that does not cycle with a fixed period (aperiodic), the stationary distribution is unique and the chain converges to it from any start; πi\pi_iπi​ is the long-run fraction of time spent in state iii. The time spent in a state before leaving is geometric with mean 1/(1−Pii)1/(1-P_{ii})1/(1−Pii​).

A bull and bear marketLet the daily state be bull (B) or bear (R) with P=(0.90.10.20.8)P=\begin{pmatrix}0.9&0.1\\0.2&0.8\end{pmatrix}P=(0.90.2​0.10.8​). Two days ahead, P2=(0.830.170.340.66)P^2=\begin{pmatrix}0.83&0.17\\0.34&0.66\end{pmatrix}P2=(0.830.34​0.170.66​): starting in a bull market, the chance of a bear market two days later is 0.17. The stationary distribution solves 0.1πB=0.2πR0.1\pi_B=0.2\pi_R0.1πB​=0.2πR​, so π=(2/3, 1/3)\boldsymbol\pi=(2/3,\ 1/3)π=(2/3, 1/3): in the long run the market spends two thirds of the time in the bull state. A bull regime lasts on average 1/(1−0.9)=101/(1-0.9)=101/(1−0.9)=10 days.
  • Markov property: the next state depends only on the current state.
  • nnn steps: use PnP^{n}Pn. Stationary: solve πP=π\boldsymbol\pi P=\boldsymbol\piπP=π with the entries adding to 1.
  • Duration: a state with self-transition ppp lasts 1/(1−p)1/(1-p)1/(1−p) steps on average.
Regimes are modelled, not observedA real market never announces its regime. A fitted Markov chain gives you probabilities of switching, but you must infer the current regime from returns. When the state is hidden, the model becomes a hidden Markov model, treated in a later skill. Estimated transition probabilities are themselves noisy, so durations such as 10 days carry wide uncertainty.

Lab · what's graded

  • Two-day transitions20 pts
  • The stationary distribution15 pts
  • How long a regime lasts15 pts
  • From bull to bear in two days10 pts
  • The Markov property15 pts
  • When it converges10 pts
  • What the stationary distribution means15 pts
0/ 7 answered
Tasks
1Matrix · vector20 ptsNot answered

A market has daily states bull and bear with transition matrix P=(0.90.10.20.8)P=\begin{pmatrix}0.9&0.1\\0.2&0.8\end{pmatrix}P=(0.90.2​0.10.8​) (row 1: from bull, row 2: from bear). Fill in the two-day transition matrix P2P^2P2.

P2=P^2 =P2=
2Numeric answer15 ptsNot answered

A market has daily states bull and bear with transition matrix P=(0.90.10.20.8)P=\begin{pmatrix}0.9&0.1\\0.2&0.8\end{pmatrix}P=(0.90.2​0.10.8​) (row 1: from bull, row 2: from bear). Find the stationary probability πB\pi_BπB​ of the bull state. Give it to four decimals.

πB=\pi_B =πB​=accepted: ± 0.001
3Numeric answer15 ptsNot answered

A market has daily states bull and bear with transition matrix P=(0.90.10.20.8)P=\begin{pmatrix}0.9&0.1\\0.2&0.8\end{pmatrix}P=(0.90.2​0.10.8​) (row 1: from bull, row 2: from bear). What is the expected number of consecutive days a bull regime lasts once it has started?

T=T =T=accepted: ± 0.001
4Numeric answer10 ptsNot answered

A market has daily states bull and bear with transition matrix P=(0.90.10.20.8)P=\begin{pmatrix}0.9&0.1\\0.2&0.8\end{pmatrix}P=(0.90.2​0.10.8​) (row 1: from bull, row 2: from bear). Today is a bull day. What is the probability that the market is in the bear state two days from now? Give it to two decimals.

P=P =P=accepted: ± 0.005
5Choice15 ptsNot answered

What does the Markov property say?

6Choice10 ptsNot answered

Select the conditions that guarantee a finite chain converges to a unique stationary distribution.

7Explain in words15 ptsNot answered

In two sentences, say what the stationary distribution of a regime chain tells you.

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