Binomial distributions are used to represent situations can that can
be thought as the result of size
of the experiment). The classical
example is p
of success. In this case, the individual probability of
flipping heads or tails is given by the Bernoulli(p) distribution,
and the probability of having
Binomial(size, p = 0.5)
A Binomial
object.
The number of trials. Must be an integer greater than or equal
to one. When size = 1L
, the Binomial distribution reduces to the
bernoulli distribution. Often called n
in textbooks.
The success probability for a given trial. p
can be any
value in [0, 1]
, and defaults to 0.5
.
The Binomial distribution comes up when you are interested in the portion
of people who do a thing. The Binomial distribution
also comes up in the sign test, sometimes called the Binomial test
(see stats::binom.test()
), where you may need the Binomial C.D.F. to
compute p-values.
We recommend reading this documentation on https://alexpghayes.github.io/distributions3/, where the math will render with additional detail.
In the following, let size
= p
=
Support:
Mean:
Variance:
Probability mass function (p.m.f):
Cumulative distribution function (c.d.f):
Moment generating function (m.g.f):
Other discrete distributions:
Bernoulli()
,
Categorical()
,
Geometric()
,
HurdleNegativeBinomial()
,
HurdlePoisson()
,
HyperGeometric()
,
Multinomial()
,
NegativeBinomial()
,
Poisson()
,
ZINegativeBinomial()
,
ZIPoisson()
,
ZTNegativeBinomial()
,
ZTPoisson()
set.seed(27)
X <- Binomial(10, 0.2)
X
mean(X)
variance(X)
skewness(X)
kurtosis(X)
random(X, 10)
pdf(X, 2L)
log_pdf(X, 2L)
cdf(X, 4L)
quantile(X, 0.7)
cdf(X, quantile(X, 0.7))
quantile(X, cdf(X, 7))
Run the code above in your browser using DataLab