stable
dist_binomial(size, prob)
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 probability of success on each trial, prob
can be any
value in [0, 1]
.
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
We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.
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.
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):
# NOT RUN {
dist <- dist_binomial(size = 1:5, prob = c(0.05, 0.5, 0.3, 0.9, 0.1))
dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)
generate(dist, 10)
density(dist, 2)
density(dist, 2, log = TRUE)
cdf(dist, 4)
quantile(dist, 0.7)
# }
Run the code above in your browser using DataLab