digammaf: Digamma Generalized Linear Model Family

DigammaR Documentation

Digamma Generalized Linear Model Family

Description

Produces a Digamma generalized linear model family object. The Digamma distribution is the distribution of the unit deviance for a gamma response.

Usage

Digamma(link = "log")
unitdeviance.digamma(y, mu)
cumulant.digamma(theta)
meanval.digamma(theta)
d2cumulant.digamma(theta)
varfun.digamma(mu)
canonic.digamma(mu)

Arguments

link

character string, number or expressing specifying the link function. See quasi for specification of this argument.

y

numeric vector of (positive) response values

mu

numeric vector of (positive) fitted values

theta

numeric vector of values of the canonical variable, equal to -1/φ where φ is the dispersion parameter of the gamma distribution

Details

This family is useful for dispersion modelling with gamma generalized linear models. The Digamma distribution describes the distribution of the unit deviances for a gamma family, in the same way that the gamma distribution itself describes the distribution of the unit deviances for Gaussian or inverse Gaussian families. The Digamma distribution is so named because it is dual to the gamma distribution in the above sense, and because the digamma function appears in its mean function.

Suppose that y follows a gamma distribution with mean μ and dispersion parameter φ, so the variance of y is φ μ^2. Write d(y,μ) for the gamma distribution unit deviance. Then meanval.digamma(-1/phi) gives the mean of d(y,μ) and 2*d2cumulant.digamma(-1/phi) gives the variance.

Value

Digamma produces a glm family object, which is a list of functions and expressions used by glm in its iteratively reweighted least-squares algorithm. See family for details.

The other functions take vector arguments and produce vector values of the same length and called by Digamma. unitdeviance.digamma gives the unit deviances of the family, equal to the squared deviance residuals. cumulant.digamma is the cumulant function. If the dispersion is unity, then successive derivatives of the cumulant function give successive cumulants of the Digamma distribution. meanvalue.digamma gives the first derivative, which is the expected value. d2cumulant.digamma gives the second derivative, which is the variance. canonic.digamma is the inverse of meanvalue.digamma and gives the canonical parameter as a function of the mean parameter. varfun.digamma is the variance function of the Digamma family, the variance as a function of the mean.

Author(s)

Gordon Smyth

References

Smyth, G. K. (1989). Generalized linear models with varying dispersion. J. R. Statist. Soc. B, 51, 47-61. doi: 10.1111/j.2517-6161.1989.tb01747.x

See Also

quasi, make.link

Examples

# Test for log-linear dispersion trend in gamma regression
y <- rchisq(20,df=1)
x <- 1:20
out.gam <- glm(y~x,family=Gamma(link="log"))
d <- residuals(out.gam)^2
out.dig <- glm(d~x,family=Digamma(link="log"))
summary(out.dig,dispersion=2)

statmod documentation built on Jan. 6, 2023, 5:14 p.m.

Related to digammaf in statmod...