| Title: | Maximum Likelihood Estimation of the Generalized Poisson Distribution |
|---|---|
| Description: | Functions to estimate the parameters of the generalized Poisson distribution with or without covariates using maximum likelihood. The references include Nikoloulopoulos A.K. & Karlis D. (2008). "On modeling count data: a comparison of some well-known discrete distributions". Journal of Statistical Computation and Simulation, 78(3): 437--457, <doi:10.1080/10629360601010760> and Consul P.C. & Famoye F. (1992). "Generalized Poisson regression model". Communications in Statistics - Theory and Methods, 21(1): 89--109, <doi:10.1080/03610929208830766>. |
| Authors: | Michail Tsagris [aut, cre] |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.1 |
| Built: | 2026-05-19 07:10:34 UTC |
| Source: | https://github.com/cran/gp |
Maximum likelihood estimation of the generalized Poisson distribution. Regression modelling is also supported.
| Package: | gp | |
| Type: | Package | |
| Version: | 1.1 | |
| Date: | 2023-10-23 | |
| License: | GPL-2 |
Michail Tsagris [email protected].
Michail Tsagris [email protected].
Nikoloulopoulos A.K. & Karlis D. (2008). On modeling count data: a comparison of some well-known discrete distributions. Journal of Statistical Computation and Simulation, 78(3): 437–457. Consul P.C. & Famoye F. (1992). Generalized poisson regression model. Communications in Statistics - Theory and Methods, 21(1): 89–109.
Cumulative probability mass of the generalized Poisson distribution.
pgp(y, theta, lambda)pgp(y, theta, lambda)
y |
A vector with non negative integer values. |
theta |
The value of the |
lambda |
The value of the |
The cumulative probability mass of the generealized Poisson distribution is computed.
A vector with the probabilities.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Nikoloulopoulos A.K. & Karlis D. (2008). On modeling count data: a comparison of some well-known discrete distributions. Journal of Statistical Computation and Simulation, 78(3): 437–457.
Demirtas H. (2017). On accurate and precise generation of generalized Poisson variates. Communications in Statistics - Simulation and Computation, 46(1): 489–499.
y <- rgp(1000, 10, 0.5, method = "Inversion") a <- gp.mle(y) pgp(y[1:10], a[1], a[2])y <- rgp(1000, 10, 0.5, method = "Inversion") a <- gp.mle(y) pgp(y[1:10], a[1], a[2])
Density computation of the generalized Poisson distribution.
dgp(y, theta, lambda, logged = TRUE)dgp(y, theta, lambda, logged = TRUE)
y |
A vector with non negative integer values. |
theta |
The value of the |
lambda |
The value of the |
logged |
Should the logarithm of the density values be computed? The default value is TRUE. |
The density of the generealized Poisson distribution is computed.
A vector with the logged density values.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Nikoloulopoulos A.K. & Karlis D. (2008). On modeling count data: a comparison of some well-known discrete distributions. Journal of Statistical Computation and Simulation, 78(3): 437–457.
Demirtas H. (2017). On accurate and precise generation of generalized Poisson variates. Communications in Statistics - Simulation and Computation, 46(1): 489–499.
y <- rgp(1000, 10, 0.5, method = "Inversion") a <- gp.mle(y) f <- dgp(y, a[1], a[2]) sum(f)y <- rgp(1000, 10, 0.5, method = "Inversion") a <- gp.mle(y) f <- dgp(y, a[1], a[2]) sum(f)
Maximum likelihood estimation of the generalized Poisson distribution.
gp.mle(y)gp.mle(y)
y |
A vector with non negative integer values. |
The probability density function of the generalized Poisson distribution is the following (Nikoloulopoulos & Karlis, 2008):
To ensure that is positive we use the "log" link and for to lie within 0 and 1
we use the "logit" link within the optim function.
A vector with three numbers, the and parameters and the value of the log-likelihood.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Nikoloulopoulos A.K. & Karlis D. (2008). On modeling count data: a comparison of some well-known discrete distributions. Journal of Statistical Computation and Simulation, 78(3): 437–457.
y <- rgp(1000, 10, 0.5, method = "Inversion") gp.mle(y)y <- rgp(1000, 10, 0.5, method = "Inversion") gp.mle(y)
Generalized Poisson regression.
gp.reg(y, x, tol = 1e-7) gp.reg2(y, x, tol = 1e-7)gp.reg(y, x, tol = 1e-7) gp.reg2(y, x, tol = 1e-7)
y |
The response variable, a vector with non negative integer values. |
x |
A data.frame or a matrix with the independent variables. |
tol |
The tolerance value to terminate the optimization. |
The loglikelihood of the generalised Poisson distribution when covariates are present is the following (Consul & Famoye, 1992):
where , denotes the sample size, is the number of coefficients, and .
Breslow (1984) suggested the (moment) estimation of a dispersion parameter by equating the chi-square statistic to its degrees of freedom. For the generalised Poisson regression model, this leads to
and we solve this for .
According to Consul and Famoye (1992) we begin by fitting a Poisson regression model and obtain initial values for and . If , it implies that the Poisson regression
model is appropriate and no further estimation needs to be done. However, if , this is used to obtain new values of the estimated by maximizing the log-likelihood. This process is iterated until we obtain a stable solution.
The function as seen below returns the log-likelihood of the initial Poisson regression as well. This is useful if one wants to test, via the log-likelihood ratio test as 1 degree of freedom, if the generalized Poisson regression is to be preferred over the Poisson regression.
gp.reg() estimates the coefficients using Newton-Raphson, whereas gp.reg2() uses the optim function. For some reason these two do not always agree. One might yield higher log-likelihood than the other and this is why I offer both ways.
A list including:
pois.loglik |
The initial Poisson regression log-likelihood. |
gp.loglik |
The generalized Poisson regression log-likelihood. |
be |
The estimated |
phi |
The estimated |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Consul P.C. & Famoye F. (1992). Generalized poisson regression model. Communications in Statistics - Theory and Methods, 21(1): 89–109.
Breslow N. E. (1984). Extra-Poisson variation in log-linear models. Journal of the Royal Statistical Society: Series C (Applied Statistics), 33(1): 38–44.
n <- 500 x <- matrix (rnorm(n * 2), nrow = n, ncol = 2) be <- c(1, 1) mi <- x[, 1] * be[1] + x[, 2] * be[2] + 1 mi <- exp(mi) y <- numeric(n) for (i in 1:n) y[i] <- rgp(2, mi[i], 0.5, method = "Inversion")[1] gp.reg(y, x) gp.reg2(y, x)n <- 500 x <- matrix (rnorm(n * 2), nrow = n, ncol = 2) be <- c(1, 1) mi <- x[, 1] * be[1] + x[, 2] * be[2] + 1 mi <- exp(mi) y <- numeric(n) for (i in 1:n) y[i] <- rgp(2, mi[i], 0.5, method = "Inversion")[1] gp.reg(y, x) gp.reg2(y, x)
Random values simulation from the generalized Poisson distribution.
rgp(n, theta, lambda, method)rgp(n, theta, lambda, method)
n |
The number of random values to generate. |
theta |
The value of the |
lambda |
The value of the |
method |
The simulation method to use. The available options are: "Inversion", "Branching", "Normal-Approximation", "Build-Up" and "Chop-Down". |
The values and affect the method of simulation to use.
See Li et al. (2020) for more information.
A vector with values from the generalized Poisson distribution.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Li H., Demirtas H. & Chen R. (2020). RNGforGPD: An R Package for Generation of Univariate and Multivariate Generalized Poisson Data. R JOURNAL, 12(2): 173–188.
Demirtas H. (2017). On accurate and precise generation of generalized Poisson variates. Communications in Statistics - Simulation and Computation, 46(1): 489–499.
y <- rgp(1000, 10, 0.5, method = "Inversion") gp.mle(y)y <- rgp(1000, 10, 0.5, method = "Inversion") gp.mle(y)