weibullQlink {VGAMextra} | R Documentation |
Weibull Quantile regression: Link function for the quantiles of the Weibull distribution.
Description
Computes the weibullQlink
transformation, its inverse and
the first two derivatives.
Usage
weibullQlink(theta, percentile = stop("Enter percentiles."),
shape = NULL, wrt.param = NULL,
bvalue = NULL, inverse = FALSE,
deriv = 0, short = TRUE, tag = FALSE)
Arguments
theta |
Numeric or character. Same as
|
percentile |
Same as |
shape |
Numeric, positive. The shape parameter, required. |
wrt.param |
Same as in |
bvalue , inverse , deriv , short , tag |
See |
Details
The ordinary
scale–shape Weibull quantiles are directly modelled by this link,
aka weibullQlink
transformation.
It can only be used within
weibullRff
as the first linear predictor, \eta_1
,
and is defined as
\tt{weibullQlink}(\beta; \alpha) = \eta_1(\beta; \alpha) =
\log \{\beta \cdot [(-\log(1 - perc))^{(1/\alpha)}]\},
for given \alpha
('shape' parameter) where
\beta > 0
is the scale parameter.
weibullQlink
is expressly a function of \beta
, i.e.
\theta
, therefore \alpha
(shape)
must be entered at every call.
Numerical values of \alpha
or \beta
out of range may
result in Inf
, -Inf
, NA
or NaN
.
Value
For deriv = 0
, the weibullQlink
transformation of
theta
, i.e. \beta
, when inverse = FALSE
.
If inverse = TRUE
, then \theta
becomes \eta
,
and the inverse, exp[theta
-
(1 / \alpha) log(-log(1 - perc))
]
,
for given \alpha
, is
returned.
When deriv = 1
theta
becomes
\theta = (\beta, \alpha)= (\theta_1, \theta_2)
, and
\eta = (\eta_1, \eta_2)
with
\eta_2 = \log~\alpha
,
and the argument wrt.param
must be
considered:
A) If inverse = FALSE
, then
d
eta1
/ d
\beta
is returned when
wrt.param = 1
, and
d
eta1
/ d
\alpha
if
wrt.param = 2
.
B) For inverse = TRUE
, this link returns
d
\beta
/ d
eta1
and
d
\alpha
/ d
eta1
conformably arranged
in a matrix, if wrt.param = 1
,
as a function of \theta_i
, i = 1, 2
.
When wrt.param = 2
, a matrix with columns
d\beta
/ d
eta2
and
d\alpha
/ d
eta2
is returned.
For deriv = 2
, the second derivatives in
terms of theta
are similarly returned.
Note
See weibullMlink
.
Author(s)
V. Miranda and Thomas W. Yee.
References
Miranda & Yee (2021) Two–Parameter Link Functions, With Application to Negative Binomial, Weibull and Quantile Regression. In preparation.
See Also
weibullRff
,
Q.reg
,
weibullR
,
weibmeanlink
,
Links
.
Examples
eta <- seq(-3, 3, by = 0.1) # this is eta = log(Weibull-quantiles).
shape <- exp(1) # 'shape' argument.
percentile <- c(25, 50, 75, 95) # some percentiles of interest.
## E1. Get 'scale' values. Gives a warning (not of the same length) !
theta <- weibullQlink(theta = eta, percentile = percentile,
shape = shape, inverse = TRUE) # Scale
## Not run:
## E2. Plot theta vs. eta, 'shape' fixed, for different percentiles.
plot(theta[, 1], eta, type = "l", lwd = 3,
ylim = c(-4, 4),
main = paste0("weibullQlink(theta; shape = ", round(shape, 3), ")"),
xlab = "Theta (scale)", ylab = "weibullQlink")
abline(h = -3:3, v = 0, col = "gray", lty = "dashed")
lines(theta[, 2], eta, lwd = 3, col = "blue")
lines(theta[, 3], eta, lwd = 3, col = "orange")
lines(theta[, 4], eta, lwd = 3, col = "red")
legend("bottomright", c("25th Perc", "50th Perc", "75th Perc", "95th Perc"),
col = c("black", "blue", "orange", "red"),
lwd = rep(3, 4))
## End(Not run)
## E3. weibullQlink() and its inverse ##
etabis <- weibullQlink(theta = theta, percentile = percentile,
shape = shape, inverse = FALSE)
summary(eta - etabis) # Should be 0 for each colum (percentile)