udbinom {Runuran}R 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) = {n \choose x} {p}^{x} {(1-p)}^{n-x}

for x = 0, \ldots, 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)


[Package Runuran version 0.38 Index]