draw.beta.binomial {UnivRNG} | R Documentation |
Generates variates from Beta-binomial distribution
Description
This function implements pseudo-random number generation for a Beta-binomial distribution with pmf
f(x|n,\alpha,\beta) = \frac{n!}{x!(n-x)!B(\alpha,\beta)}\int_{0}^{1}\pi^{\alpha-1+x}(1-\pi)^{n+\beta-1-x}d\pi
for x=0,1,2,...
, \alpha>0
, and \beta>0
, where n
is the sample size, \alpha
and \beta
are the shape parameters and B(\alpha,\beta)
is the complete beta function.
Usage
draw.beta.binomial(nrep,alpha,beta,n)
Arguments
nrep |
Number of data points to generate. |
alpha |
First shape parameter. |
beta |
Second shape parameter. |
n |
Number of trials. |
Value
A list of length five containing generated data, the theoretical mean, the empirical mean, the theoretical variance, and the empirical variance with names y, theo.mean, emp.mean, theo.var, and emp.var, respectively.
Examples
draw.beta.binomial(nrep=100000,alpha=0.2,beta=0.25,n=10)
draw.beta.binomial(nrep=100000,alpha=2,beta=3,n=10)
draw.beta.binomial(nrep=100000,alpha=600,beta=400,n=20)
[Package UnivRNG version 1.2.3 Index]