quasipois: Quasi-Likelihood Model for Counts

View source: R/quasipois.R

quasipoisR Documentation

Quasi-Likelihood Model for Counts

Description

The function fits the log linear model (“Procedure II”) proposed by Breslow (1984) accounting for overdispersion in counts y.

Usage

quasipois(formula, data, phi = NULL, tol = 0.001)

Arguments

formula

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.

data

A data frame containing the response (y) and explanatory variable(s).

phi

When phi is NULL (the default), the overdispersion parameter φ is estimated from the data. Otherwise, its value is considered as fixed.

tol

A positive scalar (default to 0.001). The algorithm stops at iteration r + 1 when the condition χ{^2}[r+1] - χ{^2}[r] <= tol is met by the chi-squared statistics .

Details

For a given count y, the model is:

y | λ ~ Poisson(λ)

with λ a random variable of mean E[λ] = μ and variance Var[λ] = φ * μ^2.
The marginal mean and variance are:

E[y] = μ

Var[y] = μ + φ * μ^2

The function uses the function glm and the parameterization: μ = exp(X b) = exp(η), where X is a design-matrix, b is a vector of fixed effects and η = X b is the linear predictor.
The estimate of b maximizes the quasi log-likelihood of the marginal model. The parameter φ is estimated with the moment method or can be set to a constant (a regular glim is fitted when φ is set to 0). The literature recommends to estimate φ with the saturated model. Several explanatory variables are allowed in b. None is allowed in φ.
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 μ = exp(log(T) + η), respectively.

Value

An object of formal class “glimQL”: see glimQL-class for details.

Author(s)

Matthieu Lesnoff matthieu.lesnoff@cirad.fr, Renaud Lancelot renaud.lancelot@cirad.fr

References

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.

See Also

glm, negative.binomial in the recommended package MASS, geese in the contributed package geepack, glm.poisson.disp in the contributed package dispmod.

Examples

  # without offset
  data(salmonella)
  quasipois(y ~ log(dose + 10) + dose,
            data = salmonella)
  quasipois(y ~ log(dose + 10) + dose, 
            data = salmonella, phi = 0.07180449)
  summary(glm(y ~ log(dose + 10) + dose,
          family = poisson, data = salmonella))
  quasipois(y ~ log(dose + 10) + dose,
          data = salmonella, phi = 0)
  # 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
  quasipois(y ~ age + cohort + offset(log(n)),
            data = cohorts, phi = fm1@phi)
  

aod documentation built on April 2, 2022, 9:05 a.m.

Related to quasipois in aod...