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!(5−n)!=C5np(X=n)=\frac{5!}{n!(5-n)!}=C_5^n

The general probability is

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

And the

E(X)=np=∑k=0nkCnkpk(1−p)n−kE(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(1−p)n−kE(X) =\sum_{k=1}^{n}kC_n^kp^k(1-p)^{n-k}

Then

E(x)=∑k=1nkn!k!(n−k)!pk(1−p)(n−k)=∑k=1nkn(n−1)!k(k−1)!(n−k)!ppk−1(1−p)(n−k)=np∑k=1n(n−1)!(k−1)!(n−k)!pk−1(1−p)(n−k)\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=k−1a = k-1, b=n−1b=n-1 ⇒k=a+1,n=b+1\Rightarrow k=a+1, n=b+1

E(x)=np∑k=1n(n−1)!(k−1)!(n−k)!pk−1(1−p)(n−k)=np∑a=0bb!a!(b−n)!pa(1−p)(b−a)\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!(b−n)!pa(1−p)(b−a)\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)60−kp(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)3600−kp(X=k) =C_{3600}^k(\frac{\lambda}{3600})^k(1-\frac{\lambda}{3600})^{3600-k}

As we know

lim⁡x→inf⁡(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:

lim⁡n→∞(1+1n)na=lim⁡n→∞((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)=lim⁡n→∞Cnk(λn)k(1−λn)n−k=lim⁡n→∞n!(n−k)!k!λknk(1−λn)n(1−λn)−k=lim⁡n→∞n(n−1)...1(n−k)(n−k−1)...1λkk!lim⁡n→∞(1−λn)n(1−λn)−k=lim⁡n→∞nk...(nk...)λkk!lim⁡n→∞(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+∞e−ttx−1dt(x>0)\Gamma(x)=\int_0^{+\infty}e^{-t}t^{x-1}dt (x>0)

For example

Γ(1)=∫0+∞e−tdt=−e−t∣0+∞=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(1−x)β−1∫01uα−1(1−u)β−1du=Γ(α+β)Γ(α)Γ(β)xα−1(1−x)β−1=1B(α,β)xα−1(1−x)β−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μa−1(1−μ)b−1dμ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)μa−1(1−μ)b−1Beta(\mu|a,b)=\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} \mu^{a-1}(1-\mu)^{b-1}

Γ(a)Γ(b)=∫0∞e−xxa−1dx∫0∞yb−1e−ydy\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(t−x)=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
简