nlogL: Negative log Likelihood functions for Poisson, negative...

nlogLR Documentation

Negative log Likelihood functions for Poisson, negative binomial, Delaporte, Poisson-inverse Gaussian and Poisson-beta distributions

Description

The negative log Likelihood functions for Poisson, negative binomial, Delaporte, Poisson-inverse Gaussian and Poisson-beta distributions. Mixing two distributions of the same kind and/or adding zero-inflation allows to take characteristics of real data into account. Additionally, one population and two population mixtures - with and without zero-inflation - allow distribution fitting of the Poisson, negative binomial, Delaporte, Poisson-inverse Gaussian and the Poisson-beta distribution.

Usage

nlogL_pois(data, par.pois)

nlogL_nb(data, par.nb)

nlogL_del(data, par.del)

nlogL_pig(data, par.pig)

nlogL_pb(data, par.pb)

nlogL_pois2(data, par.pois2)

nlogL_nb2(data, par.nb2)

nlogL_del2(data, par.del2)

nlogL_pig2(data, par.pig2)

nlogL_pb2(data, par.pb2)

nlogL_zipois(data, par.zipois)

nlogL_zinb(data, par.zinb)

nlogL_zidel(data, par.zidel)

nlogL_zipig(data, par.zipig)

nlogL_zipb(data, par.zipb)

nlogL_zipois2(data, par.zipois2)

nlogL_zinb2(data, par.zinb2)

nlogL_zidel2(data, par.zidel2)

nlogL_zipig2(data, par.zipig2)

nlogL_zipb2(data, par.zipb2)

Arguments

data

Vector containing the discrete observations

par.pois

Scalar containing the lambda parameter of the Poisson distribution

par.nb

Vector of length 2, containing the size and the mu parameter of the negative binomial distribution

par.del

Vector of length 3, containing the mu, sigma and the nu parameter of the Delaporte distribution

par.pig

Vector of length 2, containing the mu and the sigma parameter of the Poisson-inverse Gaussian distribution

par.pb

Vector of length 3, containing the alpha, beta and c parameter of the Poisson-beta distribution

par.pois2, par.nb2, par.del2, par.pig2, par.pb2

Vector containing the parameters of the two mixing distributions. First entry represents the fraction of the first distribution, followed by all parameters of the first, then all of the second distribution.

par.zipois, par.zinb, par.zidel, par.zipig, par.zipb

Vector containing the respective zero-inflated distribution parameters. The additional first entry is the inflation parameter for all cases.

par.zipois2, par.zinb2, par.zidel2, par.zipig2, par.zipb2

Parameters for the zero-inflated two population model.

Details

Functions nlogL_pois, nlogL_nb, nlogL_del, nlogL_pig, nlogL_pb compute the negative log-likelihood of Poisson, negative binomial, Poisson-inverse Gaussian and the Poisson-beta distributions given the data. Functions nlogL_pois2, nlogL_nb2, nlogL_del2, nlogL_pig2 and nlogL_pb2 compute the negative log-likelihood values for a two population mixture of distributions whereas nlogL_zipois, nlogL_zinb, nlogL_zidel, nlogL_zipig, nlogL_zipb compute the same for the zero-inflated distributions. Furthermore, nlogL_zipois2, nlogL_zinb2, nlogL_zidel2, nlogL_zipig2 and nlogL_zipb2 are for two population mixtures with zero-inflation.

Examples

x <- rpois(100, 11)
nl1 <- nlogL_pois(x, 11)
nl2 <- nlogL_pois(x, 13)
x <- rnbinom(100, size = 13, mu = 9)
nl <- nlogL_nb(x, c(13, 9))
x <- gamlss.dist::rDEL(100, mu = 5, sigma = 0.2, nu= 0.5)
nl <- nlogL_del(x, c(5, 0.2, 0.5))
x <- gamlss.dist::rPIG(100, mu = 5, sigma = 0.2)
nl <- nlogL_pig(x, c(5, 0.2))
x <- rpb(n = 1000, alpha=5, beta= 3, c=20)
nl <- nlogL_pb(x, c(5, 3, 20))
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x <- s*rpois(100, 7) + (1-s)*rpois(100, 13)
nl <- nlogL_pois2(x, c(0.3, 13, 7))
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x <- s*rnbinom(100, size = 13, mu = 9) + (1-s)*rnbinom(100, size = 17, mu = 29)
nl <- nlogL_nb2(x, c(0.3, 17, 29, 13, 9))
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x <- s * gamlss.dist::rDEL(100, mu = 5, sigma = 0.2, nu = 0.5) +
     (1 - s) * gamlss.dist::rDEL(100, mu = 20, sigma = 2, nu = 0.1)
nl <- nlogL_del2(x, c(0.7,5, 0.2, 20, 2))
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x <- s * gamlss.dist::rPIG(100, mu = 5, sigma = 0.2) +
     (1 - s) * gamlss.dist::rPIG(100, mu = 20, sigma = 2)
nl <- nlogL_pig2(x, c(0.7, 5, 0.2, 20, 2))
s <- sample(x = c(0,1), size = 100, replace = TRUE, prob = c(0.3,0.7))
x <- s*rpb(100, 5, 3, 20) + (1-s)*rpb(100, 7, 13, 53)
nl <- nlogL_pb2(x, c(0.7, 7, 13, 53, 5, 3, 20))
x <- c(rep(0, 10), rpois(90, 7))
nl <- nlogL_zipois(x, c(0.1, 7))
x <- c(rep(0,10), rnbinom(90, size = 13, mu = 9))
nl <- nlogL_zinb(x, c(0.1, 13, 9))
x <- c(rep(0,10), gamlss.dist::rDEL(90, mu = 13, sigma = 2, nu = 0.5))
nl <- nlogL_zidel(x, c(0.1, 13, 2, 0.5))
x <- c(rep(0,10), gamlss.dist::rPIG(90, mu = 13, sigma = 2))
nl <- nlogL_zipig(x, c(0.1, 13, 2))
x <- c(rep(0, 10), rpb(n = 90, alpha=5, beta= 3, c=20))
nl <- nlogL_zipb(x, c(0.1, 5, 3, 20))
s <- sample(x = c(0, 1), size = 90, replace = TRUE, prob = c(0.3, 0.7))
x <- c(rep(0, 10), s * rpois(90, 7) + (1 - s) * rpois(90, 13))
nl1 <- nlogL_zipois2(x, c(0.1, 0.63, 7, 13))
s <- sample(x = c(0, 1), size = 90, replace = TRUE, prob = c(0.3, 0.7))
x <- c(rep(0, 10), s * rnbinom(90, size = 13, mu = 9) + (1 - s) * rnbinom(90, size = 17, mu = 29))
nl <- nlogL_zinb2(x, c(0.1, 0.63, 13, 9, 17, 29))
s <- sample(x = c(0, 1), size = 90, replace = TRUE, prob = c(0.3, 0.7))
x <- c(rep(0, 10), s * gamlss.dist::rDEL(90, mu = 13, sigma = 9, nu = 0.5) +
             (1 - s) * gamlss.dist::rDEL(90, mu = 17, sigma = 29, nu = 0.1))
nl <- nlogL_zidel2(x, c(0.1, 0.63, 13, 9, 0.5, 17, 29, 0.1))
s <- sample(x = c(0,1), size = 90, replace = TRUE, prob = c(0.3, 0.7))
x <- c(rep(0, 10), s * gamlss.dist::rPIG(90, mu = 13, sigma = 0.2) +
               (1-s) * gamlss.dist::rPIG(90, mu = 17, sigma = 2))
nl <- nlogL_zipig2(x, c(0.1, 0.63, 13, 0.2, 17, 2))
s <- sample(x = c(0,1), size = 90, replace = TRUE, prob = c(0.3,0.7))
x <- c(rep(0,10), s*rpb(90, 5, 3, 20) + (1-s)*rpb(90, 7, 13, 53))
nl <- nlogL_zipb2(x, c(0.1, 0.63, 7, 13, 53, 5, 3, 20))

scModels documentation built on Feb. 16, 2023, 6:12 p.m.

Related to nlogL in scModels...