Produces a Digamma generalized linear model family object. The Digamma distribution is the distribution of the unit deviance for a gamma response.
Digamma(link = "log")
unitdeviance.digamma(y, mu)
cumulant.digamma(theta)
meanval.digamma(theta)
d2cumulant.digamma(theta)
varfun.digamma(mu)
canonic.digamma(mu)
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.
character string, number or expressing specifying the link function. See quasi
for specification of this argument.
numeric vector of (positive) response values
numeric vector of (positive) fitted values
numeric vector of values of the canonical variable, equal to \(-1/\phi\) where \(\phi\) is the dispersion parameter of the gamma distribution
Gordon Smyth
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 \(\mu\) and dispersion parameter \(\phi\), so the variance of \(y\) is \(\phi \mu^2\).
Write \(d(y,\mu)\) for the gamma distribution unit deviance.
Then meanval.digamma(-1/phi)
gives the mean of \(d(y,\mu)\) and 2*d2cumulant.digamma(-1/phi)
gives the variance.
Smyth, G. K. (1989). Generalized linear models with varying dispersion. J. R. Statist. Soc. B, 51, 47-61. tools:::Rd_expr_doi("10.1111/j.2517-6161.1989.tb01747.x")
# 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)
Run the code above in your browser using DataLab