Class "Geom"

The geometric distribution with prob $= p$ has density $$p(x) = p {(1-p)}^{x}$$ for $x = 0, 1, 2, \ldots$ C.f. rgeom


Working with a computer, we use a finite interval as support which carries at least mass (1-TruncQuantile).

Objects from the Class

Objects can be created by calls of the form Geom(prob). This object is a geometric distribution.


Class "DiscreteDistribution", directly. Class "UnivariateDistribution", by class "DiscreteDistribution". Class "Distribution", by class "DiscreteDistribution".

See Also

GeomParameter-class DiscreteDistribution-class Naturals-class rgeom

  • Geom-class
  • Geom
  • initialize,Geom-method
G <- Geom(prob = 0.5) # G is a geometric distribution with prob = 0.5.
r(G)(1) # one random number generated from this distribution, e.g. 0
d(G)(1) # Density of this distribution is 0.25 for x = 1.
p(G)(1) # Probability that x<1 is 0.75.
q(G)(.1) # x = 0 is the smallest value x such that p(G)(x) >= 0.1.
prob(G) # prob of this distribution is 0.5.
prob(G) <- 0.6 # prob of this distribution is now 0.6.
Documentation reproduced from package distr, version 1.4, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.