σμ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 3 · Limit theorems and transformations›Topic 3.3·~45 minIntermediate

Transformations and change of variables

Skill positionModule 3 of 5 · Topic 3 of 3
3.3 Transformations and change of variables
—Lab score— / 100Total XP—Streak—

New variables from old ones

Finance constantly transforms random variables: prices into returns, returns into log returns, a position into its profit. For a linear change Y=aX+bY=aX+bY=aX+b the rules are exact: E[Y]=aE[X]+bE[Y]=aE[X]+bE[Y]=aE[X]+b and Var⁡(Y)=a2Var⁡(X)\operatorname{Var}(Y)=a^2\operatorname{Var}(X)Var(Y)=a2Var(X), and a normal stays normal. Scaling a return by leverage aaa scales its volatility by ∣a∣|a|∣a∣ and its variance by a2a^2a2; adding a constant shifts the mean and leaves the spread alone.

fY(y)=fX(g−1(y))∣d g−1(y)dy∣,E[g(X)] ≥ g(E[X])f_Y(y)=f_X\big(g^{-1}(y)\big)\left|\frac{d\,g^{-1}(y)}{dy}\right|,\qquad E[g(X)]\ \ge\ g(E[X])fY​(y)=fX​(g−1(y))​dydg−1(y)​​,E[g(X)] ≥ g(E[X])(1)

For a nonlinear transformation Y=g(X)Y=g(X)Y=g(X) you cannot just transform the mean. The density of YYY follows the change-of-variables formula: evaluate fXf_XfX​ at the inverse and multiply by the stretching factor ∣dx/dy∣|dx/dy|∣dx/dy∣. If XXX is normal, Y=eXY=e^{X}Y=eX is lognormal with density fX(ln⁡y)/yf_X(\ln y)/yfX​(lny)/y. Jensen's inequality says that for a convex ggg, E[g(X)]≥g(E[X])E[g(X)]\geq g(E[X])E[g(X)]≥g(E[X]): for example E[eX]>eE[X]E[e^{X}]>e^{E[X]}E[eX]>eE[X] and E[1/X]>1/E[X]E[1/X]>1/E[X]E[1/X]>1/E[X] for a positive non-constant XXX. Averages do not commute with curved functions.

Log returns and Jensen's gapThe log return of a day is r=ln⁡(Pt/Pt−1)r=\ln(P_t/P_{t-1})r=ln(Pt​/Pt−1​). Over several days the gross returns multiply but the log returns add: log returns of +0.05+0.05+0.05 and +0.07+0.07+0.07 give a total of 0.120.120.12, a gross return of e0.12=1.1275e^{0.12}=1.1275e0.12=1.1275, that is +12.75%+12.75\%+12.75%. Now let X∼N(0, 0.04)X\sim N(0,\,0.04)X∼N(0,0.04) be a log return. Then E[X]=0E[X]=0E[X]=0 but E[eX]=e0.02≈1.0202E[e^{X}]=e^{0.02}\approx1.0202E[eX]=e0.02≈1.0202: the expected gross return exceeds eE[X]=1e^{E[X]}=1eE[X]=1 by the Jensen gap σ2/2\sigma^2/2σ2/2.
  • Linear: E[aX+b]=aE[X]+bE[aX+b]=aE[X]+bE[aX+b]=aE[X]+b, Var⁡(aX+b)=a2Var⁡(X)\operatorname{Var}(aX+b)=a^2\operatorname{Var}(X)Var(aX+b)=a2Var(X).
  • Change of variables: fY(y)=fX(g−1(y)) ∣dx/dy∣f_Y(y)=f_X(g^{-1}(y))\,|dx/dy|fY​(y)=fX​(g−1(y))∣dx/dy∣.
  • Log returns add across time; Jensen: E[g(X)]≥g(E[X])E[g(X)]\geq g(E[X])E[g(X)]≥g(E[X]) for convex ggg.
Why an average return is not a compounded returnReturns of +50%+50\%+50% and −50%-50\%−50% average to 0%0\%0%, yet 1.5×0.5=0.751.5\times0.5=0.751.5×0.5=0.75 leaves you with a 25% loss. Averaging works on the log scale: the compounded growth rate is the mean of the log returns, which is lower than the log of the mean return by about σ2/2\sigma^2/2σ2/2. The more volatile an asset, the bigger the drag.

Lab · what's graded

  • A linear change: the mean10 pts
  • A linear change: the variance10 pts
  • Compounding log returns15 pts
  • Jensen's gap15 pts
  • Jensen with a reciprocal15 pts
  • The lognormal density15 pts
  • Why log returns20 pts
0/ 7 answered
Tasks
1Numeric answer10 ptsNot answered

XXX has mean 1 and variance 4. Let Y=3X+2Y=3X+2Y=3X+2. Find E[Y]E[Y]E[Y].

E[Y]=E[Y] =E[Y]=accepted: ± 0.001
2Numeric answer10 ptsNot answered

With the same XXX (variance 4) and Y=3X+2Y=3X+2Y=3X+2, find Var⁡(Y)\operatorname{Var}(Y)Var(Y).

Var⁡(Y)=\operatorname{Var}(Y) =Var(Y)=accepted: ± 0.001
3Numeric answer15 ptsNot answered

Two days have log returns +0.05+0.05+0.05 and +0.07+0.07+0.07. What is the total compounded simple return, in percent? Give it to two decimals.

R=R =R=accepted: ± 0.01
4Numeric answer15 ptsNot answered

A log return is X∼N(0, 0.04)X\sim N(0,\,0.04)X∼N(0,0.04), that is, variance 0.040.040.04. Find E[eX]E[e^{X}]E[eX] using E[eX]=eμ+σ2/2E[e^{X}]=e^{\mu+\sigma^2/2}E[eX]=eμ+σ2/2. Give it to four decimals.

E[eX]=E[e^{X}] =E[eX]=accepted: ± 0.0005
5Choice15 ptsNot answered

XXX is positive and not constant. How do E[1/X]E[1/X]E[1/X] and 1/E[X]1/E[X]1/E[X] compare?

6Fill the blanks15 ptsNot answered

If XXX has density fXf_XfX​ and Y=eXY=e^{X}Y=eX, complete the density of YYY for y>0y>0y>0.

fY(y)=fX()⋅\displaystyle f_Y(y)=f_X(\htmlData{blank=a}{\phantom{\rule[-0.35em]{2.4em}{1.35em}}})\cdot\htmlData{blank=b}{\phantom{\rule[-0.35em]{2.4em}{1.35em}}}fY​(y)=fX​()⋅
7Explain in words20 ptsNot answered

In two sentences, say why log returns are convenient for returns over several periods.

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