Derivation of the probability density function of F distribution

The derivation process is compiled from https://www.bilibili.com/video/BV1qf4y1R7FA .

Preliminary knowledge

Γ \GammaΓ function (gamma function)

  • 定义: Γ ( s ) = ∫ 0 + ∞ e − t t s − 1 d t \Gamma(s)=\int_{0}^{+\infty}e^{-t}t^{s-1}\text{d}t C ( s )=0+etts1dt
  • Supplementary formula: Γ ( s + 1 ) = s Γ ( s ) , ( s > 0 ) \Gamma(s+1)=s\Gamma(s),\space(s>0)C ( s+1)=sΓ(s), (s>0)
  • Several important values: Γ ( 1 ) = 1 \Gamma(1)=1C ( 1 )=1Γ ( 1 2 ) = π \Gamma(\frac{1}{2})=\sqrt{\pi}C (21)=Pi

standard normal distribution

  • Probability density function: φ ( x ) = 1 2 π e − x 2 2 \varphi(x)=\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2 }}φ ( x )=2 p.m 1e2x2
  • Distribution function: ϕ ( x ) = ∫ − ∞ x 1 2 π e − t 2 2 dt \phi(x)=\int_{-\infty}^{x}\frac{1}{\sqrt{2\pi }}e^{-\frac{t^2}{2}}\text{d}tϕ ( x )=x2 p.m 1e2t2dt

chi-square distribution

  • Probability density function: p ( x ) = { 1 2 n / 2 Γ ( n / 2 ) e − x 2 xn 2 − 1 , x > 0 0 , x ⩽ 0 p(x)=\left\{\begin{ array}{cc} \frac{1}{2^{n/2}\Gamma(n/2)}e^{-\frac{x}{2}}x^{\frac{n}{2} -1}, & x>0 \\ 0, & x\leqslant 0 \end{array}\right.p(x)={ 2n/2Γ(n/2)1e2xx2n1,0,x>0x0

derivation target

已知UUU obeys chi-square distributionχ 2 ( n 1 ) \chi^2(n_1)h2(n1)VVV obeys chi-square distributionχ 2 ( n 2 ) \chi^2(n_2)h2(n2) , andUUUV andVVV are independent of each other.

F = U / n 1 V / n 2 F=\frac{U/n_1}{V/n_2} F=V/n2U/n1The probability density function of .

Lemma: Distribution of Quotients of Continuous Random Variables

( X , Y ) (X,Y)(X,Y ) is a two-dimensional random variable, and its joint density function isp ( x , y ) p(x,y)p(x,y ),则Z = X / YZ=X/YZ=Density functionp Z ( z ) p_{Z}(z) of X / YpZ( z ) satisfyp
Z ( z ) = ∫ − ∞ + ∞ p ( zy , y ) ∣ y ∣ dy 。 p_{Z}(z) = \int_{-\infty}^{+\infty}p(zy , y)|y|\text{d}y \thinspace。pZ(z)=+p(zy,y)ydy.
prove

Using the distribution function method, first find ZZThe distribution function of Z , and then derive the distribution function to getp Z ( z ) p_{Z}(z)pZ(z)

againstzz _The positive and negative nature of z is discussed, and the integral area is obtained as shown in the shaded part in the figure below.

We found that these two cases can be combined, and the integration area is { ( y , x ) ∣ y < 0 ∧ x ⩾ zy } \{(y,x) \space|\space y<0 \space\wedge\space x \geqslant zy\}{ (y,x)  y<0  xzy}   ∪   \space\cup\space    { ( y , x )   ∣   y > 0   ∧   x ⩽ z y } \{(y,x) \space|\space y>0 \space\wedge\space x\leqslant zy\} { (y,x)y  >0  xz y } . So there is
F Z ( z )    =    P ( Z < z )    =    P ( X Y < z )    =    ∫ − ∞ 0 d y ∫ y z + ∞ p ( x , y ) d x + ∫ 0 + ∞ d y ∫ − ∞ y z p ( x , y ) d x = x = u y ∫ − ∞ 0 d y ∫ z + ∞ p ( u y , y ) y d u + ∫ 0 + ∞ d y ∫ − ∞ z p ( u y , y ) y d u    =    ∫ z + ∞ d u ∫ − ∞ 0 p ( u y , y ) y d y + ∫ − ∞ z d u ∫ 0 + ∞ p ( u y , y ) y d y   。 \begin{aligned} F_{Z}(z) &\space\space=\space\space P(Z<z) \\ &\space\space=\space\space P(\frac{X}{Y}<z) \\ &\space\space=\space\space \int_{-\infty}^{0}\text{d}y\int_{yz}^{+\infty}p(x,y)\text{d}x + \int_{0}^{+\infty}\text{d}y\int_{-\infty}^{yz}p(x,y)\text{d}x \\ &\overset{x=uy}{=} \int_{-\infty}^{0}\text{d}y\int_{z}^{+\infty}p(uy,y)y\text{d}u + \int_{0}^{+\infty}\text{d}y\int_{-\infty}^{z}p(uy,y)y\text{d}u \\ &\space\space=\space\space \int_{z}^{+\infty}\text{d}u\int_{-\infty}^{0}p(uy,y)y\text{d}y + \int_{-\infty}^{z}\text{d}u\int_{0}^{+\infty}p(uy,y)y\text{d}y \thinspace。 \end{aligned} FZ(z)  =  P(Z<z)  =  P(YX<z)  =  0dyyz+p(x,y)dx+0+dyyzp(x,y)dx=x = u y0dyz+p ( u y ,the ) the d u+0+dyzp ( u y ,the ) the d u  =  z+of u0p ( u y ,the ) the d the+zof u0+p ( u y ,the ) the d the因此
p Z ( z ) = F Z ′ ( z ) = − ∫ − ∞ 0 p ( z y , y ) y d y + ∫ 0 + ∞ p ( z y , y ) y d y = ∫ − ∞ + ∞ p ( z y , y ) ∣ y ∣ d y   。 \begin{aligned} p_{Z}(z) &= F_{Z}'(z) \\ &= -\int_{-\infty}^{0}p(zy,y)y\text{d}y + \int_{0}^{+\infty}p(zy,y)y\text{d}y \\ &= \int_{-\infty}^{+\infty}p(zy,y)|y|\text{d}y \thinspace。 \end{aligned} pZ(z)=FZ(z)=0p(zy,the ) the d the+0+p(zy,the ) the d the=+p(zy,y)ydy

The derivation process

First calculate X = U / n 1 X=U/n_1X=U/n1Sum Y = V / n2 Y=V/n_2Y=V/n2The probability density function of

Note that X = U / n 1 X=U/n_1X=U/n1Sum Y = V / n2 Y=V/n_2Y=V/n2have a similar structure. We just need to calculate XXThe probability density function of X , you can use the same method to getYYThe probability density function of Y.

with nnn independent and identically distributed random variablesZ 1 , Z 2 , ⋯ , Z n Z_1,Z_2,\cdots,Z_nZ1,Z2,,Zn, they all obey the standard normal distribution N ( 0 , 1 ) N(0,1)N(0,1),则 Z = ∑ i = 1 n Z i 2 Z=\sum\limits_{i=1}^{n}Z_i^2 Z=i=1nZi2Subject to chi-square distribution χ 2 ( n ) \chi^2(n)h2 (n). We next use the distribution function method to calculateW = Z / n W=Z/nW=Probability density functionp W ( w ) p_{W}(w) of Z / npW(w)

w ⩽ 0 w\leqslant 0 wAt 0 , becauseW = Z / n = ( ∑ i = 1 n Z i 2 ) / n W=Z/n=(\sum\limits_{i=1}^{n}Z_i^2)/nW=Z/n=(i=1nZi2) / n is always non-negative, soP ( W < w ) = 0 P(W<w)=0P(W<w)=0 , sop W ( w ) = 0 p_{W}(w)=0pW(w)=0 . Below forw > 0 w>0w>0 is calculated.
FW ( w ) = P ( W < w ) = P ( Z < nw ) = ∫ 0 nw 1 2 n / 2 Γ ( n / 2 ) e − x 2 xn 2 − 1 dx . \begin{aligned} F_{W}(w) &= P(W<w) \\ &= P(Z<nw) \\ &= \int_{0}^{nw}\frac{1}{2 ^{n/2}\Gamma(n/2)}e^{-\frac{x}{2}}x^{\frac{n}{2}-1}\text{d}x \thinspace. \end{aligned}FW(w)=P(W<w)=P(Z<nw)=0nw2n/2Γ(n/2)1e2xx2n1dxForm
p W ( w ) = FW ′ ( w ) = 1 2 n/2 Γ ( n / 2 ) e − nw 2 ( nw ) n 2 − 1 ⋅ n = 1 2 n / 2 Γ ( n / 2 ) ) nn 2 e − nw 2 wn 2 − 1 。 \begin {aligned} p_{W}(w) &= F_{W}'(w) \\ &= \frac{1}{2^{n/2 }\Gamma(n/2)}e^{-\frac{nw}{2}}(nw)^{\frac{n}{2}-1}\cdot n \\ &= \frac{1} {2^{n/2}\Gamma(n/2)}n^{\frac{n}{2}} e^{-\frac{nw}{2}}w^{\frac{n}{ 2}-1} \thinspace。 \end{aligned}pW(w)=FW(w)=2n/2Γ(n/2)1e2nw(nw)2n1n=2n/2Γ(n/2)1n2ne2nww2n1
综上,有
p W ( w ) = { 1 2 n / 2 Γ ( n / 2 ) n n 2 e − n w 2 w n 2 − 1 , w > 0 0 , w ⩽ 0   。 p_{W}(w) = \left\{\begin{array}{cc} \frac{1}{2^{n/2}\Gamma(n/2)}n^{\frac{n}{2}} e^{-\frac{nw}{2}}w^{\frac{n}{2}-1}, & w>0 \\ 0, & w\leqslant 0 \end{array}\right. \thinspace。 pW(w)={ 2n/2Γ(n/2)1n2ne2nww2n1,0,w>0w0

因此
p X ( x ) = { 1 2 n 1 / 2 Γ ( n 1 / 2 ) n 1 n 1 2 e − n 1 x 2 x n 1 2 − 1 , x > 0 0 , x ⩽ 0   , p_{X}(x) = \left\{\begin{array}{cc} \frac{1}{2^{n_1/2}\Gamma(n_1/2)}n_1^{\frac{n_1}{2}} e^{-\frac{n_1x}{2}}x^{\frac{n_1}{2}-1}, & x>0 \\ 0, & x\leqslant 0 \end{array}\right. \thinspace, pX(x)={ 2n1/2Γ(n1/2)1n12n1e2n1xx2n11,0,x>0x0

p Y ( y ) = { 1 2 n 2 / 2 Γ ( n 2 / 2 ) n 2 n 2 2 e − n 2 y 2 yn 2 2 − 1 , y > 0 0 , y ⩽ 0 。 p_{Y} (y) = \left\{\begin{array}{cc} \frac{1}{2^{n_2/2}\Gamma(n_2/2)}n_2^{\frac{n_2}{2}}e ^{-\frac{n_2y}{2}}y^{\frac{n_2}{2}-1}, & y>0 \\ 0, & y\leqslant 0 \end{array}\right. \thinspace。pY(y)={ 2n2/2Γ(n2/2)1n22n2e2n2yy2n21,0,y>0y0

Then calculate F = XYF=\frac{X}{Y}F=YXProbability density function p F ( t ) p_{F}(t)pF(t)

t ⩽ 0 t\leqslant 0 t0 , becauseX = U / n 1 X=U/n_1X=U/n1Sum Y = V / n2 Y=V/n_2Y=V/n2Constantly non-negative, so P ( F < t ) = P ( XY < t ) = 0 P(F<t)=P(\frac{X}{Y}<t)=0P(F<t)=P(YX<t)=0 , sop F ( t ) = 0 p_{F}(t)=0pF(t)=0 . Below fort > 0 t>0t>0 is calculated.

Cause UUUV andVVV are independent of each other, soX = U / n 1 X=U/n_1X=U/n1Given Y = V / n 2 Y=V/n_2Y=V/n2are also independent of each other, so ( X , Y ) (X,Y)(X,Y ) joint probability density functionp ( x , y ) p(x,y)p(x,y)满足
p ( x , y ) = p X ( x ) p Y ( y )   。 p(x,y) = p_{X}(x)p_{Y}(y) \thinspace。 p(x,y)=pX(x)pY(y). Then by the lemma, we have
p F ( t )   =   ∫ − ∞ + ∞ p ( t y , y ) ∣ y ∣ d y   =   ∫ − ∞ + ∞ p X ( t y ) p Y ( y ) ∣ y ∣ d y   =   ∫ 0 + ∞ p X ( t y ) p Y ( y ) y d y   =   ∫ 0 + ∞ 1 2 n 1 / 2 Γ ( n 1 / 2 ) n 1 n 1 2 e − n 1 t y 2 ( t y ) n 1 2 − 1 ⋅ 1 2 n 2 / 2 Γ ( n 2 / 2 ) n 2 n 2 2 e − n 2 y 2 y n 2 2 − 1 ⋅ y d y   =   1 2 ( n 1 + n 2 ) / 2 Γ ( n 1 / 2 ) Γ ( n 2 / 2 ) n 1 n 1 2 n 2 n 2 2 t n 1 2 − 1 ∫ 0 + ∞ e − n 1 t + n 2 2 y y n 1 + n 2 2 − 1 d y = y = 2 z n 1 t + n 2 1 2 ( n 1 + n 2 ) / 2 Γ ( n 1 / 2 ) Γ ( n 2 / 2 ) n 1 n 1 2 n 2 n 2 2 t n 1 2 − 1 ⋅ ( 2 n 1 t + n 2 ) n 1 + n 2 2 ∫ 0 + ∞ e − z z n 1 + n 2 2 − 1 d z   =   Γ [ ( n 1 + n 2 ) / 2 ] Γ ( n 1 / 2 ) Γ ( n 2 / 2 ) n 1 n 1 2 n 2 n 2 2 t n 1 2 − 1 ( n 1 t + n 2 ) − n 1 + n 2 2   =   Γ [ ( n 1 + n 2 ) / 2 ] Γ ( n 1 / 2 ) Γ ( n 2 / 2 ) ( n 1 n 2 ) n 1 2 t n 1 2 − 1 ( 1 + n 1 n 2 t ) − n 1 + n 2 2   。 \begin{aligned} p_{F}(t) &\quad\,=\quad\, \int_{-\infty}^{+\infty}p(ty, y)|y|\text{d}y \\ &\quad\,=\quad\, \int_{-\infty}^{+\infty}p_{X}(ty)p_{Y}(y)|y|\text{d}y \\ &\quad\,=\quad\, \int_{0}^{+\infty}p_{X}(ty)p_{Y}(y)y\text{d}y \\ &\quad\,=\quad\, \int_{0}^{+\infty}\frac{1}{2^{n_1/2}\Gamma(n_1/2)}n_1^{\frac{n_1}{2}} e^{-\frac{n_1ty}{2}}(ty)^{\frac{n_1}{2}-1}\cdot \frac{1}{2^{n_2/2}\Gamma(n_2/2)}n_2^{\frac{n_2}{2}} e^{-\frac{n_2y}{2}}y^{\frac{n_2}{2}-1}\cdot y\text{d}y \\ &\quad\,=\quad\, \frac{1}{2^{(n_1+n_2)/2}\Gamma(n_1/2)\Gamma(n_2/2)}n_1^{\frac{n_1}{2}}n_2^{\frac{n_2}{2}}t^{\frac{n_1}{2}-1} \int_{0}^{+\infty}e^{-\frac{n_1t+n_2}{2}y}y^{\frac{n_1+n_2}{2}-1}\text{d}y \\ &\overset{y=\frac{2z}{n_1t+n_2}}{=} \frac{1}{2^{(n_1+n_2)/2}\Gamma(n_1/2)\Gamma(n_2/2)} n_1^{\frac{n_1}{2}}n_2^{\frac{n_2}{2}} t^{\frac{n_1}{2}-1}\cdot (\frac{2}{n_1t+n_2})^{\frac{n_1+n_2}{2}} \int_{0}^{+\infty}e^{-z}z^{\frac{n_1+n_2}{2}-1}\text{d}z \\ &\quad\,=\quad\, \frac{\Gamma[(n_1+n_2)/2]}{\Gamma(n_1/2)\Gamma(n_2/2)}n_1^{\frac{n_1}{2}}n_2^{\frac{n_2}{2}} t^{\frac{n_1}{2}-1} (n_1t+n_2)^{-\frac{n_1+n_2}{2}} \\ &\quad\,=\quad\, \frac{\Gamma[(n_1+n_2)/2]}{\Gamma(n_1/2)\Gamma(n_2/2)}(\frac{n_1}{n_2})^{\frac{n_1}{2}} t^{\frac{n_1}{2}-1} (1+\frac{n_1}{n_2}t)^{-\frac{n_1+n_2}{2}} \thinspace。 \end{aligned} pF(t)=+p ( y , _y)ydy=+pX( t y ) pY(y)ydy=0+pX( t y ) pY( the ) the d the=0+2n1/2Γ(n1/2)1n12n1e2n1ty(ty)2n112n2/2Γ(n2/2)1n22n2e2n2yy2n21the d y=2(n1+n2)/2Γ(n1/ 2 ) C ( n2/2)1n12n1n22n2t2n110+e2n1t+n2yy2n1+n21dy=y=n1t+n22z _2(n1+n2)/2Γ(n1/ 2 ) C ( n2/2)1n12n1n22n2t2n11(n1t+n22)2n1+n20+ezz2n1+n21dz=C ( n1/ 2 ) C ( n2/2)C [ ( n1+n2)/2]n12n1n22n2t2n11(n1t+n2)2n1+n2=C ( n1/ 2 ) C ( n2/2)C [ ( n1+n2)/2](n2n1)2n1t2n11(1+n2n1t)2n1+n2综上,我们得到
p F ( t ) = { Γ [ ( n 1 + n 2 ) / 2 ] Γ ( n 1 / 2 ) Γ ( n 2 / 2 ) ( n 1 n 2 ) n 1 2 t n 1 2 − 1 ( 1 + n 1 n 2 t ) − n 1 + n 2 2 , t > 0 0 , t ⩽ 0   。 p_{F}(t) = \left\{\begin{array}{cc} \frac{\Gamma[(n_1+n_2)/2]}{\Gamma(n_1/2)\Gamma(n_2/2)}(\frac{n_1}{n_2})^{\frac{n_1}{2}} t^{\frac{n_1}{2}-1} (1+\frac{n_1}{n_2}t)^{-\frac{n_1+n_2}{2}}, & t>0 \\ 0, & t\leqslant 0 \end{array}\right. \thinspace。 pF(t)={ C ( n1/ 2 ) C ( n2/2)C [ ( n1+n2)/2](n2n1)2n1t2n11(1+n2n1t)2n1+n2,0,t>0t0

Guess you like

Origin blog.csdn.net/Qmj2333333/article/details/125121901