expQlink: Link functions for the quantiles of several 1-parameter...

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

View source: R/expQlink.R

Description

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

Usage

1
2
3
  expQlink(theta, p = stop("Argument 'p' must be entered."),
           bvalue = NULL, inverse = FALSE,
           deriv = 0, short = TRUE, tag = FALSE) 

Arguments

theta

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

p

Numeric. A prespecified number between 0 and 1. The particular p–quantile to be modelled. For example, p = 0.5 means that the median is considered by this link function.

bvalue, inverse, deriv, short, tag

See Links.

Details

This is a link function to model any fixed quantile, say ξ[p], of the exponential distribution. It is called the expQlink transformation and is defined as

-log(1 - p) / rate,

where rate is positive as in exponential.

Numerical values of rate or p out of range may result in Inf, -Inf, NA or NaN.

Value

With deriv = 0, the expQlink transformation of theta for prespecified p when inverse = FALSE. If inverse = TRUE, then the inverse -log(1 - p)/theta.

For deriv = 1, this link function returns 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

exponential, Links.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 ## E1. expQlink() and its inverse ##
    p <- 0.25            # Modelling the first quartile.
    my.theta <- seq(0, 5, by = 0.1)[-1]
    my.diff <- my.theta - expQlink(expQlink(my.theta, p = p), p = p, inverse  =TRUE)
    summary(my.diff)     # Zero


  ## E2. Special values ##
    expQlink(theta = c(Inf, -Inf, NA, NaN), p = p)
    

  ##  E3. Plot of expQlink() for different quantiles  ##
    plot(expQlink(my.theta, p = p) ~ my.theta, 
         type = "l", lty = "dotted", col = "blue", lwd = 2,
         main = "expQink(p) transformation", xlab = "theta", ylab = "expQLink",
         xlim = c(-0.5, 5), ylim = c(-0.5, 5))
    abline(h = 0, v = 0, lwd = 2)
    lines(my.theta, expQlink(my.theta, p = 0.50),  col = "green", lty = "dotted", lwd = 2)
    lines(my.theta, expQlink(my.theta, p = 0.75),  col = "red", lty = "dotted", lwd = 2)
    legend(2, 4,  c("p = 0.25", "p = 0.50", "p = 0.75"), col = c("blue", "green", "red"),
           lwd = c(2, 2, 2), lty = c("dotted", "dotted", "dotted"))
  

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