udbinom: UNU.RAN object for Binomial distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/distributions.R

Description

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

[Distribution] – Binomial.

Usage

1
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 [email protected].

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

1
2
3
4
5
6
## 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 Nov. 17, 2017, 4:40 a.m.