Estimates the 2-parameter gamma distribution by maximum likelihood estimation.
gamma2(lmu = "loge", lshape = "loge",
imethod = 1, ishape = NULL,
parallel = FALSE, deviance.arg = FALSE, zero = "shape")
Link functions applied to the (positive) mu and shape
parameters (called Links
for more choices.
Optional initial value for shape.
A NULL
means a value is computed internally.
If a failure to converge occurs, try using this argument.
This argument is ignored if used within cqo
; see the
iShape
argument of qrrvglm.control
instead.
An integer with value 1
or 2
which
specifies the initialization method for the ishape
).
Logical. If TRUE
, the deviance function
is attached to the object. Under ordinary circumstances, it should
be left alone because it really assumes the shape parameter is at
the maximum likelihood estimate. Consequently, one cannot use that
criterion to minimize within the IRLS algorithm.
It should be set TRUE
only when used with cqo
under the fast algorithm.
See CommonVGAMffArguments
for information.
Details at CommonVGAMffArguments
.
If parallel = TRUE
then the constraint is not applied to the intercept.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
This distribution can model continuous skewed responses.
The density function is given by
gamma
.
The mean of Y is lshape="loglog"
.
By default, the two linear/additive predictors are
This VGAM family function handles multivariate responses,
so that a matrix can be used as the response. The number of columns is
the number of species, say, and zero=-2
means that all
species have a shape parameter equalling a (different) intercept only.
The parameterization of this VGAM family function is the 2-parameter gamma distribution described in the monograph
McCullagh, P. and Nelder, J. A. (1989) Generalized Linear Models, 2nd ed. London: Chapman & Hall.
gamma1
for the 1-parameter gamma distribution,
gammaR
for another parameterization of
the 2-parameter gamma distribution that is directly matched
with rgamma
,
bigamma.mckay
for a bivariate gamma distribution,
expexpff
,
GammaDist
,
golf
,
CommonVGAMffArguments
,
simulate.vlm
,
negloge
.
# NOT RUN {
# Essentially a 1-parameter gamma
gdata <- data.frame(y = rgamma(n = 100, shape = exp(1)))
fit1 <- vglm(y ~ 1, gamma1, data = gdata)
fit2 <- vglm(y ~ 1, gamma2, data = gdata, trace = TRUE, crit = "coef")
coef(fit2, matrix = TRUE)
c(Coef(fit2), colMeans(gdata))
# Essentially a 2-parameter gamma
gdata <- data.frame(y = rgamma(n = 500, rate = exp(-1), shape = exp(2)))
fit2 <- vglm(y ~ 1, gamma2, data = gdata, trace = TRUE, crit = "coef")
coef(fit2, matrix = TRUE)
c(Coef(fit2), colMeans(gdata))
summary(fit2)
# }
Run the code above in your browser using DataLab