Learn R Programming

betafunctions (version 1.9.0)

rcBinom: Random Number Generation under Lord's Two-Term Approximation to the Compound Binomial Distribution.

Description

Random Number Generation under Lord's Two-Term Approximation to the Compound Binomial Distribution.

Usage

rcBinom(n, N, k, p)

Arguments

n

Number of draws.

N

Number of trials.

k

Lord's k (see documentation for the Lords.k() function).

p

Probability of success for each trial.

Examples

Run this code
# To draw a sample of 50 values from a Compound-Binomial distribution with
# number of trials = 100, a 50% probability of success for each trial, and
# Lord's k = 1:
set.seed(1234)
rcBinom(n = 50, N = 100, k = 1, p = .5)

# To draw values where the probabilities vary for each draw:
rcBinom(n = 50, N = 100, k = 1, p = runif(50))

Run the code above in your browser using DataLab