gp.reg {gp} | R Documentation |
Generalized Poisson regression
Description
Generalized Poisson regression.
Usage
gp.reg(y, x, tol = 1e-7)
gp.reg2(y, x, tol = 1e-7)
Arguments
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. |
Details
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.
Value
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 |
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
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.
See Also
Examples
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)