SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 5.4.1 Densities, distribution functions and the uniform distributionConcept · 30 min
      2. 5.4.2 The exponential distributionConcept · 25 min
      3. 5.4.3 The normal distributionConcept · 30 min
      4. 5.4.4 The lognormal, Student t and chi-squared distributionsConcept · 30 min
      5. 5.4.5 Practice set: continuous distributionsPractice set · 25 min
      6. 5.4.6 Case study: lognormal prices and fat-tailed returnsCase study · 35 min

Level 5, Probability and statistics 5.4 Continuous distributions Lesson 4 of 6

ConceptLesson 5.4.4 in Level 5, Probability and statistics. About 30 minutes.

The lognormal, Student t and chi-squared distributions

The lognormal distribution

Take a normal variable Y∼N(μ,σ2)Y \sim \mathcal{N}(\mu, \sigma^2) and exponentiate it. X=eYX = e^Y is lognormal: its log, ln⁡X=Y\ln X = Y, is normal. Since ey>0e^y > 0 for every yy (lesson 1.4.1), a lognormal variable is always positive.

Rule: Lognormal distribution

X=eY,Y∼N(μ,σ2)P(X≤x)=N(ln⁡x−μσ)xp=eμ+σzp\begin{gathered} X = e^Y, \quad Y \sim \mathcal{N}(\mu, \sigma^2) \\[4pt] P(X \le x) = N\left(\frac{\ln x - \mu}{\sigma}\right) \\[4pt] x_p = e^{\mu + \sigma z_p} \end{gathered}

For x>0x > 0. μ\mu and σ\sigma are the mean and standard deviation of ln⁡X\ln X, not of XX. ln⁡\ln keeps order, so X≤xX \le x exactly when Y≤ln⁡xY \le \ln x, and the quantiles of XX are ee to the quantiles of YY.

The median is ez0.5e^{z_{0.5}} with z0.5=0z_{0.5} = 0, so it is eμe^\mu. Take μ=0\mu = 0 and σ=0.5\sigma = 0.5: the median is 1, and P(X>2)=N(−ln⁡20.5)=N(−1.3863)≈0.082829P(X > 2) = N\left(-\frac{\ln 2}{0.5}\right) = N(-1.3863) \approx 0.082829.

The 0.05- and 0.95-quantiles are e∓0.5×1.644854e^{\mp 0.5 \times 1.644854}, about 0.439364 and 2.276017. They are not equally far from the median 1, but they are the same factor away: 1÷2.276017≈0.4393641 \div 2.276017 \approx 0.439364. On the log scale the distribution is symmetric; on the original scale it stretches out to the right.

The mean is above the median

Rule: Lognormal mean and variance

E[X]=eμ+σ2/2Var⁡(X)=(eσ2−1)e2μ+σ2\begin{gathered} \mathbb{E}[X] = e^{\mu + \sigma^2/2} \\[4pt] \operatorname{Var}(X) = \left(e^{\sigma^2} - 1\right)e^{2\mu + \sigma^2} \end{gathered}

Stated here; case study 5.6.5 derives both from the normal's moment generating function. The mean is the median eμe^\mu times eσ2/2>1e^{\sigma^2/2} > 1: rare large values pull it up.

E[X]=eμ\mathbb{E}[X] = e^{\mu} would be the natural guess, but E[eY]≠eE[Y]\mathbb{E}[e^Y] \ne e^{\mathbb{E}[Y]}, as lesson 5.3.1 warned for any curved gg. With μ=0\mu = 0, the gap grows quickly with σ\sigma:

σ\sigma0.10.511.5
median eμe^\mu1111
mean eσ2/2e^{\sigma^2/2}1.0051.13311.64873.0802
P(X>mean)=N(−σ/2)P(X > \text{mean}) = N(-\sigma/2)0.48010.40130.30850.2266

With σ=1.5\sigma = 1.5, the mean is three times the median, and fewer than a quarter of the values exceed it.

Products stay lognormal. If X1X_1 and X2X_2 are independent lognormals, ln⁡(X1X2)=ln⁡X1+ln⁡X2\ln(X_1X_2) = \ln X_1 + \ln X_2 is a sum of independent normals, which is normal (lesson 5.4.3). So X1X2X_1X_2 is lognormal, with the means and the variances of the logs added. Quantities that grow by multiplying, such as prices, are where the lognormal fits; case study 5.4.6 uses it there.

Raise σ\sigma and watch the dashed mean pull away to the right of the median, eμe^\mu. Then switch to the Student t and the chi-squared, the other two distributions of this lesson.

Explore

The curve is a density: probabilities are areas under it. Change the parameters, then set an interval and read the shaded area.

0123400.51

The dashed line is the mean.

Probability
P(0.61 ≤ X ≤ 1.65) = 0.6827
Mean
1.1331
Variance
0.3647, so the standard deviation is 0.6039

Try it

SciPy's lognorm takes s =σ= \sigma and scale =eμ= e^\mu, the median. Its density is φ(z)σx\frac{\varphi(z)}{\sigma x} with z=ln⁡x−μσz = \frac{\ln x - \mu}{\sigma}; lesson 5.6.1 shows where the xx in the denominator comes from.

The last lines draw a million values of eYe^Y in one seeded run. The mean, the median and the share above 2 land near 1.1331, 1 and 0.0828.

⌘/Ctrl + Enter runs the cell

The Student t distribution

The Student t distribution with ν\nu (nu) degrees of freedom is a bell centred at 0, like the standard normal. It has more probability far out, because its density is a power, not an exponential:

f(t)=cν(1+t2ν)−(ν+1)/2f(t) = c_\nu \left(1 + \frac{t^2}{\nu}\right)^{-(\nu + 1)/2}

Here cνc_\nu is the normalising constant of lesson 5.4.1, which depends on ν>0\nu > 0. Far out, f(t)f(t) shrinks like the power 1∣t∣ν+1\frac{1}{|t|^{\nu + 1}}, much more slowly than the normal's e−t2/2e^{-t^2/2}. Data with more extreme values than a normal of the same variance are said to have fat tails.

Rule: Student t

E[T]=0 for ν>1Var⁡(T)=νν−2 for ν>2ν→∞: T→N(0,1)\begin{gathered} \mathbb{E}[T] = 0 \text{ for } \nu > 1 \\[4pt] \operatorname{Var}(T) = \frac{\nu}{\nu - 2} \text{ for } \nu > 2 \\[4pt] \nu \to \infty: \ T \to \mathcal{N}(0, 1) \end{gathered}

The variance is above 1, and it is infinite for ν≤2\nu \le 2. The excess kurtosis is 6ν−4\frac{6}{\nu - 4} for ν>4\nu > 4, and infinite for ν≤4\nu \le 4. With 30 or more degrees of freedom the t is close to the normal.

The tails decide which moments exist, exactly as for the power tails of lesson 2.6.3. With ν=1\nu = 1 the density falls like 1t2\frac{1}{t^2}, so t f(t)t\,f(t) falls like 1t\frac{1}{t}, whose tail integral diverges.

That t, also called the Cauchy distribution, has no mean. Its half-mean ∫0bt f(t) dt\int_0^b t\,f(t)\,dt reaches 0.7345, 1.4659 and 2.1988 at bb = 10, 100 and 1000, and keeps climbing like a log.

ν\nu1241030normal
P(∣T∣>3)P(\lvert T\rvert > 3)0.204830.095470.039940.013340.005390.0027
0.975-quantile12.7064.3032.7762.2282.0421.960

A t with 4 degrees of freedom lands beyond 3 about 15 times as often as a normal. Its 0.975-quantile is 2.776 instead of 1.96, which is why intervals from small samples are wider (lesson 5.8.2).

Part of that gap is the larger variance, 42=2\frac{4}{2} = 2. Scaled to variance 1, the t still has fatter tails than the normal; case study 5.4.6 makes that comparison on return data.

The standard normal against two Student t distributions: alike near the centre, they part in the tails. On a log scale, at x=4x = 4 the t with 4 degrees of freedom has 255 times the normal's tail.

Try it

t(df) is the Student t in SciPy. The loop prints the table: the two-sided tail beyond 3, the 0.975-quantile, the variance and the excess kurtosis. SciPy gives inf or nan for a moment that does not exist.

The next line compares the tails of ν=4\nu = 4 and the normal beyond 3 and beyond 4. The last loop is the Cauchy's half-mean ∫0bt f(t) dt\int_0^b t\,f(t)\,dt, by quad, growing without limit.

⌘/Ctrl + Enter runs the cell

The chi-squared distribution

Square kk independent standard normals and add them up. The sum V=Z12+⋯+Zk2V = Z_1^2 + \cdots + Z_k^2 has the chi-squared distribution with kk degrees of freedom, written χk2\chi^2_k (chi is the Greek letter χ\chi).

Rule: Chi-squared

V=Z12+⋯+Zk2∼χk2E[V]=k,Var⁡(V)=2k\begin{gathered} V = Z_1^2 + \cdots + Z_k^2 \sim \chi^2_k \\[4pt] \mathbb{E}[V] = k, \quad \operatorname{Var}(V) = 2k \end{gathered}

V≥0V \ge 0, and its density is skewed to the right. For large kk the shape is close to a normal.

Each Zi2Z_i^2 has mean E[Z2]=1\mathbb{E}[Z^2] = 1. Its variance is E[Z4]−1=3−1=2\mathbb{E}[Z^4] - 1 = 3 - 1 = 2, since the normal's kurtosis is 3 (lesson 5.4.3). For independent terms means and variances add (lesson 5.3.2), giving kk and 2k2k.

Two small cases link it to earlier lessons.

  • One degree of freedom. Z2≤1Z^2 \le 1 exactly when ∣Z∣≤1|Z| \le 1, so P(V≤1)=0.682689P(V \le 1) = 0.682689: the 68% of lesson 5.4.3.
  • Two degrees of freedom. χ22\chi^2_2 is the exponential of lesson 5.4.2 with mean 2, that is λ=12\lambda = \frac{1}{2}. So P(V>3)=e−1.5≈0.22313P(V > 3) = e^{-1.5} \approx 0.22313.

The 0.95-quantiles are 3.841, 5.991, 7.815 and 18.307 for kk = 1, 2, 3 and 10. The first is z0.9752=1.9599642z_{0.975}^2 = 1.959964^2: 95% of the time ∣Z∣<1.96|Z| < 1.96.

The t from a normal and a chi-squared

The t is built from the other two. Take ZZ standard normal and V∼χν2V \sim \chi^2_\nu, independent of ZZ. Then

T=ZV/νT = \frac{Z}{\sqrt{V/\nu}}

has the t distribution with ν\nu degrees of freedom. V/νV/\nu has mean 1, so TT is ZZ divided by a random number near 1. Now and then that number is small, which makes TT large: those are the fat tails.

Lesson 5.8.2 meets this ratio when the standard deviation of a sample is estimated rather than known. Module 5.8 also uses χ2\chi^2 for the spread of sample variances.

Try it

chi2(k) is χk2\chi^2_k in SciPy. The first lines check the two small cases and the 0.95-quantiles.

Then two seeded simulations. Sums of 3 squared normals have mean, variance and share above 7.815 near 3, 6 and 0.05. The ratio TT with ν=4\nu = 4 matches t(4).

⌘/Ctrl + Enter runs the cell

Where each is used

distributionbuilt fromvaluesused for
lognormaleYe^Y, YY normalpositiveprices and other quantities that grow by multiplying
Student tZ/V/νZ / \sqrt{V/\nu}any realsmall samples; fat-tailed data such as daily returns
chi-squaredZ12+⋯+Zk2Z_1^2 + \cdots + Z_k^20 or moresample variances and tests

Case study 5.4.6 models prices as lognormal and compares daily returns with the normal and the t. Case study 5.9.4 fits a t to the same returns.

Common mistakes

  1. The lognormal's μ\mu and σ\sigma belong to ln⁡X\ln X. The median is eμe^\mu; the mean is eμ+σ2/2e^{\mu + \sigma^2/2}, not eμe^\mu.
  2. Most lognormal values fall below the mean. P(X>mean)=N(−σ/2)P(X > \text{mean}) = N(-\sigma/2) is under one half.
  3. SciPy's lognorm takes s =σ= \sigma and scale =eμ= e^\mu, not scale =μ= \mu.
  4. A t's variance is νν−2\frac{\nu}{\nu - 2}, not 1. Compare tails at the same variance before calling them fat.
  5. Some t's have no variance, or no mean. For ν≤2\nu \le 2 the variance is infinite; for ν=1\nu = 1 there is no mean.
  6. Chi-squared needs standard normals. Squares of N(0,σ2)\mathcal{N}(0, \sigma^2) variables add to σ2\sigma^2 times a χ2\chi^2.

The lognormal, Student t and chi-squared distributions

0 of 12 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
  11. 11.
  12. 12.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • Lognormal: X=eYX = e^Y with Y∼N(μ,σ2)Y \sim \mathcal{N}(\mu, \sigma^2). P(X≤x)=N(ln⁡x−μσ)P(X \le x) = N\left(\frac{\ln x - \mu}{\sigma}\right), median eμe^\mu, mean eμ+σ2/2e^{\mu + \sigma^2/2}. Positive and skewed right; products of independent lognormals are lognormal. SciPy: lognorm(s=sigma, scale=exp(mu)).
  • Student t with ν\nu degrees of freedom: a bell with power tails, variance νν−2\frac{\nu}{\nu - 2} for ν>2\nu > 2, no mean for ν=1\nu = 1, the normal as ν→∞\nu \to \infty. SciPy: t(nu).
  • Chi-squared with kk degrees of freedom: Z12+⋯+Zk2Z_1^2 + \cdots + Z_k^2, mean kk, variance 2k2k; χ22\chi^2_2 is the exponential with mean 2. SciPy: chi2(k).
  • T=ZV/νT = \frac{Z}{\sqrt{V/\nu}} with V∼χν2V \sim \chi^2_\nu independent of ZZ is a t with ν\nu degrees of freedom.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.