Next: Geometric Random Variable, Previous: Poisson Random Variable, Up: Functions and Variables for discrete distributions [Contents][Index]
The Bernoulli distribution is a discrete probability distribution which takes on two values, 0 and 1. The value 1 occurs with probability p, and 0 occurs with probabilty 1-p.
It is equivalent to the \({\it Binomial}(1,p)\) distribution (see Binomial Random Variable)
Returns the value at x of the probability function of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The mean is $$ f(x; p) = p^x (1-p)^{1-x} $$
(%i1) load ("distrib")$
(%i2) pdf_bernoulli(1,p); (%o2) p
Returns the value at x of the distribution function of a
\({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1. To make use of this function, write first load("distrib")
.
The cdf is $$ F(x; p) = I_{1-p}(1-\lfloor x \rfloor, \lfloor x \rfloor + 1) $$
Returns the q-quantile of a
\({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1; in other words, this is the inverse of cdf_bernoulli
. Argument q must be an element of [0,1]. To make use of this function, write first load("distrib")
.
Returns the mean of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The mean is $$ E[X] = p $$
(%i1) load ("distrib")$
(%i2) mean_bernoulli(p); (%o2) p
Returns the variance of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The variance is $$ V[X] = p(1-p) $$
(%i1) load ("distrib")$
(%i2) var_bernoulli(p); (%o2) (1 - p) p
Returns the standard deviation of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The standard deviation is $$ D[X] = \sqrt{p(1-p)} $$
(%i1) load ("distrib")$
(%i2) std_bernoulli(p); (%o2) sqrt((1 - p) p)
Returns the skewness coefficient of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The skewness coefficient is $$ SK[X] = {1-2p \over \sqrt{p(1-p)}} $$
(%i1) load ("distrib")$
(%i2) skewness_bernoulli(p); 1 - 2 p (%o2) --------------- sqrt((1 - p) p)
Returns the kurtosis coefficient of a \({\it Bernoulli}(p)\) random variable, with 0 \leq p \leq 1.
The \({\it Bernoulli}(p)\) random variable is equivalent to the \({\it Binomial}(1,p)\).
The kurtosis coefficient is $$ KU[X] = {1-6p(1-p) \over p(1-p)} $$
(%i1) load ("distrib")$
(%i2) kurtosis_bernoulli(p); 1 - 6 (1 - p) p (%o2) --------------- (1 - p) p
Returns a
\({\it Bernoulli}(p)\) random variate, with 0 \leq p \leq 1. Calling random_bernoulli
with a second argument n, a random sample of size n will be simulated.
This is a direct application of the random
built-in Maxima function.
See also random
. To make use of this function, write first load("distrib")
.
Next: Geometric Random Variable, Previous: Poisson Random Variable, Up: Functions and Variables for discrete distributions [Contents][Index]