Estimates the scale parameter of the Erlang distribution by maximum likelihood estimation.
erlang(shape.arg, lscale = "loglink", imethod = 1, zero = NULL)
The shape parameters.
The user must specify a positive integer, or integers for multiple responses.
They are recycled by.row = TRUE
according to matrix
.
Link function applied to the (positive) Links
for more choices.
See CommonVGAMffArguments
for more details.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
The Erlang distribution is a special case of the gamma distribution
with shape that is a positive integer. If shape.arg = 1
then it simplifies to the exponential distribution. As illustrated
in the example below, the Erlang distribution is the distribution of
the sum of shape.arg
independent and identically distributed
exponential random variates.
The probability density function of the Erlang
distribution is given by
gamma
.
The mean of Y
is
Most standard texts on statistical distributions describe this distribution, e.g.,
Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.
# NOT RUN {
rate <- exp(2); myshape <- 3
edata <- data.frame(y = rep(0, nn <- 1000))
for (ii in 1:myshape)
edata <- transform(edata, y = y + rexp(nn, rate = rate))
fit <- vglm(y ~ 1, erlang(shape = myshape), data = edata, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit) # Answer = 1/rate
1/rate
summary(fit)
# }
Run the code above in your browser using DataLab