zinb.loglik {zinbwave} | R Documentation |
Given a vector of counts, this function computes the sum of the log-probabilities of the counts under a zero-inflated negative binomial (ZINB) model. For each count, the ZINB distribution is parametrized by three parameters: the mean value and the dispersion of the negative binomial distribution, and the probability of the zero component.
zinb.loglik(Y, mu, theta, logitPi)
Y |
the vector of counts |
mu |
the vector of mean parameters of the negative binomial |
theta |
the vector of dispersion parameters of the negative binomial, or a single scalar is also possible if the dispersion parameter is constant. Note that theta is sometimes called inverse dispersion parameter (and phi=1/theta is then called the dispersion parameter). We follow the convention that the variance of the NB variable with mean mu and dispersion theta is mu + mu^2/theta. |
logitPi |
the vector of logit of the probabilities of the zero component |
the log-likelihood of the model.
n <- 10 mu <- seq(10,50,length.out=n) logitPi <- rnorm(10) zeta <- rnorm(10) Y <- rnbinom(n=n, size=exp(zeta), mu=mu) zinb.loglik(Y, mu, exp(zeta), logitPi) zinb.loglik(Y, mu, 1, logitPi)