View source: R/2ParamMeanlinks.R
weibullMlink | R Documentation |
Computes the weibullMlink
transformation, its inverse and
the first two derivatives.
weibullMlink(theta, shape = NULL, wrt.param = NULL,
bvalue = NULL, inverse = FALSE,
deriv = 0, short = TRUE, tag = FALSE)
theta |
Numeric or character. This is |
shape |
The shape parameter. Required for this link to work.
See
|
wrt.param |
Positive integer, either |
bvalue, inverse, deriv, short, tag |
See |
This is the link for the mean of
the 2–parameter Weibull distribution, also known as the
weibullMlink
transformation.
It can only be used within
weibullRff
and is defined as
\tt{weibullMlink}(\beta; \alpha) = \eta(\beta; \alpha) =
\log [\beta \cdot \Gamma (1 + 1/\alpha)],
for given \alpha
('shape' parameter) where
\beta > 0
is the scale parameter.
weibullMlink
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
.
For deriv = 0
, the weibmeanlnik
transformation of
theta
, i.e., \beta
, when inverse = FALSE
.
If inverse = TRUE
, then \theta
becomes \eta
,
and the inverse,
\exp\left( theta - \log \Gamma(1 + 1/ \alpha)\right),
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 function 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 likewise returned.
Numerical instability may occur for values theta
too close
to zero. Use argument bvalue
to replace them before
computing the link.
If theta
is character, then arguments inverse
and
deriv
are ignored. See Links
for further details.
V. Miranda and Thomas W. Yee.
weibullQlink
,
weibullRff
,
weibullR
,
lgamma
,
Links
.
eta <- seq(-3, 3, by = 0.1) # this is eta = log(mu(b, a)).
shape <- exp(1) # 'shape' argument.
## E1. Get 'scale' values with A WARNING (not the same length)!
theta <- weibullMlink(theta = eta, shape = shape, inverse = TRUE) # Scale
## Not run:
## E2. Plot theta vs. eta, 'shape' fixed.
plot(theta, eta, type = "l", ylab = "", col = "blue",
main = paste0("weibullMlink(theta; shape = ",
round(shape, 3), ")"))
abline(h = -3:3, v = 0, col = "gray", lty = "dashed")
## End(Not run)
## E3. weibullMlink() and its inverse ##
etabis <- weibullMlink(theta = theta, shape = shape, inverse = FALSE)
summary(eta - etabis) # Should be 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.