bnb {bzinb}R Documentation

The bivariate negative binomial distribution


random generation (rbnb), maximum likelihood estimation (bnb), and log-likelihood. (lik.bnb) for the bivariate negative binomial distribution with parameters equal to (a0, a1, a2, b1, b2).


lik.bnb(xvec, yvec, a0, a1, a2, b1, b2, param = NULL)

rbnb(n, a0, a1, a2, b1, b2, param = NULL)

bnb(xvec, yvec, em = TRUE, tol = 1e-08, maxiter = 50000,
  vcov = TRUE, initial = NULL, showFlag = FALSE)


xvec, yvec

a pair of bnb random vectors. nonnegative integer vectors. If not integers, they will be rounded to the nearest integers.

a0, a1, a2

shape parameters of the latent gamma variables. must be positive.

b1, b2

scale parameters for the latent gamma variables. must be positive.


a vector of parameters ((a0, a1, a2, b1, b2)). Either param or individual parameters (a0, a1, a2, b1, b2) need to be provided.


number of observations.


if TRUE in bnb, EM algorithm is applied. Otherwise, direct opitmation is used.

tol, maxiter, vcov, initial, showFlag

optional arguments applied only when em is TRUE in bnb.



Hunyong Cho, Chuwen Liu, Jinyoung Park, and Di Wu


Cho, H., Liu, C., Preisser, J., and Wu, D. (In preparation), "A bivariate zero-inflated negative binomial model for identifying underlying dependence"


# generating a pair of random vectors
data1 <- rbnb(n = 100, a0 = 2, a1 = 1, a2 = 1, 
                b1 = 1, b2 = 1)

lik.bnb(xvec = data1[, 1], yvec = data1[ ,2], 
          a0 = 1, a1 = 1, a2 = 1, b1 = 1, b2 = 1) 

bnb(xvec = data1[,1], yvec = data1[,2], showFlag = FALSE)

[Package bzinb version 1.0.4 Index]