quasipois.RdThe function fits the log linear model (“Procedure II”) proposed by Breslow (1984) accounting for overdispersion in counts \(y\).
quasipois(formula, data, phi = NULL, tol = 0.001)A formula for the fixed effects. The left-hand side of the formula must be the counts y i.e.,
positive integers (y >= 0). The right-hand side can involve an offset term.
A data frame containing the response (y) and explanatory variable(s).
When phi is NULL (the default), the overdispersion parameter \(\phi\) is estimated from the data.
Otherwise, its value is considered as fixed.
A positive scalar (default to 0.001). The algorithm stops at iteration \(r + 1\) when the condition \(\chi{^2}[r+1] - \chi{^2}[r] <= tol\) is met by the \(\chi^2\) statistics .
For a given count \(y\), the model is:
$$y~|~\lambda \sim Poisson(~\lambda)$$
with \(\lambda\) a random variable of mean \(E[\lambda] = \mu\)
and variance \(Var[\lambda] = \phi * \mu^2\).
The marginal mean and variance are:
$$E[y] = \mu$$
$$Var[y] = \mu + \phi * \mu^2$$
The function uses the function glm and the parameterization: \(\mu = exp(X b) = exp(\eta)\), where \(X\)
is a design-matrix, \(b\) is a vector of fixed effects and \(\eta = X b\) is the linear predictor.
The estimate of \(b\) maximizes the quasi log-likelihood of the marginal model.
The parameter \(\phi\) is estimated with the moment method or can be set to a constant
(a regular glim is fitted when \(\phi\) is set to 0). The literature recommends to estimate \(\phi\)
with the saturated model. Several explanatory variables are allowed in \(b\). None is allowed in \(\phi\).
An offset can be specified in the argument formula to model rates \(y/T\) (see examples). The offset and the
marginal mean are \(log(T)\) and \(\mu = exp(log(T) + \eta)\), respectively.
An object of formal class “glimQL”: see glimQL-class for details.
Breslow, N.E., 1984. Extra-Poisson variation in log-linear models. Appl. Statist. 33, 38-44.
Moore, D.F., Tsiatis, A., 1991. Robust estimation of the variance in moment methods for extra-binomial
and extra-poisson variation. Biometrics 47, 383-401.
glm, negative.binomial in the recommended package MASS,
geese in the contributed package geepack,
glm.poisson.disp in the contributed package dispmod.
# without offset
data(salmonella)
quasipois(y ~ log(dose + 10) + dose,
data = salmonella)
#> Quasi-likelihood generalized linear model
#> -----------------------------------------
#> quasipois(formula = y ~ log(dose + 10) + dose, data = salmonella)
#>
#> Fixed-effect coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 2.2031 0.3636 6.0591 < 1e-4
#> log(dose + 10) 0.3110 0.0991 3.1394 0.0017
#> dose -0.0010 0.0004 -2.2284 0.0259
#>
#> Overdispersion parameter:
#> phi
#> 0.0718
#>
#> Pearson's chi-squared goodness-of-fit statistic = 15.0004
#>
quasipois(y ~ log(dose + 10) + dose,
data = salmonella, phi = 0.07180449)
#> Quasi-likelihood generalized linear model
#> -----------------------------------------
#> quasipois(formula = y ~ log(dose + 10) + dose, data = salmonella,
#> phi = 0.07180449)
#>
#> Fixed-effect coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 2.2031 0.3636 6.0591 < 1e-4
#> log(dose + 10) 0.3110 0.0991 3.1394 0.0017
#> dose -0.0010 0.0004 -2.2284 0.0259
#>
#> Overdispersion parameter:
#> phi
#> 0.0718
#>
#> Pearson's chi-squared goodness-of-fit statistic = 15.0004
#>
summary(glm(y ~ log(dose + 10) + dose,
family = poisson, data = salmonella))
#>
#> Call:
#> glm(formula = y ~ log(dose + 10) + dose, family = poisson, data = salmonella)
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 2.1727730 0.2184269 9.947 < 2e-16 ***
#> log(dose + 10) 0.3198250 0.0570014 5.611 2.01e-08 ***
#> dose -0.0010130 0.0002452 -4.131 3.61e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> (Dispersion parameter for poisson family taken to be 1)
#>
#> Null deviance: 78.358 on 17 degrees of freedom
#> Residual deviance: 43.716 on 15 degrees of freedom
#> AIC: 142.25
#>
#> Number of Fisher Scoring iterations: 4
#>
quasipois(y ~ log(dose + 10) + dose,
data = salmonella, phi = 0)
#> Quasi-likelihood generalized linear model
#> -----------------------------------------
#> quasipois(formula = y ~ log(dose + 10) + dose, data = salmonella,
#> phi = 0)
#>
#> Fixed-effect coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 2.1728 0.2184 9.9474 < 1e-4
#> log(dose + 10) 0.3198 0.0570 5.6108 < 1e-4
#> dose -0.0010 0.0002 -4.1311 < 1e-4
#>
#> Overdispersion parameter:
#> phi
#> 0
#>
#> Pearson's chi-squared goodness-of-fit statistic = 46.2707
#>
# with offset
data(cohorts)
i <- cohorts$age ; levels(i) <- 1:7
j <- cohorts$period ; levels(j) <- 1:7
i <- as.numeric(i); j <- as.numeric(j)
cohorts$cohort <- j + max(i) - i
cohorts$cohort <- as.factor(1850 + 5 * cohorts$cohort)
fm1 <- quasipois(y ~ age + period + cohort + offset(log(n)),
data = cohorts)
fm1
#> Quasi-likelihood generalized linear model
#> -----------------------------------------
#> quasipois(formula = y ~ age + period + cohort + offset(log(n)),
#> data = cohorts)
#>
#> Fixed-effect coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -8.0269 0.0750 -106.9987 < 1e-4
#> age55- 0.7222 0.0432 16.7251 < 1e-4
#> age60- 1.3511 0.0463 29.1893 < 1e-4
#> age65- 1.8291 0.0523 35.0026 < 1e-4
#> age70- 2.2917 0.0604 37.9489 < 1e-4
#> age75- 2.6606 0.0698 38.0943 < 1e-4
#> age80- 2.8568 0.0750 38.0816 < 1e-4
#> period1940- 0.1134 0.0448 2.5337 0.0113
#> period1945- 0.2490 0.0473 5.2633 < 1e-4
#> period1950- 0.3920 0.0529 7.4086 < 1e-4
#> period1955- 0.4630 0.0606 7.6418 < 1e-4
#> period1960- 0.5186 0.0695 7.4648 < 1e-4
#> period1965- 0.6386 0.0750 8.5130 < 1e-4
#> cohort1860 0.2453 0.1249 1.9643 0.0495
#> cohort1865 0.2928 0.1099 2.6644 0.0077
#> cohort1870 0.4258 0.0996 4.2732 < 1e-4
#> cohort1875 0.5545 0.0919 6.0317 < 1e-4
#> cohort1880 0.5954 0.0857 6.9451 < 1e-4
#> cohort1885 0.6436 0.0798 8.0611 < 1e-4
#> cohort1890 0.7819 0.0793 9.8547 < 1e-4
#> cohort1895 0.7082 0.0796 8.8992 < 1e-4
#> cohort1900 0.6599 0.0818 8.0692 < 1e-4
#> cohort1905 0.4080 0.0870 4.6919 < 1e-4
#> cohort1910 0.2246 0.0955 2.3511 0.0187
#> cohort1915 NA NA NA <NA>
#>
#> Overdispersion parameter:
#> phi
#> 0.0033
#>
#> Pearson's chi-squared goodness-of-fit statistic = 25.0004
#>
quasipois(y ~ age + cohort + offset(log(n)),
data = cohorts, phi = fm1@phi)
#> Quasi-likelihood generalized linear model
#> -----------------------------------------
#> quasipois(formula = y ~ age + cohort + offset(log(n)), data = cohorts,
#> phi = fm1@phi)
#>
#> Fixed-effect coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -8.6441 0.1236 -69.9115 < 1e-4
#> age55- 0.8225 0.0436 18.8858 < 1e-4
#> age60- 1.5490 0.0441 35.1408 < 1e-4
#> age65- 2.1276 0.0450 47.2789 < 1e-4
#> age70- 2.6960 0.0466 57.8405 < 1e-4
#> age75- 3.1715 0.0487 65.0778 < 1e-4
#> age80- 3.4741 0.0520 66.8309 < 1e-4
#> cohort1860 0.3550 0.1312 2.7055 0.0068
#> cohort1865 0.5194 0.1237 4.1982 < 1e-4
#> cohort1870 0.7743 0.1208 6.4082 < 1e-4
#> cohort1875 1.0121 0.1196 8.4596 < 1e-4
#> cohort1880 1.1508 0.1190 9.6676 < 1e-4
#> cohort1885 1.2996 0.1187 10.9467 < 1e-4
#> cohort1890 1.5449 0.1206 12.8121 < 1e-4
#> cohort1895 1.5749 0.1217 12.9435 < 1e-4
#> cohort1900 1.6271 0.1232 13.2088 < 1e-4
#> cohort1905 1.4643 0.1260 11.6223 < 1e-4
#> cohort1910 1.3720 0.1314 10.4435 < 1e-4
#> cohort1915 1.2559 0.1479 8.4940 < 1e-4
#>
#> Overdispersion parameter:
#> phi
#> 0.0033
#>
#> Pearson's chi-squared goodness-of-fit statistic = 31.9015
#>