expMeanlink {VGAMextra} | R Documentation |
Computes the expMeanlink
transformation, its inverse and
the first two derivatives.
expMeanlink(theta, location = 0, bvalue = NULL, inverse = FALSE, deriv = 0, short = TRUE, tag = FALSE)
theta |
Numeric or character. This is theta although may be η depending on the other parameters. See below for further details. |
location |
This is a known location parameter.
Same as |
bvalue, inverse, deriv, short, tag |
See |
This is a link function to model the mean of the exponential
distribution, exponential
.
It is defined as
η = log (A + rate^(-1)),
where rate > 0 is a rate parameter and A is a
known location parameter,
same as exponential
.
Numerical values of rate out of range may
result in Inf
, -Inf
, NA
or NaN
.
For deriv = 0
, the expMeanlink
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.
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.
V. Miranda and Thomas W. Yee.
## 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 = expMeanlink(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 = "expMeanlink"), data = edata, zero = NULL, trace = TRUE, crit = "log") coef(exp.fit, matrix = TRUE) summary(exp.fit) ## E2. expMeanlink() and its inverse ## theta <- 0.1 + 1:5 location <- 1.5 my.diff <- theta - expMeanlink(expMeanlink(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) expMeanlink(theta = theta, location = location)