logishp {FatTailsR} | R Documentation |
The Power Hyperbola Logistic Distribution
Description
Density, distribution function, quantile function and random generation for the power hyperbola logistic distribution.
Usage
dlogishp(x, k = 1, log = FALSE)
plogishp(q, k = 1)
invkogit(q, k = 1)
qlogishp(p, k = 1)
kogit(p, k = 1)
rlogishp(n, k = 1)
dplogishp(p, k = 1, log = FALSE)
dqlogishp(p, k = 1, log = FALSE)
llogishp(x, k = 1)
dllogishp(lp, k = 1, log = FALSE)
qllogishp(lp, k = 1)
Arguments
x |
vector of quantiles. |
k |
numeric. The tail parameter, preferably strictly positive. Can be a vector (see details). |
log |
boolean. |
q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. If length(n) > 1, the length is taken to be the number required. |
lp |
vector of logit of probabilities. |
Details
dlogishp
function (log is available) is defined for
x in (-Inf, +Inf) by:
dlogishp(x, k) =
dkashp\_dx(x, k) * plogishp(x, k) * plogishp(-x, k)
invkogit=plogishp
functions are defined for q in (-Inf, +Inf) by:
invkogit(q, k) = plogishp(q, k) = 1/(1 + exp(- kashp(q, k)))
kogit=qlogishp
functions are defined for p in (0, 1) by:
kogit(p, k) = qlogishp(p, k) = 2 * k * sinh(logit(p) / k)
rlogishp
function generates n
random values.
In addition to the classical formats, the prefixes dp, dq, l, dl, ql are also provided:
dplogishp
function (log is available) is defined for p in (0, 1) by:
dplogishp(p, k = 1) = p * (1 - p) / 2 / cosh( logit(p)/k )
dqlogishp
function (log is available) is defined for p in (0, 1) by:
dqlogishp(p, k = 1) = 2 / p / (1 - p) * cosh( logit(p)/k )
llogishp
function is defined for x in (-Inf, +Inf) by:
llogishp(x, k) = kashp(x, k)
dllogishp
function is defined for lp = logit(p) in (-Inf, +Inf) by :
dllogishp(lp, k) = p * (1 - p) / 2 / cosh( lp/k )
qllogishp
function is defined for lp = logit(p) in (-Inf, +Inf) by :
qllogishp(lp, k) = 2 * k * sinh(lp / k)
If k is a vector, then the use of the function outer
is recommanded.
See Also
Kiener distribution K1 kiener1
which has
location (m
) and scale (g
) parameters.
Examples
require(graphics)
### Example 1
pp <- c(ppoints(11, a = 1), NA, NaN) ; pp
plogishp(-5:5, k = 4)
dlogishp(-5:5, k = 4)
qlogishp(pp, k = 4)
outer(-5:5, 1:6, plogishp)
outer(-5:5, 1:6, dlogishp)
outer(runif(20), 1:6, qlogishp)
### Example 2
x <- seq(-15, 15, length.out = 101)
k <- c(0.6, 1, 1.5, 2, 3.2, 10) ; names(k) <- k ; k
olty <- c(2, 1, 2, 1, 2, 1, 1)
olwd <- c(1, 1, 2, 2, 3, 4, 2)
ocol <- c(2, 2, 4, 4, 3, 3, 1)
op <- par(mfrow = c(2,2), mgp = c(1.5,0.8,0), mar = c(3,3,2,1))
plot(x, plogis(x, scale = 2), type = "b", lwd = 2, ylim = c(0, 1),
xaxs = "i", yaxs = "i", xlab = "", ylab = "", main = "plogishp(x, k)")
for (i in 1:length(k)) lines(x, plogishp(x, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
legend("topleft", title = expression(kappa), legend = c(k, "plogis(x/2)"),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
plot(x, dlogis(x, scale = 2), type = "b", lwd = 2, xaxs = "i",
yaxs = "i", xlab = "", ylab = "", main = "dlogishp(x, k)")
for (i in 1:length(k)) lines(x, dlogishp(x, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
plot(x, x/2, type = "b", lwd = 2, ylim = c(-7.5, 7.5), xaxs = "i",
yaxs = "i", xlab = "", ylab = "", main = "logit(logishp(h, k))")
for (i in 1:length(k)) lines(x, llogishp(x, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
plot(x, log(dlogis(x, scale = 2)), lwd = 2, type = "b", xaxs = "i",
yaxs = "i", xlab = "", ylab = "", main = "log(dlogishp(x, k))")
for (i in 1:length(k)) lines(x, dlogishp(x, k = k[i], log = TRUE),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
### End example 2
### Example 3
p <- ppoints(199, a=0)
plot(p, qlogis(p, scale = 2), type = "o", lwd = 2, ylim = c(-15, 15),
xaxs = "i", yaxs = "i", xlab = "", ylab = "",
main = "qlogishp(p, k)")
for (i in 1:length(k)) lines(p, qlogishp(p, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
legend("topleft", title = expression(kappa), legend = c(k, "qlogis(x/2)"),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
plot(p, 2/p/(1-p), type = "o", lwd = 2, xlim = c(0, 1), ylim = c(0, 100),
xaxs = "i", yaxs = "i", xlab = "", ylab = "",
main = "dqlogishp(p, k)")
for (i in 1:length(k)) lines(p, dqlogishp(p, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
legend("top", title = expression(kappa), legend = c(k, "p*(1-p)/2"),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
plot(qlogis(p, scale = 2), p*(1-p)/2, type = "o", lwd = 2, xlim = c(-15, 15),
ylim = c(0, 0.14), xaxs = "i", yaxs = "i", xlab = "", ylab = "",
main = "qlogishp, dplogishp(p, k)")
for (i in 1:length(k)) lines(qlogishp(p, k = k[i]), dplogishp(p, k = k[i]),
lty = olty[i], lwd = olwd[i], col = ocol[i] )
legend("topleft", title = expression(kappa), legend = c(k, "p*(1-p)/2"),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
### End example 3