Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

erlang

Erlang Distribution


Description

Estimates the scale parameter of the Erlang distribution by maximum likelihood estimation.

Usage

erlang(shape.arg, lscale = "loglink", imethod = 1, zero = NULL)

Arguments

shape.arg

The shape parameters. The user must specify a positive integer, or integers for multiple responses. They are recycled by.row = TRUE according to matrix.

lscale

Link function applied to the (positive) scale parameter. See Links for more choices.

imethod, zero

See CommonVGAMffArguments for more details.

Details

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

f(y) = exp(-y/scale) y^(shape-1) scale^(-shape) / gamma(shape)

for known positive integer shape, unknown scale > 0 and y > 0. Here, gamma(shape) is the gamma function, as in gamma. The mean of Y is mu=shape*scale and its variance is shape*scale^2. The linear/additive predictor, by default, is eta=log(scale).

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.

Note

Multiple responses are permitted. The rate parameter found in gammaR is 1/scale here—see also rgamma.

Author(s)

T. W. Yee

References

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.

See Also

Examples

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)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.