Bernoulli Distribution

If an experiment is binary having two possible outcomes, commonly called "success" and "failure," and their probabilities are respectively, θ and 1-θ, then the number of successes, 0 or 1, has a Bernoulli distribution.

A random variable X has a Bernoulli distribution and it is referred to as a Bernoulli random variable if and only if its probability distribution is given by
\[ f(x; \theta ) = \theta^x \left( 1 - \theta \right)^{1-x} \qquad \mbox{ for } \ x=0,1 . \]
R has four dedicated commands for density, distribution function, quantile function, and random generation for the Bernoulli distribution with parameter prob: