= Bernoulli Distribution = The '''Bernoulli distribution''' is a discrete propability distribution that gives 1 with probability ''p'' and 0 with probability ''q = 1 - p''. <> ---- == Statistics == The expected value of a Bernoulli-ditributed variable is ''E[X] = p''. The variance of a Bernoulli-distributed variable is ''Var[X] = p(1 - p) = pq''. The sum of repeated and independent Bernoulli-distributed events are described by the [[Statistics/BinomialDistribution|binomial distribution]]. ---- == Sampling == If all frame listings have an equal probability of selection, sampling can be implemented like: {{{ scalar p = .2 /* Probability of selection */ set seed 123456789 generate double r = runiform() generate sampled = (r < p) }}} The expected number of cases sampled is ''np''; the sample size is described by the [[Statistics/BinomialDistribution|binomial distribution]]. ---- CategoryRicottone