dist_geometric {distributional} | R Documentation |
The Geometric Distribution
Description
The Geometric distribution can be thought of as a generalization
of the dist_bernoulli()
distribution where we ask: "if I keep flipping a
coin with probability p
of heads, what is the probability I need
flips before I get my first heads?" The Geometric
distribution is a special case of Negative Binomial distribution.
Usage
dist_geometric(prob)
Arguments
prob |
probability of success in each trial. |
Details
We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.
In the following, let be a Geometric random variable with
success probability
p
= . Note that there are multiple
parameterizations of the Geometric distribution.
Support: 0 < p < 1,
Mean:
Variance:
Probability mass function (p.m.f):
Cumulative distribution function (c.d.f):
Moment generating function (m.g.f):
See Also
Examples
dist <- dist_geometric(prob = c(0.2, 0.5, 0.8))
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)