View source: R/uninormalQlink.R
| uninormalQlink | R Documentation | 
Computes the uninormalQlink transformation, its inverse and
the first two derivatives.
     uninormalQlink(theta, percentile = stop("Enter percentiles."),
                    sd = NULL, wrt.param = NULL,
                    bvalue = NULL, inverse = FALSE,
                    deriv = 0, short = TRUE, tag = FALSE)
                       
| 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  | 
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
 \tt{uninormalQlink}(\mu; \sigma) = \eta_1(\mu; \sigma) = 
                \mu + \sigma \cdot \Phi^{-1}(perc), 
where \Phi is the error function
(see, e.g., erf), 
\mu in (-\infty, \infty), and \sigma > 0.
This link is expressly a function of \theta = \mu, therefore
sigma must be entered at every call.
Numerical values of \sigma out of range may 
result in Inf, -Inf, NA or NaN.
For deriv = 0, the uninormalQlink transformation of
theta, i.e. \mu, when inverse = FALSE.
If inverse = TRUE, then \theta becomes \eta,
and the inverse, \eta - \sigma \Phi^{-1}(perc),
for given \sigma, is returned.
When deriv = 1 theta becomes 
\theta = (\mu, \sigma)= (\theta_1, \theta_2), and
\eta = (\eta_1, \eta_2) with 
\eta_2 = \log~\sigma,
and the argument wrt.param must be
considered:
A) If inverse = FALSE, then 
d eta1 / d \mu is returned when 
wrt.param = 1, and
d eta1 / d \sigma if
wrt.param = 2.
B) For inverse = TRUE, this link returns
d \mu / d eta1 and
d \sigma / d eta1 conformably arranged
in a matrix, if wrt.param = 1,
as a function of \theta_i, i = 1, 2.
When wrt.param = 2, then
d\mu / d eta2 and 
d\sigma / d eta2
is returned.  
For deriv = 2, the second derivatives in
terms of theta are similarly returned.
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.
V. Miranda and Thomas W. Yee.
uninormalff,
uninormal,
Links.
    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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.