Bernoulli Distribution Example. Suppose that we wish to simulate random variables from a Bernoulli distribution with parameter (p=0.85). Consider a graph of the cumulative distribution function.
Figure 1. Bernoulli Distribution Function
This shows that the quantile function can be written as
begin{eqnarray*}
F^{-1}(y) = left{
begin{array}{cr}
0 & 0 < y < 0.85 \
1 & 0.85 leq y < 1.0 \
end{array} right.
end{eqnarray*}
Thus, with the inverse transform we may define
begin{eqnarray*}
X = left{ begin{array}{cc}
0 & 0 < U < 0.85 \
1 & 0.85 leq U < 1.0
end{array} right.
end{eqnarray*}
Some Numbers. Generate three random numbers to get
(U) | 0.26321364 | 0.196884752 | 0.897884218 |
(X=F^{-1}(U)) | 0 | 0 | 9.909071325 |