Note for Beta Distribution

This post is out of date, please check the new post named “Beta Distribution — Intuition, Derivation, and Examples”.

1 Why Beta Distribution?

1.1 Model probabilites

The short story is that the Beta distribution can be understood as representing a distribution of probabilities, that is, it represents all the possible values of a probability when we don’t know what that probability is.

1.2 Generalization of uniform

Give me a continuous and bounded random variable, em, except the Uniform distribution. That is another way to look at beta distribution, continuous and bounded between 0, 1; also the density is not flat. XBeta(a,b), where a>0, b>0.

fX(x)=cxa1(1x)b1, where x>0.

What is c? Just a normalization constant. We’ll get the value of c later.

2 Construction

2.1 Bank and Post Office Story

Let X be the waiting time at Bank,

XGamma(n1,λ)

Let Y be the waiting time at Post Office,

YGamma(n2,λ)

Assume X and Y are independent.

Then, what is the distribution of the proportion XX+Y?

Define T=X+Y be the total waiting time.

Clearly, TGamma(n1+n2,λ), proved by MGF.

Define W=XX+Y , the proportion of waiting time at Bank to the total waiting time.

What is the distribution of W?

We need to derive fW(w), but first let’s find the joint pdf fT,W(t,w) fT,W(t,w)=fX,Y(x,y)|(x,y)(t,w)|=1Γ(n1)λn1xn11eλx1Γ(n2)λn2xn21eλy|t|=λn1+n2tn1+n21eλt1Γ(n1)Γ(n2)wn11(1w)n21=λn1+n2tn1+n21eλtΓ(n1+n2)Γ(n1+n2)Γ(n1)Γ(n2)wn11(1w)n21=fT(t)Γ(n1+n2)Γ(n1)Γ(n2)wn11(1w)n21

Then we find the marginal,

fW(w)=0fT,W(t,w)dt=Γ(n1+n2)Γ(n1)Γ(n2)wn11(1w)n210fT(t)dt=Γ(n1+n2)Γ(n1)Γ(n2)wn11(1w)n21

Since fW(w) is the pdf needed to be integrated to 1,

01Γ(n1+n2)Γ(n1)Γ(n2)wn11(1w)n21dw1

so the normalization constant should be

c=Γ(n1+n2)Γ(n1)Γ(n2):=1B(n1,n2)

2.1.1 Summary

The connection between Gamma and Beta distribution helps us to find the normalization constant in Beta. In summary,

If XGamma(α,λ) and YGamma(β,λ) are independent, then XX+YBeta(α,β).

2.2 plots

library(zetaEDA)
library(ggfortify)
enable_zeta_ggplot_theme()

Let’s check Beta density for some different parameters value.

How about a=b=1? The Beta(1,1) is just the Unif(0,1).

ggdistribution(func = dbeta, x = seq(0, 1, .01), shape1 = 1, shape2 = 1) +
  labs(title = "Beta Density with a = 1, b = 1")

How about a=b=12?

How about a=b=2?

How about a=2, b=1?

One more,

p <- ggdistribution(func = dbeta, x = seq(0, 1, .01), shape1 = 1.5, shape2 = 5, colour = "tomato", linetype = "dashed")

ggdistribution(func = dbeta, x = seq(0, 1, .01), shape1 = 5, shape2 = 1.5, colour = "blue", p = p) +
  labs(title = "Red: a = 1.5, b = 5\n Blue: a = 5, b = 1.5")

For more checking, click this link and try some parameters to check the density curve.

Have fun!

Chen Xing
Chen Xing
Founder & Data Scientist

Enjoy Life & Enjoy Work!

Related