Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 1d9c7b6
  • /
  • nlogL.Rd
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:5999ac8098a89111e05c19aa07bc75b405d07572
directory badge
swh:1:dir:1d9c7b6faaf4c1560ce4c815112d299a54a37f79

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
nlogL.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/log_likelihood.R
\name{nlogL}
\alias{nlogL}
\alias{nlogL_pois}
\alias{nlogL_nb}
\alias{nlogL_del}
\alias{nlogL_pig}
\alias{nlogL_pb}
\alias{nlogL_pois2}
\alias{nlogL_nb2}
\alias{nlogL_del2}
\alias{nlogL_pig2}
\alias{nlogL_pb2}
\alias{nlogL_zipois}
\alias{nlogL_zinb}
\alias{nlogL_zidel}
\alias{nlogL_zipig}
\alias{nlogL_zipb}
\alias{nlogL_zipois2}
\alias{nlogL_zinb2}
\alias{nlogL_zidel2}
\alias{nlogL_zipig2}
\alias{nlogL_zipb2}
\title{Negative log Likelihood functions for Poisson, negative binomial,
Delaporte, Poisson-inverse Gaussian and Poisson-beta distributions}
\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{
\item{data}{Vector containing the discrete observations}

\item{par.pois}{Scalar containing the lambda parameter
of the Poisson distribution}

\item{par.nb}{Vector of length 2, containing the size and the mu
parameter of the negative binomial distribution}

\item{par.del}{Vector of length 3, containing the mu, sigma and the nu
parameter of the Delaporte distribution}

\item{par.pig}{Vector of length 2, containing the mu and the sigma
parameter of the Poisson-inverse Gaussian distribution}

\item{par.pb}{Vector of length 3, containing the alpha, beta
and c parameter of the Poisson-beta distribution}

\item{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.}

\item{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.}

\item{par.zipois2, par.zinb2, par.zidel2, par.zipig2, par.zipb2}{Parameters for the zero-inflated
two population model.}
}
\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.
}
\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))
}
\keyword{Poisson-beta}
\keyword{binomial}
\keyword{likelihood}
\keyword{negative}

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API