cauchitlink.RdComputes the cauchit (tangent) link transformation, including its inverse and the first two derivatives.
cauchitlink(theta, bvalue = .Machine$double.eps,
inverse = FALSE, deriv = 0, short = TRUE, tag = FALSE)This link function is an alternative link function for parameters that lie in the unit interval. This type of link bears the same relation to the Cauchy distribution as the probit link bears to the Gaussian. One characteristic of this link function is that the tail is heavier relative to the other links (see examples below).
Numerical values of theta close to 0 or 1 or out
of range result in Inf, -Inf, NA
or NaN.
For deriv = 0, the tangent of theta, i.e.,
tan(pi * (theta-0.5)) when inverse = FALSE,
and if inverse = TRUE then
0.5 + atan(theta)/pi.
For deriv = 1, then the function returns
d eta / d theta as a function of
theta if inverse = FALSE, else if inverse
= TRUE then it returns the reciprocal.
McCullagh, P. and Nelder, J. A. (1989). Generalized Linear Models, 2nd ed. London: Chapman & Hall.
Numerical instability may occur when theta is close to
1 or 0. One way of overcoming this is to use bvalue.
As mentioned above,
in terms of the threshold approach with cumulative
probabilities for an ordinal response this link
function corresponds to the Cauchy distribution (see
cauchy1).
p <- seq(0.01, 0.99, by = 0.01)
cauchitlink(p)
#> [1] -31.82051595 -15.89454484 -10.57889499 -7.91581509 -6.31375151
#> [6] -5.24218358 -4.47374283 -3.89474285 -3.44202258 -3.07768354
#> [11] -2.77760685 -2.52571169 -2.31086365 -2.12510817 -1.96261051
#> [16] -1.81899325 -1.69090766 -1.57574786 -1.47145532 -1.37638192
#> [21] -1.28919223 -1.20879235 -1.13427735 -1.06489184 -1.00000000
#> [26] -0.93906251 -0.88161859 -0.82727195 -0.77567951 -0.72654253
#> [31] -0.67959930 -0.63461930 -0.59139835 -0.54975465 -0.50952545
#> [36] -0.47056428 -0.43273864 -0.39592801 -0.36002215 -0.32491970
#> [41] -0.29052686 -0.25675636 -0.22352648 -0.19076020 -0.15838444
#> [46] -0.12632938 -0.09452783 -0.06291467 -0.03142627 0.00000000
#> [51] 0.03142627 0.06291467 0.09452783 0.12632938 0.15838444
#> [56] 0.19076020 0.22352648 0.25675636 0.29052686 0.32491970
#> [61] 0.36002215 0.39592801 0.43273864 0.47056428 0.50952545
#> [66] 0.54975465 0.59139835 0.63461930 0.67959930 0.72654253
#> [71] 0.77567951 0.82727195 0.88161859 0.93906251 1.00000000
#> [76] 1.06489184 1.13427735 1.20879235 1.28919223 1.37638192
#> [81] 1.47145532 1.57574786 1.69090766 1.81899325 1.96261051
#> [86] 2.12510817 2.31086365 2.52571169 2.77760685 3.07768354
#> [91] 3.44202258 3.89474285 4.47374283 5.24218358 6.31375151
#> [96] 7.91581509 10.57889499 15.89454484 31.82051595
max(abs(cauchitlink(cauchitlink(p), inverse = TRUE) - p)) # Should be 0
#> [1] 1.110223e-16
p <- c(seq(-0.02, 0.02, by=0.01), seq(0.97, 1.02, by = 0.01))
cauchitlink(p) # Has no NAs
#> [1] -1.374823e+15 -1.374823e+15 -1.374823e+15 -3.182052e+01 -1.589454e+01
#> [6] 1.057889e+01 1.589454e+01 3.182052e+01 1.374823e+15 1.374823e+15
#> [11] 1.374823e+15
if (FALSE) { # \dontrun{
par(mfrow = c(2, 2), lwd = (mylwd <- 2))
y <- seq(-4, 4, length = 100)
p <- seq(0.01, 0.99, by = 0.01)
for (d in 0:1) {
matplot(p, cbind(logitlink(p, deriv = d), probitlink(p, deriv = d)),
type = "n", col = "purple", ylab = "transformation",
las = 1, main = if (d == 0) "Some probability link functions"
else "First derivative")
lines(p, logitlink(p, deriv = d), col = "limegreen")
lines(p, probitlink(p, deriv = d), col = "purple")
lines(p, clogloglink(p, deriv = d), col = "chocolate")
lines(p, cauchitlink(p, deriv = d), col = "tan")
if (d == 0) {
abline(v = 0.5, h = 0, lty = "dashed")
legend(0, 4.5, c("logitlink", "probitlink", "clogloglink",
"cauchitlink"), lwd = mylwd,
col = c("limegreen", "purple", "chocolate", "tan"))
} else
abline(v = 0.5, lty = "dashed")
}
for (d in 0) {
matplot(y, cbind( logitlink(y, deriv = d, inverse = TRUE),
probitlink(y, deriv = d, inverse = TRUE)),
type = "n", col = "purple", xlab = "transformation", ylab = "p",
main = if (d == 0) "Some inverse probability link functions"
else "First derivative", las=1)
lines(y, logitlink(y, deriv = d, inverse = TRUE), col = "limegreen")
lines(y, probitlink(y, deriv = d, inverse = TRUE), col = "purple")
lines(y, clogloglink(y, deriv = d, inverse = TRUE), col = "chocolate")
lines(y, cauchitlink(y, deriv = d, inverse = TRUE), col = "tan")
if (d == 0) {
abline(h = 0.5, v = 0, lty = "dashed")
legend(-4, 1, c("logitlink", "probitlink", "clogloglink",
"cauchitlink"), lwd = mylwd,
col = c("limegreen", "purple", "chocolate", "tan"))
}
}
par(lwd = 1)
} # }