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

exponential

Exponential Distribution


Description

Maximum likelihood estimation for the exponential distribution.

Usage

exponential(link = "loglink", location = 0, expected = TRUE,
            type.fitted = c("mean", "percentiles", "Qlink"),
            percentiles = 50,
            ishrinkage = 0.95, parallel = FALSE, zero = NULL)

Arguments

link

Parameter link function applied to the positive parameter rate. See Links for more choices.

location

Numeric of length 1, the known location parameter, A, say.

expected

Logical. If TRUE Fisher scoring is used, otherwise Newton-Raphson. The latter is usually faster.

ishrinkage, parallel, zero

See CommonVGAMffArguments for information.

type.fitted, percentiles

See CommonVGAMffArguments for information.

Details

The family function assumes the response Y has density

f(y) = rate * exp(-rate * (y-A))

for y > A, where A is the known location parameter. By default, A=0. Then E(Y) = A + 1/rate and Var(Y) = 1/rate^2.

Value

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

Note

Suppose A = 0. For a fixed time interval, the number of events is Poisson with mean rate if the time between events has a geometric distribution with mean 1/rate. The argument rate in exponential is the same as rexp etc. The argument lambda in rpois is somewhat the same as rate here.

Author(s)

T. W. Yee

References

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.

See Also

Examples

edata <- data.frame(x2 = runif(nn <- 100) - 0.5)
edata <- transform(edata, x3 = runif(nn) - 0.5)
edata <- transform(edata, eta = 0.2 - 0.7 * x2 + 1.9 * x3)
edata <- transform(edata, rate = exp(eta))
edata <- transform(edata, y = rexp(nn, rate = rate))
with(edata, stem(y))

fit.slow <- vglm(y ~ x2 + x3, exponential, data = edata, trace = TRUE)
fit.fast <- vglm(y ~ x2 + x3, exponential(exp = FALSE), data = edata,
                 trace = TRUE, crit = "coef")
coef(fit.slow, mat = TRUE)
summary(fit.slow)


# Compare results with a GPD. Has a threshold.
threshold <- 0.5
gdata <- data.frame(y1 = threshold + rexp(n = 3000, rate = exp(1.5)))

fit.exp <- vglm(y1 ~ 1, exponential(location = threshold), data = gdata)
coef(fit.exp, matrix = TRUE)
Coef(fit.exp)
logLik(fit.exp)

fit.gpd <- vglm(y1 ~ 1, gpd(threshold =  threshold), data = gdata)
coef(fit.gpd, matrix = TRUE)
Coef(fit.gpd)
logLik(fit.gpd)

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.