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

View source: R/maxwellQlink.R

maxwellQlinkR Documentation

Link functions for the quantiles of several 1–parameter continuous distributions


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


  maxwellQlink(theta, p = stop("Argument 'p' must be specified."),
               bvalue = NULL, inverse = FALSE,
               deriv = 0, short = TRUE, tag = FALSE)



Numeric or character. See below for further details.


Numeric. A single value between 0 and 1. It is the p–quantile to be modeled by this link function.

bvalue, inverse, deriv, short, tag

See Links.


In the VGLM/VGAM quantile regression context, this link function can be used to model any p–quantile of the Maxwell distribition. It is the maxwellQlink transformation given by

\sqrt{ 2~\textrm{\texttt{qgamma(p, 1.5) / a.}}}

Here, a is positive parameter as in maxwell whereas qgamma is the quantile function of the gamma distribution.

Numerical values of a or p out of range will result in Inf, -Inf, NA or NaN correspondingly.

In particular, arguments inverse and deriv are disregarded if theta is character. Also, if inverse = TRUE and deriv = 0, then argument theta becomes \eta. See Links for further details about this.


For deriv = 0, the maxwellQlink transformation of theta, when inverse = FALSE. If inverse = TRUE, then the inverse given by 2*qgamma(p, 1.5) / theta^2 is returned.

For deriv = 1, this function returns the derivative d eta / d theta, if inverse = FALSE. Else, the reciprocal d theta / d eta as a function of theta.

If deriv = 2, then the second order derivatives in terms of theta are accordingly returned.


Numerical instability may occur for values theta too close to zero. Use argument bvalue to replace them before computing the link.


V. Miranda and Thomas W. Yee.

See Also

maxwell, Links.


  ## E1. maxwellQlink() and its inverse ##
   p <- 0.25        ## Modeling the first quartile
   my.a <- seq(0, 5, by = 0.1)[-1]
   max(my.a - maxwellQlink(maxwellQlink(my.a, p = p), p = p, inverse  =TRUE)) ## Zero
  ## E2. The first two values are negative, NaN is returned ##
    maxwellQlink(theta = c(-0.15, -0.10, 0.25, 0.35) , p = p, inverse  = FALSE)
    maxwellQlink(theta = c(-0.15, -0.10, 0.25, 0.35) , p = p, inverse  = TRUE)

  ## E3. Plot of the maxwellQlink() and its inverse                    ##
  ## Note, inverse = TRUE implies that argument 'theta' becomes 'eta'. ##
   #--- THE LINK
   plot(maxwellQlink(theta = my.a, p = p) ~ my.a,
        type = "l", col = "blue", lty = "dotted", lwd = 3,
        xlim = c(-0.1, 10), ylim = c(-0.1, 5), las = 1,
        main = c("Blue is maxwellQlink(), green is the inverse"),
        ylab = "eta = maxwellQlink", xlab = "theta")
   abline(h = 0, v = 0, lwd = 2)
   lines(my.a, maxwellQlink(theta = my.a, p = p,inv = TRUE), 
          col = "green", lwd = 2, lty = "dashed")
   lines(my.a, my.a)     # Tracing the identity function for double--check

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