BB: The Beta-Binomial Distribution

BBR Documentation

The Beta-Binomial Distribution

Description

Density and random generation for the beta-binomial distribution.

Usage

dBB(m,p,phi)
rBB(k,m,p,phi)

Arguments

k

number of simulations.

m

maximum socre number in each beta-binomial observation..

p

probability parameter of the beta-binomial distribution.

phi

dispersion parameter of the beta-binomial distribution.

Details

The beta-binomial distribution consists of a finite sum of Bernoulli dependent variables whose probability parameter is random and follows a beta distribution. Assume that we have y_j a set of variables, j=1,...,m, with m integer, that conditioned on a random variable u, are independent and follow a Bernoulli distribution with probability parameter u. On the other hand, the random variable u follows a beta distribution with parameter p/phi and (1-p)/phi. Namely,

y_j \sim Ber(u), u \sim Beta(p/phi,(1-p)/phi),

where 0<p<1 and phi>0. The first and second order marginal moments of this distribution are defined as

E[y_j]=p, Var[y_j]=p(1-p),

and correlation between observations is defined as

Corr[y_j,y_k]=phi/(1+phi),

where j,k=1,...,m are different. Consequently, phi can be considered as a dispersion parameter.

If we sum up all the variables we will define a new variable which follows a new distribution that is called beta-binomial distribution, and it is defined as follows. The variable y follows a beta-binomial distribution with parameters m, p and phi if

y|u \sim Bin(m,u), u\sim Beta(p/phi,(1-p)/phi).

Value

dBB gives the density of a beta-binomial distribution with the defined m, p and phi parameters.

rBB generates k random observations based on a beta-binomial distribution with the defined m, p and phi parameters.

Author(s)

J. Najera-Zuloaga

D.-J. Lee

I. Arostegui

References

Arostegui I., Nunez-Anton V. & Quintana J. M. (2006): Analysis of short-form-36 (SF-36): The beta-binomial distribution approach, Statistics in Medicine, 26, 1318-1342

See Also

The rbeta and rbinom functions of package stats.

Examples

set.seed(12)
# We define
m <- 10     
p <- 0.4    
phi <- 1.8  

# We perform k beta-binomial simulations for those parameters.
k <- 100
bb <- rBB(k,m,p,phi)
bb
dd <- dBB(m,p,phi)

# We are going to plot the histogram of the created variable,
# and using dBB() function we are going to fit the distribution:
hist(bb,col="grey",breaks=seq(-0.5,m+0.5,1),probability=TRUE,
  main="Histogram",xlab="Beta-binomial random variable")
lines(seq(0,m),dd,col="red",lwd=4)


PROreg documentation built on July 12, 2022, 5:06 p.m.

Related to BB in PROreg...