Learn R Programming

VGAMextra (version 0.0-6)

expMlink: 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)

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.

Arguments

theta

Numeric or character. This is \(\theta\) although may be \(\eta\) depending on the other parameters. See below for further details.

location

This is a known location parameter. Same as location in exponential.

bvalue, inverse, deriv, short, tag

See Links.

Author

V. Miranda and Thomas W. Yee.

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.

See Also

exponential, Links.

Examples

Run this code
 ##  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)

Run the code above in your browser using DataLab