logishp: The Power Hyperbola Logistic Distribution

Description Usage Arguments Details See Also Examples

Description

Density, distribution function, quantile function and random generation for the power hyperbola logistic distribution.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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

FatTailsR documentation built on March 12, 2021, 9:06 a.m.

Related to logishp in FatTailsR...