Some distributions

Introduction of some distribution

random variable

probability density function

For continous variable x:

E(x)=xf(x)dx=xdF(x)E(x) = \int xf(x)dx = \int x dF(x)

For discrete variable x:

E(x)=xipiE(x)=\sum x_i p_i

Variance:

Var(x)=E(x2)(E(x))2Var(x) = E(x^2)-(E(x))^2

Binomial distribution

For example, flip a coin for 5 times, define random variable X as number of heads after 5 flips. The probability is defined as:

p(X=n)=5!n!(5n)!=C5np(X=n)=\frac{5!}{n!(5-n)!}=C_5^n

The general probability is

p(X=k)=n!k!(nk)!=Cnkp(X=k)=\frac{n!}{k!(n-k)!}=C_n^k

And the

E(X)=np=k=0nkCnkpk(1p)nkE(X) = np=\sum_{k=0}^{n}kC_n^kp^k(1-p)^{n-k}

The term for k=0k=0 is 0, hence it can be rewrite as

E(X)=k=1nkCnkpk(1p)nkE(X) =\sum_{k=1}^{n}kC_n^kp^k(1-p)^{n-k}

Then

E(x)=k=1nkn!k!(nk)!pk(1p)(nk)=k=1nkn(n1)!k(k1)!(nk)!ppk1(1p)(nk)=npk=1n(n1)!(k1)!(nk)!pk1(1p)(nk)\begin{aligned} E(x) &= \sum_{k=1}^{n}k\frac{n!}{k!(n-k)!}p^k(1-p)^{(n-k)} \\ &= \sum_{k=1}^{n}k\frac{n(n-1)!}{k(k-1)!(n-k)!}p p^{k-1}(1-p)^{(n-k)} \\ &= np\sum_{k=1}^{n}\frac{(n-1)!}{(k-1)!(n-k)!}p^{k-1}(1-p)^{(n-k)} \end{aligned}

Let a=k1a = k-1, b=n1b=n-1 k=a+1,n=b+1\Rightarrow k=a+1, n=b+1

E(x)=npk=1n(n1)!(k1)!(nk)!pk1(1p)(nk)=npa=0bb!a!(bn)!pa(1p)(ba)\begin{aligned} E(x)&= np\sum_{k=1}^{n}\frac{(n-1)!}{(k-1)!(n-k)!}p^{k-1}(1-p)^{(n-k)} \\ &= np\sum_{a=0}^{b}\frac{b!}{a!(b-n)!}p^{a}(1-p)^{(b-a)} \end{aligned}

Where a=0bb!a!(bn)!pa(1p)(ba)\sum_{a=0}^{b}\frac{b!}{a!(b-n)!}p^{a}(1-p)^{(b-a)} is the sum of all the probabilities which equals to 1.

Hence the E(x)E(x) is npnp

Poisson distribution

For example, we want to know X = how many car pass in an hour. Assume the car is randomly pass on the road.

Say E(X)=λ=npE(X) = \lambda = np, where λ\lambda has unit cars/hour 60min/hourλ60cars/min\Rightarrow 60min/hour \frac{\lambda}{60} cars/min

Hence the probability can be written as whether there is a car pass in that minute which follows binomial distribution

p(X=k)=C60k(λ60)k(1λ60)60kp(X=k)=C_{60}^k(\frac{\lambda}{60})^k(1-\frac{\lambda}{60})^{60-k}

But the question is if there are more than 1 car pass in a minute, how do we deal with it? The most straight way is to set minutes into second

p(X=k)=C3600k(λ3600)k(1λ3600)3600kp(X=k) =C_{3600}^k(\frac{\lambda}{3600})^k(1-\frac{\lambda}{3600})^{3600-k}

As we know

limxinf(1+ax)x=ea\lim_{x\rightarrow \inf}(1+\frac{a}{x})^x=e^a

The proof is let 1/n=a/x,x=na1/n = a/x, x= na . Then rewrite as:

limn(1+1n)na=limn((1+1n)n)a=ea\begin{aligned} & \lim_{n\rightarrow \infty}(1+\frac{1}{n})^{na} \\ &=\lim_{n\rightarrow \infty}((1+\frac{1}{n})^{n})^a \\ &= e^a \end{aligned}

Then as we increased nn . The probability can be written as

p(X=k)=limnCnk(λn)k(1λn)nk=limnn!(nk)!k!λknk(1λn)n(1λn)k=limnn(n1)...1(nk)(nk1)...1λkk!limn(1λn)n(1λn)k=limnnk...(nk...)λkk!limn(1λn)n(1λn)k=1λkk!eλ1\begin{aligned} p(X=k) &=\lim_{n\rightarrow \infty} C_{n}^k(\frac{\lambda}{n})^k(1-\frac{\lambda}{n})^{n-k} \\ &= \lim_{n\to \infty} \frac{n!}{(n-k)!k!} \frac{\lambda ^k}{n^k} (1-\frac{\lambda}{n})^{n} (1-\frac{\lambda}{n})^{-k} \\ &= \lim_{n \to \infty} \frac{n(n-1)...1}{(n-k)(n-k-1)...1}\frac{\lambda ^k}{k!} \lim_{n \to \infty} (1-\frac{\lambda}{n})^n(1-\frac{\lambda}{n})^{-k} \\ &= \lim_{n \to \infty} \frac{n^k...}{(n^k...)}\frac{\lambda ^k}{k!} \lim_{n \to \infty} (1-\frac{\lambda}{n})^n(1-\frac{\lambda}{n})^{-k} \\ &= 1\cdot\frac{\lambda ^k}{k!} e^{-\lambda}\cdot1 \\ \end{aligned}

Gamma Function

gamma function is to find the common function for factorial. 当x不为整数时,阶乘就只能靠gamma function.

Γ(x)=0+ettx1dt(x>0)\Gamma(x)=\int_0^{+\infty}e^{-t}t^{x-1}dt (x>0)

For example

Γ(1)=0+etdt=et0+=1\Gamma(1) = \int_0^{+\infty}e^{-t}dt=-e^{-t}|_0^{+\infty}=1

Also the Γ(1/2)=π\Gamma(1/2) = \sqrt\pi

Beta Distribution

beta distribution 是定义在区间(0,1)的连续概率分布,with two parameter α\alpha and β\beta, α,β>0\alpha, \beta >0

f(x;α,β)=xα1(1x)β101uα1(1u)β1du=Γ(α+β)Γ(α)Γ(β)xα1(1x)β1=1B(α,β)xα1(1x)β1\begin{aligned} f(x;\alpha,\beta)&=\frac{x^{\alpha-1}(1-x)^{\beta -1}}{\int_0^1u^{\alpha-1}(1-u)^{\beta-1}du} \\ &= \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha-1}(1-x)^{\beta-1} \\ &= \frac{1}{B(\alpha, \beta)}x^{\alpha-1}(1-x)^{\beta-1} \end{aligned}

Proof that

paper

B(a,b)=Γ(a)Γ(b)Γ(a+b)=01μa1(1μ)b1dμB(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)} = \int_0^1\mu^{a-1}(1-\mu)^{b-1}d\mu

approach 1:

Beta(μa,b)=Γ(a+b)Γ(a)Γ(b)μa1(1μ)b1Beta(\mu|a,b)=\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} \mu^{a-1}(1-\mu)^{b-1}

Γ(a)Γ(b)=0exxa1dx0yb1eydy\Gamma(a)\Gamma(b)=\int_0^\infty e^{-x}x^{a-1}dx\int_0^{\infty}y^{b-1}e^{-y}dy

Let t=x+yt=x+y, then dy=d(tx)=dtdy=d(t-x)=dt

Approach 2:

Author: shixuan liu
Link: http://tedlsx.github.io/2019/08/06/distribution/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Donate
  • Wechat
  • Alipay

Comment