normal1sdQlink {VGAMextra} | R Documentation |
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 |
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 |
bvalue , inverse , deriv , short , tag |
Details at |
Details
This link function is necessarily required by
normal1sd
if quantile regression
is to be performed. It computes the normal1sdQlink
transformation, defined as
Here, denotes the inverse
of the error function
erf
, and
is the standard deviation (
theta
) as in
normal1sd
.
Technically, normal1sdQlink
can be used for quantile regression
over any vector of –quantiles of Normally distributed data
with known mean.
See normal1sd
for further details
about the latter.
Values of out of the open interval
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 and
the inverse transformation given by
(theta - mean)/
erf
p
is returned.
For deriv = 1
,
eta
/
theta
if inverse = FALSE
. Else, this function returns
theta
/
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 p
is required. However, the result is
Inf
for p
.
Here, in consequence, the limit of
erf
when
p
tends to is returned to avoid numerical issues.
Author(s)
V. Miranda
See Also
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