# How to see that this is a mixture of the uniform and Erlang?

I have a pdf in a form:

$$f(x) = \begin{cases}\frac{1}{2} + \frac{1}{2} \frac{\lambda^k x^{k-1} e^{-\lambda x}}{k!} & \text{for 0

I can see that this is a mixture of $$\text{Erlang}(k,\lambda)$$ with probability $$0.5$$ and some other distribution. Believe it might be uniform $$U(0,1)$$ but I cannot see how it would work.

• It is indeed half Erlang/gamma and half Uniform on $(0,1)$, The pdf is fairly clearly the average of the pdfs of the two original distributions: the $\frac12 +$ part for $0 < x < 1$ is half of $1$ May 8, 2021 at 1:32

Yes, this is a mixture of an Erlang random variable and a uniform random variable (with equal probability). Specifically, if you let $$X_0 \sim \text{U}(0,1)$$ and $$X_1 \sim \text{Erlang}(k,\lambda)$$ then your random variable is the mixture:
$$X = X_Y \quad \quad \quad Y \sim \text{Bern}(\tfrac{1}{2}).$$
\begin{align} p(X=x) &= p(Y=0) \cdot p(X=x|Y=0) + p(Y=1) \cdot p(X=x|Y=1) \\[6pt] &= \tfrac{1}{2} \cdot p(X_0=x) + \tfrac{1}{2} \cdot p(X_1=x) \\[6pt] &= \tfrac{1}{2} \cdot \text{U}(x|0,1) + \tfrac{1}{2} \cdot \text{Erlang}(x|k,\lambda) \\[12pt] &= \begin{cases} \ 0 & & & \text{for } x \leqslant 0, \\[10pt] \tfrac{1}{2} + \tfrac{1}{2} \cdot \frac{\lambda^k x^{k-1} e^{-\lambda x}}{(k-1)!} & & & \text{for } 0 < x < 1, \\[6pt] \tfrac{1}{2} \cdot \frac{\lambda^k x^{k-1} e^{-\lambda x}}{(k-1)!} & & & \text{for } x \geqslant 1, \\[6pt] \end{cases} \end{align}