mixture distribution problem

228 Views Asked by At

I need to draw the cdf and pdf of a probability that is a 50-50 mixture of the uniform distribution on [0,1] and a distribution that equals 0 with probability one half and 1 with probability one half. I know how to find the cdf and pdf of these two distribution separately, but I have no idea how to do the mixture problem.

1

There are 1 best solutions below

0
On

Comment:

The empirical CDF of the sample generated by the following R program should closely match the desired CDF.

Try finding the CDF directly from the CDFs of the two distributions being 'mixed'. For example: $F(0) = P(X \le 0) = .5P(X_1 \leq 0) + .5P(X_2 \leq 0) = 1/4.$ Then for $x \in (0,1),$ find $F(x) = P(X \le x) = .5P(X_1 \le x) + .5P(X_2 \le x) = ?$ Etc.

m = 10^5
ch = sample(0:1, m, repl=T)
x1 = runif(m);  x2 = rbinom(m, 1, 1/2)
x= ch*x1 + (1-ch)*x2
plot.ecdf(x, lwd=2)

enter image description here