uninormalQlink {VGAMextra} | R Documentation |
Quantile regression: Link function for the quantiles of the normal distribution.
Description
Computes the uninormalQlink
transformation, its inverse and
the first two derivatives.
Usage
uninormalQlink(theta, percentile = stop("Enter percentiles."),
sd = NULL, wrt.param = NULL,
bvalue = NULL, inverse = FALSE,
deriv = 0, short = TRUE, tag = FALSE)
Arguments
theta |
Numeric or character. This is |
percentile |
Numeric. A vector of percentiles of interest, denoted as |
sd |
Numeric, positive. The 'standard deviation' parameter (required),
denoted as |
wrt.param |
Positive integer, either |
bvalue , inverse , deriv , short , tag |
See |
Details
A 2-parameter link for the quantiles of the normal
distribution. It can only be used within
uninormalff
as the first linear
predictor. It is defined as
where is the error function
(see, e.g.,
erf
),
, and
.
This link is expressly a function of
, therefore
must be entered at every call.
Numerical values of
out of range may
result in
Inf
, -Inf
, NA
or NaN
.
Value
For deriv = 0
, the uninormalQlink
transformation of
theta
, i.e. , when
inverse = FALSE
.
If inverse = TRUE
, then becomes
,
and the inverse,
,
for given
, is returned.
When deriv = 1
theta
becomes
, and
with
,
and the argument
wrt.param
must be
considered:
A) If inverse = FALSE
, then
eta1
/
is returned when
wrt.param = 1
, and
eta1
/
if
wrt.param = 2
.
B) For inverse = TRUE
, this link returns
/
eta1
and
/
eta1
conformably arranged
in a matrix, if wrt.param = 1
,
as a function of ,
.
When
wrt.param = 2
, then
/
eta2
and
/
eta2
is returned.
For deriv = 2
, the second derivatives in
terms of theta
are similarly returned.
Note
Numerical instability may occur for values of
sigma
too close
to zero. Use argument bvalue
to replace the former only 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
uninormalff
,
uninormal
,
Links
.
Examples
eta <- seq(-3, 3, by = 0.1) # this is eta = log(Normal - Quantiles).
sigma <- exp(1) # 'sigma' argument.
percentile <- c(25, 50, 75, 95) # some percentiles of interest.
## E1. Get 'mean' values.
theta <- uninormalQlink(theta = eta, percentile = percentile,
sd = sigma, inverse = TRUE) # Mu
## Not run:
## E2. Plot theta vs. eta, 'shape' fixed, for different percentiles.
plot(theta[, 1], eta, type = "l", las = 1, lty = 2, lwd = 3,
ylim = c(-10, 10), xlim = c(-10, 10),
main = "uninormalQlink(theta; shape), fixed 'shape'.",
xlab = "Theta (scale)", ylab = "uninormalQlink")
abline(v = 0, h = 0, col = "red")
lines(theta[, 2], eta, lty = 2, lwd = 3, col = "blue")
lines(theta[, 3], eta, lty = 2, lwd = 3, col = "orange")
lines(theta[, 4], eta, lty = 2, lwd = 3, col = "red")
legend("bottomright", c("25th Perc", "50th Perc", "75th Perc", "95th Perc"),
col = c("black", "blue", "orange", "red"), lty = c(2, 2, 2, 2),
lwd = rep(3, 4))
## End(Not run)
## E3. uninormalQlink() and its inverse ##
etabis <- uninormalQlink(theta = theta, percentile = percentile,
sd = sigma, inverse = FALSE)
my.diff <- eta - etabis
summary(my.diff) # Zero