normal1sdQlink: Link functions for the quantiles of several 1-parameter... In VGAMextra: Additions and Extensions of the 'VGAM' Package

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

Description

Computes the normal1sdQlink transformation for the Univariate Normal Distribution, its inverse and the first two derivatives.

Usage

   normal1sdQlink(theta,  mean = stop("Please, enter the fixed 'mean'."),
p = stop(" Please, enter argument 'p'."),
bvalue = NULL, inverse = FALSE, deriv = 0,
short = TRUE, tag = FALSE)


Arguments

 theta Numeric or character. This is \theta by default although it could be \eta depending upon other arguments. See below for further details. mean A numeric vector or a matrix. It is the (known) fixed mean of the Normal distribution of interest. See below for further details. p Numeric vector of p–quantiles to be modelled by this link function. bvalue, inverse, deriv, short, tag Details at Links.

Details

This link function is necessarily required by normal1sd if quantile regression is to be performed. It computes the normal1sdQlink transformation, defined as

 {\tt{mean}} + \sqrt{2}\sigma \cdot {\tt{erf^{-1}}}(2 {\tt{p}} - 1).

Here, {\tt{erf^{-1}}} denotes the inverse of the error function erf, and \sigma is the standard deviation (theta) as in normal1sd. Technically, normal1sdQlink can be used for quantile regression over any vector of p–quantiles of Normally distributed data with known mean.

See normal1sd for further details about the latter.

Values of p out of the open interval (0, 1) or non–positive values of theta will result in Inf, -Inf, NA or NaN.

Value

When deriv = 0, the normal1sdQlink transformation of theta, if inverse = FALSE. Conversely, if inverse = TRUE, theta becomes \eta and the inverse transformation given by (theta - mean)/\sqrt{2} erf^{-1}(2p - 1) is returned.

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

For deriv = 2, the second order derivatives are accordingly returned.

Warning

If p is a vector, then the recycling rule applies only if theta is entered as a matrix. Else, only the first entry in p is considered.

Note

When inverse = TRUE, the reciprocal of the error function, erf, evaluated at 2p- 1 is required. However, the result is Inf for p= 0.5. Here, in consequence, the limit of erf when p tends to 0.5 is returned to avoid numerical issues.

Author(s)

V. Miranda

normal1sd, erf, Links.

Examples

    ###   Example 1  ###
theta <- seq(0, 3, by = 0.1)[-1]  # This is sigma, then must be positive.
mean  <- -2.5                     # Intentionally, a negative value for mu.
p     <- 0.25                     # Modelling the first quartile.

eta <- normal1sdQlink(theta = theta, p = p, mean = mean)
inv.eta <- normal1sdQlink(theta = eta, p = p, mean = mean, inverse = TRUE)
summary(inv.eta - theta)          ## Should be 0

###  Example 2. Special values of theta, using argument 'bvalue'.  ###

theta <- c(-Inf, -5, -2.5, 0, 2.5, 5, Inf, NA, NaN)
my.matrix <- rbind(theta, normal1sdQlink(theta = theta, p = p, mean = mean),
normal1sdQlink(theta = theta, p = p, mean = mean, bvalue = 1e-5))
rownames(my.matrix) <- c("theta", "No 'bvalue'", "With 'bvalue'")
colnames(my.matrix) <- rep("", 9)

my.matrix   # Second row has NAs, whilst third row has NO NAs except for theta = NA


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