dispersion_initial function

Create a dispersion parameter initial object

Create a dispersion parameter initial object

Create a dispersion parameter initial object that specifies initial and/or known values to use while estimating the dispersion parameter with spglm() or spgautor().

dispersion_initial(family, dispersion, known)

Arguments

  • family: The generalized linear model family describing the distribution of the response variable to be used. "poisson", "nbinomial", "binomial", "beta", "Gamma", and "inverse.gaussian".
  • dispersion: The value of the dispersion parameter.
  • known: A character vector indicating whether the dispersion parameter is to be assumed known. The value "dispersion" or "given" is assumes the dispersion parameter is known.

Returns

A list with two elements: initial and is_known. initial is a named numeric vector indicating the dispersion parameters with a specified initial and/or known value. is_known is a named numeric vector indicating whether the dispersion parameters in initial is known or not. The class of the list matches the value given to the family argument.

Details

The dispersion_initial list is later passed to spglm() or spgautor().

The variance function of an individual yy (given μ\mu) for each generalized linear model family is given below:

  • family: Var(y)Var(y)
  • poisson: μϕ\mu \phi
  • nbinomial: μ+μ2/ϕ\mu + \mu^2 / \phi
  • binomial: nμ(1μ)ϕn \mu (1 - \mu) \phi
  • beta: μ(1μ)/(1+ϕ)\mu (1 - \mu) / (1 + \phi)
  • Gamma: μ2/ϕ\mu^2 / \phi
  • inverse.gaussian: μ2/ϕ\mu^2 / \phi

The parameter ϕ\phi is a dispersion parameter that influences Var(y)Var(y). For the poisson and binomial families, ϕ\phi is always one. Note that this inverse Gaussian parameterization is different than a standard inverse Gaussian parameterization, which has variance μ3/λ\mu^3 / \lambda. Setting ϕ=λ/μ\phi = \lambda / \mu yields our parameterization, which is preferred for computational stability. Also note that the dispersion parameter is often defined in the literature as V(μ)ϕV(\mu) \phi, where V(μ)V(\mu) is the variance function of the mean. We do not use this parameterization, which is important to recognize while interpreting dispersion parameter estimates using spglm() or spgautor(). For more on generalized linear model constructions, see McCullagh and Nelder (1989).

Examples

# known dispersion value 1 dispersion_initial("nbinomial", dispersion = 1, known = "dispersion")

References

McCullagh P. and Nelder, J. A. (1989) Generalized Linear Models. London: Chapman and Hall.

  • Maintainer: Michael Dumelle
  • License: GPL-3
  • Last published: 2025-03-12