udbinom: UNU.RAN object for Binomial distribution

udbinomR Documentation

UNU.RAN object for Binomial distribution

Description

Create UNU.RAN object for a Binomial distribution with parameters size and prob.

[Distribution] – Binomial.

Usage

udbinom(size, prob, lb=0, ub=size)

Arguments

size

number of trials (one or more).

prob

probability of success on each trial.

lb

lower bound of (truncated) distribution.

ub

upper bound of (truncated) distribution.

Details

The Binomial distribution with size = n and prob = p has probability mass function

p(x) = choose(n,x) p^x (1-p)^(n-x)

for x = 0, …, n.

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

Value

An object of class "unuran.discr".

Author(s)

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

References

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

See Also

unuran.discr.

Examples

## Create distribution object for Binomial distribution
dist <- udbinom(size=100, prob=0.33)
## Generate generator object; use method DGT (inversion)
gen <- dgtd.new(dist)
## Draw a sample of size 100
x <- ur(gen,100)


Runuran documentation built on Jan. 17, 2023, 5:17 p.m.