bnb: The bivariate negative binomial distribution

bnbR Documentation

The bivariate negative binomial distribution

Description

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).

Usage

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
)

Arguments

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.

param

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

n

number of observations.

em

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.

Value

  • rbnb gives a pair of random vectors following BNB distribution.

  • bnb gives the maximum likelihood estimates of a BNB pair. Standard error and covariance matrix are provided when em is TRUE.

  • lik.bnb gives the log-likelihood of a set of parameters for a BNB pair.

Author(s)

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

References

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

Examples

# generating a pair of random vectors
set.seed(1)
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)


bzinb documentation built on May 29, 2024, 9:41 a.m.

Related to bnb in bzinb...