[Distribution Genealogy] Student's t distribution, and its relationship with normal distribution and chi-square distribution

Introduction

In 1908, Gossett worked in a winery. Since the winery prohibited employees from publishing wine-related research results, he Studentthought that published research on the t distribution under a pseudonym, so this famous distribution was named Student Distribution.

If there are two independent random variables X , YX,YX,Y , both obey the standard normal distribution and the degree of freedom isν \nuThe chi-square distribution of ν , then XY / ν \frac{X}{\sqrt{Y/\nu}}Y / n Xobeys the t distribution, and its probability density function is

f ( x , ν ) = Γ ( ν + 1 2 ) π ν Γ ( ν 2 ) ( 1 + x 2 ν ) − ν + 1 2 f(x,\nu)=\frac{\Gamma(\frac{ \nu+1}{2})}{\sqrt{\pi\nu}\Gamma(\frac{\nu}{2})}(1+\frac{x^2}{\nu})^{ -\frac{\nu+1}{2}}f(x,n )=p n C (2n)C (2n + 1)(1+nx2)2n + 1

Normal and chi-square distributions

The normal distribution was first obtained by Dimove in the asymptotic formula of the binomial distribution, and it is Gauss's research on measurement errors that really established its status, so it is also called Gauss distribution. Measurement is the basis for human beings to quantitatively understand the natural world. The universality of measurement errors makes the normal distribution have a wide range of application scenarios. Perhaps because of this, the normal distribution occupies a core position in the distribution family tree.

insert image description here

Normal distribution N ( μ , σ ) N(\mu, \sigma)N ( μ ,σ ) subject to expectationμ \muμ and varianceσ 2 \sigma^2p2 regulation, its probability density function is

1 2 π σ 2 exp ⁡ [ − ( x − μ ) 2 2 σ 2 ] \frac{1}{\sqrt{2\pi\sigma^2}}\exp[-\frac{(x-\mu) ^2}{2\sigma^2}]2 p.s _2 1exp[2 p2(xm )2]

μ = 0 \mu=0m=0 andσ = 1 \sigma=1p=When 1 , it is a standard normal distributionN ( 0 , 1 ) N(0,1)N(0,1 ) , the corresponding probability distribution function isΦ ( x ) = 1 2 π exp ⁡ [ − x 2 2 ] \Phi(x)=\frac{1}{\sqrt{2\pi}}\exp[-\frac {x^2}{2}]Φ ( x )=2 p.m 1exp[2x2]

if kkk independent random variablesξ 1 , ξ 2 , ⋯ , ξ k \xi_1, \xi_2,\cdots,\xi_kX1,X2,,Xk, all obey the standard normal distribution, then the sum of squares of these k random variables constitutes a new variable, and the new variable obeys χ 2 \chi^2h2 distribution. Its probability density function is

ρ ( x ) = ( 1 / 2 ) k / 2 Γ ( k / 2 ) xk / 2 − 1 e − x / 2 \rho(x)=\frac{(1/2)^{k/2}} {\Gamma(k/2)}x^{k/2-1}e^{-x/2}p ( x )=C ( k /2 )(1/2)k/2xk /2 1 ex/2

Use scipy to verify the relationship between the three

Next, the student distribution is constructed through the normal distribution and verified

import numpy as np
from scipy.stats import norm, chi2, t
import matplotlib.pyplot as plt

k = 200
X = norm.rvs(size=10000)
Y = chi2(k).rvs(size=10000)
xs = X/(Y/k)
plt.hist(xs, density=True, bins=100, alpha=0.8)

rv = t(k)
st, ed = rv.interval(0.995)
xs = np.linspace(st, ed, 200)
plt.plot(xs, rv.pdf(xs))
plt.show()

The result is as follows

insert image description here
From the perspective of its distribution characteristics, the t distribution is very similar to the normal distribution, and they are all unimodal even functions symmetrical about the origin. When ν → ∞ \nu\to\inftyn , according to the Stirling formula,ttThe t distribution tends to a normal distribution.

Let's test it, for different ν \nuvalue ,

fig = plt.figure()
xs = np.linspace(-5,5,1000)
for i,nu in enumerate([3,10,50,200]):
    ax = fig.add_subplot(2, 2, i+1)
    ax.plot(xs, norm.pdf(xs), label="norm")
    ax.plot(xs, t(nu).pdf(xs), lw=0.5, label="t")
    plt.legend()


plt.show()

The result is shown in the figure

insert image description here

Guess you like

Origin blog.csdn.net/m0_37816922/article/details/130937191