Mixed Distributions

Most of the time in this course we work with either a discrete or a continuous random variable. There are however cases where we have to deal with random variables or random vectors that are both. These arise in two ways:

Example (2.4.1)

We have a random variable \(Y\sim Beta(\alpha,\beta)\) and \(X|Y=y\sim Bin(n,y)\). Now

\[ \begin{aligned} &f(x,y) = f_Y(y)f_{X|Y=y}(x|y)=\\ &\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}y^{\alpha-1}(1-y)^{\beta-1} {{n}\choose{x}}y^x(1-y)^{n-x} \\ &\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} {{n}\choose{x}}y^{x+\alpha-1}(1-y)^{n-x+\beta-1} \\ \end{aligned} \]

where \(x=0,1,..,n\) and \(0<y<1\). So we have a random vector that is discrete in X and continuous in Y.

Let’s find the the density of \(X\):

\[ \begin{aligned} &f_X(x)=\int_0^1 f(x,y) dy = \\ &\int_0^1 \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} {{n}\choose{x}}y^{x+\alpha-1}(1-y)^{n-x+\beta-1} dy=\\ &\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} {{n}\choose{x}}\frac{\Gamma(x+\alpha)\Gamma(n-x\beta)}{\Gamma(n+\alpha+\beta)}\int_0^1 \frac{\Gamma(n+\alpha+\beta)}{\Gamma(x+\alpha)\Gamma(n-x+\beta)}y^{x+\alpha-1}(1-y)^{n-x+\beta-1} dy=\\ &\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} {{n}\choose{x}}\frac{\Gamma(x+\alpha)\Gamma(n-x+\beta)}{\Gamma(n+\alpha+\beta)}=\\ &\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} \frac{n!}{(n-x)!x!}\frac{(x+\alpha-1)..\alpha\Gamma(\alpha)(n-x-1)..\beta\Gamma(\beta)}{(n+\alpha+\beta-1)..(\alpha+\beta)\Gamma(\alpha+\beta)} = \\ & \frac{n!}{(n-x)!x!}\frac{(x+\alpha-1)..\alpha(n-x-1)..\beta}{(n+\alpha+\beta-1)..(\alpha+\beta)} \end{aligned} \]

This is called the \(beta-binomial\) distribution.

Example (2.4.2)

Say we have the following experiment: we flip a fair coin. If it lands heads \(X=1/2\), if it lands tails we choose \(X\sim U[0,1]\). Now

  • if \(0<x<1/2\) \[ \begin{aligned} &F_X(x)=P(X\le x) = \\ &P(X\le x|\text{heads})P(\text{heads})+P(X\le x|\text{tails})P(\text{tails}) = \\ &0\times \frac12+x\times \frac12 = x/2\\ \end{aligned} \]
  • if \(1/2<x<1\) \[ \begin{aligned} &F_X(x)=P(X\le x) = \\ &P(X\le x|\text{heads})P(\text{heads})+P(X\le x|\text{tails})P(\text{tails}) = \\ &1\times \frac12+x\times \frac12 =(1+x)/2\\ \end{aligned} \]