Learn R Programming

MBASED (version 1.6.0)

vectorizedRbetabinomAB: Functions to generate beta-binomial random variables.

Description

Functions to generate beta-binomial random variables.

Usage

vectorizedRbetabinomAB(n, size, a, b, checkArgs = FALSE)
vectorizedRbetabinomMR(n, size, mu, rho, checkArgs = FALSE)

Arguments

n
sample size, must be a single positive integer
size
number of trials for each count to be generated in the sample, must be a vector of positive integers
a,b
vectors of shape parameters for beta distributions used to generate probability of success for each count to be generated in the sample, must be >0
checkArgs
single boolean specifying whether arguments should be checked for adherence to specifications. DEFAULT: FALSE
mu,rho
mean (a/(a+b)) and dispersion (1/(a+b+1)) parameters for beta distribution, must be in (0,1). Value of 0 is allowed for rho and implies binomial distribution.

Value

a numeric vector of betabinomial random variables.

Details

vectorizedRbetabinomAB is the same function as rbetabinom.ab from VGAM package but it avoids a lot of overhang and requires that arguments size, a (shape1), and b (shape2) be of length equal to argument n.

vectorizedRbetabinomMR is a wrapper around vectorizedRbetabinomAB using mu/rho parametrization. Requires that arguments size, mu, and rho be of length equal to argument n.

See Also

Other bbFunctions: getAB, getAB, getMuRho

Other bbFunctions: getAB, getAB, getMuRho

Examples

Run this code
set.seed(111)
MBASED:::vectorizedRbetabinomAB(n=10, size=rep(50,10), a=rep(1,10), b=rep(1,10))
set.seed(111)
MBASED:::vectorizedRbetabinomMR(n=10, size=rep(50,10), mu=rep(1/2,10), rho=rep(1/3,10))

Run the code above in your browser using DataLab