weibullMlink: Link functions for the mean of 2-parameter continuous...

View source: R/2ParamMeanlinks.R

weibullMlinkR Documentation

Link functions for the mean of 2–parameter continuous distributions: The Weibull distribution.

Description

Computes the weibullMlink transformation, its inverse and the first two derivatives.

Usage

       weibullMlink(theta, shape = NULL, wrt.param = NULL,
                    bvalue = NULL, inverse = FALSE,
                    deriv = 0, short = TRUE, tag = FALSE)
                       

Arguments

theta

Numeric or character. This is \theta ('scale' parameter) but it may be \eta depending on the other parameters. See below for further details.

shape

The shape parameter. Required for this link to work. See weibullRff.

wrt.param

Positive integer, either 1 or 2. The partial derivatives are computed with respect to one of the two linear predictors involved with this link. Further details listed below.

bvalue, inverse, deriv, short, tag

See Links.

Details

This is the link for the mean of the 2–parameter Weibull distribution, also known as the weibullMlink transformation. It can only be used within weibullRff and is defined as

\tt{weibullMlink}(\beta; \alpha) = \eta(\beta; \alpha) = \log [\beta \cdot \Gamma (1 + 1/\alpha)],

for given \alpha ('shape' parameter) where \beta > 0 is the scale parameter. weibullMlink is expressly a function of \beta, i.e. \theta, therefore \alpha (shape) must be entered at every call.

Numerical values of \alpha or \beta out of range may result in Inf, -Inf, NA or NaN.

Value

For deriv = 0, the weibmeanlnik transformation of theta, i.e., \beta, when inverse = FALSE. If inverse = TRUE, then \theta becomes \eta, and the inverse, \exp\left( theta - \log \Gamma(1 + 1/ \alpha)\right), for given \alpha, is returned.

When deriv = 1 theta becomes \theta = (\beta, \alpha)= (\theta_1, \theta_2), and \eta = (\eta_1, \eta_2) with \eta_2 = \log~\alpha, and the argument wrt.param must be considered:

A) If inverse = FALSE, then d eta1 / d \beta is returned when wrt.param = 1, and d eta1 / d \alpha if wrt.param = 2.

B) For inverse = TRUE, this function returns d \beta / d eta1 and d \alpha / d eta1 conformably arranged in a matrix, if wrt.param = 1, as a function of \theta_i, i = 1, 2. When wrt.param = 2, a matrix with columns d\beta / d eta2 and d\alpha / d eta2 is returned.

For deriv = 2, the second derivatives in terms of theta are likewise 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

weibullQlink, weibullRff, weibullR, lgamma, Links.

Examples

    eta <- seq(-3, 3, by = 0.1) # this is eta = log(mu(b, a)).
    shape  <- exp(1)    # 'shape' argument.
 
 ## E1. Get 'scale' values with A WARNING (not the same length)!
   theta <- weibullMlink(theta = eta, shape = shape, inverse = TRUE)  # Scale
   
 ## Not run: 
 ## E2. Plot theta vs. eta, 'shape' fixed.
 plot(theta, eta, type = "l", ylab = "", col = "blue",
      main = paste0("weibullMlink(theta; shape = ",
                    round(shape, 3), ")"))
  abline(h = -3:3, v = 0, col = "gray", lty = "dashed")
 
## End(Not run)
 
 ## E3. weibullMlink() and its inverse ##
    etabis  <- weibullMlink(theta = theta, shape = shape, inverse = FALSE)
    summary(eta - etabis)     # Should be 0

VGAMextra documentation built on Nov. 2, 2023, 5:59 p.m.