udgeom function

UNU.RAN object for Geometric distribution

UNU.RAN object for Geometric distribution

Create UNU.RAN object for a Geometric distribution with parameter prob.

[Distribution] -- Geometric.

udgeom(prob, lb = 0, ub = Inf)

Arguments

  • prob: probability of success in each trial. 0 < prob <= 1.
  • lb: lower bound of (truncated) distribution.
  • ub: upper bound of (truncated) distribution.

Details

The Geometric distribution with prob =p= p has density

p(x)=p(1p)x p(x) = p (1-p)^x

for x=0,1,2,x = 0, 1, 2, \dots, 0<p10 < p \le 1.

The domain of the distribution can be truncated to the interval (lb,ub).

Returns

An object of class "unuran.discr".

References

N.L. Johnson, S. Kotz, and A.W. Kemp (1992): Univariate Discrete Distributions. 2nd edition, John Wiley & Sons, Inc., New York. Sect. 5.2, p. 201

Author(s)

Josef Leydold and Wolfgang H"ormann unuran@statmath.wu.ac.at .

Examples

## Create distribution object for Geometric distribution dist <- udgeom(prob=0.33) ## Generate generator object; use method DARI gen <- darid.new(dist) ## Draw a sample of size 100 x <- ur(gen,100)
  • Maintainer: Josef Leydold
  • License: GPL (>= 2)
  • Last published: 2025-04-07