| expMlink {VGAMextra} | R Documentation |
Link functions for the mean of 1–parameter continuous distributions: The exponential distribution.
Description
Computes the expMlink transformation, its inverse and
the first two derivatives.
Usage
expMlink(theta, location = 0, bvalue = NULL, inverse = FALSE,
deriv = 0, short = TRUE, tag = FALSE)
Arguments
theta |
Numeric or character. This is |
location |
This is a known location parameter.
Same as |
bvalue, inverse, deriv, short, tag |
See |
Details
This is a link function to model the mean of the exponential
distribution, exponential.
It is defined as
\eta = \log (A + \lambda^{-1}),
where \lambda > 0 is a rate parameter and A is a
known location parameter,
same as exponential.
Numerical values of \lambda out of range may
result in Inf, -Inf, NA or NaN.
Value
For deriv = 0, the expMlink transformation of
theta when inverse = FALSE.
If inverse = TRUE, then the inverse exp(theta - A)^(-1).
For deriv = 1,
d eta / d theta when inverse = FALSE.
If inverse = TRUE, then
d theta / d eta as a function of
theta.
Similarly, when deriv = 2, the second derivatives in
terms of theta are returned.
Note
Numerical instability may occur for values theta too close
to zero. Use argument bvalue to replace them before
computing the link.
If theta is character, then arguments inverse and
deriv are ignored. See Links
for further details.
Author(s)
V. Miranda and Thomas W. Yee.
See Also
Examples
## E1. Modelling the mean of the exponential distribution ##
set.seed(17010402)
nn <- 100
edata <- data.frame(x2 = runif(nn) - 0.5, x3 = runif(nn) - 0.5)
edata <- transform(edata, eta = 0.2 - 0.7 * x2 + 1.9 * x3)
#----- The mean is a function of 'x2' and 'x3' ------#
edata <- transform(edata, rate = expMlink(eta, inverse = TRUE))
edata <- transform(edata, y = rexp(nn, rate = rate))
with(edata, stem(y))
with(edata, hist(y))
exp.fit <- vglm(y ~ x2 + x3, exponential(link = "expMlink"),
data = edata, zero = NULL, trace = TRUE, crit = "log")
coef(exp.fit, matrix = TRUE)
summary(exp.fit)
## E2. expMlink() and its inverse ##
theta <- 0.1 + 1:5
location <- 1.5
my.diff <- theta - expMlink(expMlink(theta = theta,
location = location), location = location, inverse =TRUE)
summary(my.diff) # Zero
## E3. Special values in a matrix ##
theta <- matrix(c(Inf, -Inf, NA, NaN, 1 , 2), ncol = 3, nrow = 2)
expMlink(theta = theta, location = location)