kashp {FatTailsR}R Documentation

Kashp Function

Description

kashp, which stands for kappa times arc-sine-hyperbola-power is the nonlinear transformation of x at the heart of power hyperbolas, power hyperbolic functions and symmetric Kiener distributions. dkashp_dx is its derivative with respect to x. ashp is provided for convenience.

Usage

kashp(x, k = 1)

dkashp_dx(x, k = 1)

ashp(x, k = 1)

Arguments

x

a numeric value, vector or matrix.

k

a numeric value or vector, preferably strictly positive.

Details

ashp function is defined for x in (-Inf, +Inf) by:

ashp(x, k) = asinh(x / 2 / k)

kashp function is defined for x in (-Inf, +Inf) by:

kashp(x, k) = k * asinh(x / 2 / k)

dkashp_dx function is defined for x in (-Inf, +Inf) by:

dkashp_dx(x, k) = 1 / sqrt( x*x/k/k + 4 ) = 1 / 2 / cosh( ashp(x, k) )

If k is a vector, then the use of the function outer is recommanded.

The undesired case k=0 returns 0 for kashp and dkashp_dx, 1 for exphp, -Inf, NaN, +Inf for ashp.

See Also

The power hyperbolas and the power hyperbolic functions exphp.

Examples


require(graphics)

### Example 1
x    <- (-3:3)*3 ; names(x) <- x
kashp(x, k=2)
k    <- c(-2, 0, 1, 2, 3, 5, 10) ; names(k) <- k
outer(x, k, kashp)
outer(x, k, exphp)

### Example 2
xmin   <- -10
xd     <- 0.5
x      <- seq(xmin, -xmin, xd) ; names(x) <- x
k      <- c(0.6, 1, 1.5, 2, 3.2, 10) ; names(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))

Tkashp <- ts(cbind(outer(x, k, kashp), "x/2" = x/2), start = xmin, deltat = xd)
plot(Tkashp, plot.type = "single", ylim = c(-5, +5), 
       lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i", xlab = "", 
       ylab = "", main = "kashp(x, k)" )
legend("topleft", title = expression(kappa), legend = colnames(Tkashp), 
       inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )

Tdkashp <- ts(cbind(outer(x, k, dkashp_dx)), start = xmin, deltat = xd)
plot(Tdkashp, plot.type = "single", ylim = c(0, 0.8), 
       lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i", xlab = "", 
       ylab = "", main="dkashp_dx(x, k)" )
legend("topleft", title = expression(kappa), legend = colnames(Tdkashp), 
       inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )

Tashp <- ts(cbind(outer(x, k, ashp), "x/2" = x/2), start = xmin, deltat = xd)
plot(Tashp, plot.type = "single", ylim = c(-5, +5), 
       lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i", xlab = "", 
       ylab = "", main = "ashp(x, k)" )
legend("topleft", title = expression(kappa), legend = colnames(Tashp), 
       inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
### End example 2


[Package FatTailsR version 1.8-5 Index]