gamma2.ab {VGAM} | R Documentation |
Estimates the 2-parameter gamma distribution by maximum likelihood estimation.
gamma2.ab(lrate = "loge", lshape = "loge", erate=list(), eshape=list(), irate=NULL, ishape=NULL, expected = TRUE, zero = 2)
lrate, lshape |
Link functions applied to the (positive) rate and shape
parameters.
See Links for more choices.
|
erate, eshape |
List. Extra arguments for the links.
See earg in Links for general information.
|
expected |
Logical. Use Fisher scoring? The default is yes, otherwise
Newton-Raphson is used.
|
irate, ishape |
Optional initial values for rate and shape.
A NULL means a value is computed internally.
If a failure to converge occurs, try using these arguments.
|
zero |
An integer specifying which
linear/additive predictor is to be modelled as an intercept only.
If assigned, the single value should be either 1 or 2 or NULL .
The default is to model shape as an intercept only.
A value NULL means neither 1 or 2.
|
The density function is given by
f(y) = exp(-rate * y) y^(shape-1) rate^(shape) / gamma(shape)
for shape > 0, rate > 0 and y > 0.
Here, gamma(shape) is the gamma
function, as in gamma
.
The mean of Y is mu=shape/rate
(returned as the fitted values) with variance
sigma^2 =
mu^2 /shape = shape/rate^2.
By default, the two linear/additive predictors are
eta1=log(rate) and
eta2=log(shape).
The argument expected
refers to the type of information
matrix. The expected information matrix corresponds to Fisher scoring
and is numerically better here. The observed information matrix
corresponds to the Newton-Raphson algorithm and may be withdrawn
from the family function in the future. If both algorithms work then
the differences in the results are often not huge.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
The parameters rate and shape match with the arguments
rate
and shape
of rgamma
. Often,
scale=1/rate is used.
If rate=1 use the family function gamma1
to
estimate shape.
T. W. Yee
Most standard texts on statistical distributions describe the 2-parameter gamma distribution, e.g.,
Evans, M., Hastings, N. and Peacock, B. (2000) Statistical Distributions, New York: Wiley-Interscience, Third edition.
gamma1
for the 1-parameter gamma distribution,
gamma2
for another parameterization of
the 2-parameter gamma distribution,
mckaygamma2
for a bivariate gamma distribution,
expexp
.
# Essentially a 1-parameter gamma y = rgamma(n <- 100, shape= exp(1)) fit1 = vglm(y ~ 1, gamma1, trace=TRUE, crit="c") fit2 = vglm(y ~ 1, gamma2.ab, trace=TRUE, crit="c") coef(fit1, matrix=TRUE) Coef(fit1) coef(fit2, matrix=TRUE) Coef(fit2) # Essentially a 2-parameter gamma y = rgamma(n <- 500, rate=exp(1), shape=exp(2)) fit2 = vglm(y ~ 1, gamma2.ab, trace=TRUE, crit="c") coef(fit2, matrix=TRUE) Coef(fit2) summary(fit2)