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

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

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

Usage

1
2
3
4
        gammaRMlink(theta, shape = NULL, wrt.param = NULL,
                    bvalue = NULL, inverse = FALSE,
                    deriv = 0, short = TRUE, tag = FALSE)
                       

Arguments

theta

Numeric or character. This is theta ('rate' parameter) but iy may be η depending on the other parameters. See below for further details.

shape

The shape parameter. Same as gammaRff.

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

The link to model the mean of the 2–parameter gamma distribution.

The gammaRMlink transformation, for given α ('shape' parameter), is defined as

η = η(α; β) = log (α/β),

where β > 0 is a rate parameter. This link is expressly a function of β, i.e. θ, therefore α (shape) must be entered at every call.

Numerical values of α or β out of range may result in Inf, -Inf, NA or NaN.

Value

For deriv = 0, the gammaRMlink transformation of theta, i.e. β, when inverse = FALSE. If inverse = TRUE, then θ becomes η, and the inverse, α * exp(-theta), for given α, is returned.

For deriv = 1, theta becomes θ = (β, α)=(θ1, θ2), and η = (η1, η2), and then, the argument wrt.param must be considered:

A) If inverse = FALSE, then d eta1 / d theta1 when wrt.param = 1, and d eta1 / d theta2 if wrt.param = 2.

B) For inverse = TRUE, this function returns d theta1 / d eta1 and d theta2 / d eta1 conformably arranged in a matrix, if wrt.param = 1, as a function of θi, i = 1, 2. Also, when wrt.param = 2, a matrix with columns dtheta1 / d eta2 and dtheta2 / d eta2 is returned.

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

gammaRff, gammaR, Links.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
    eta <- seq(-3, 3, by = 0.1) # this is eta = log(mu(b, a)).
    shape  <- rep(exp(0.8), length(eta))    # 'shape' argument.
 
 ## E1. Get 'rate' values.
   theta <- gammaRMlink(theta = eta, shape = shape, inverse = TRUE)  # rate
   
 ## Not run: 
 ## E2. Plot theta vs. eta, 'shape' fixed.
   plot(theta, eta, type = "l", las = 1, ylab = "", 
   main = "gammaRMlink(theta; shape)")
 
## End(Not run)
 
 ## E3. gammaRMlink() and its inverse ##
    etabis  <- gammaRMlink(theta = theta, shape = shape, inverse = FALSE)
    my.diff <- eta - etabis
    summary(my.diff)     # Zero
    
  ## E4. Special values arranged in a matrix ##
    bbeta <- matrix(eta[1:9], ncol = 3, nrow = 3)  #Ensure equal dimensions. 
    alpha <- matrix(c(Inf, -Inf, NA, NaN, -1 , 1, 0, -2, 2), ncol = 3, nrow = 3)
    # The gammaRMlink transformation (log(a/b))
    gammaRMlink(theta = bbeta, shape = alpha, inv = FALSE)   # NaNs produced.
    # Same as
    log(alpha/bbeta)
    

VGAMextra documentation built on May 24, 2021, 9:07 a.m.