genshUC.RdDensity, distribution function, quantile function and random generation for the generalized secant hyperbolic distribution.
dgensh(x, shape, location = 0, scale = 1, tol0 = 1e-4,
log = FALSE)
pgensh(q, shape, location = 0, scale = 1, tol0 = 1e-4,
lower.tail = TRUE)
qgensh(p, shape, location = 0, scale = 1, tol0 = 1e-4)
rgensh(n, shape, location = 0, scale = 1, tol0 = 1e-4)Similar meaning as in Normal.
Numeric. Shape parameter, called \(t\) in Vaughan (2002). Valid values are \(-\pi/2 < t\).
Numeric. The location and (positive) scale parameters.
Numeric. Used to test whether the shape parameter is close enough to be treated as 0.
This is an implementation of the family of
symmetric densities described
by Vaughan (2002).
By default, the mean and variance are 0
and 1, for all \(t\).
Some special (default) cases are:
\(t=0\): logistic
(which is similar to
stats:dt
with 9 degrees of freedom);
\(t=-\pi/2\): the standard secant
hyperbolic (whence the name);
\(t=\infty\):
uniform(-sqrt(3), sqrt(3)).
Numerical problems may occur when some argument values are extreme.
dgensh gives the density,
pgensh gives the distribution function,
qgensh gives the quantile function, and
rgensh generates random deviates.
gensh,
logistic,
hypersecant,
Logistic.
x <- seq(-2, 4, by = 0.01)
loc <- 1; shape <- -pi /2
if (FALSE) plot(x, dgensh(x, shape, loc), type = "l",
main = "Blue is density, orange is the CDF",
ylim = 0:1, las = 1, ylab = "",
sub = "Purple are 5, 10, ..., 95 percentiles",
col = "blue")
abline(h = 0, col = "blue", lty = 2)
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
lines(qgensh((1:19) / 20, shape, loc), type = "h",
dgensh(qgensh((1:19) / 20, shape, loc),
shape, loc), col = "purple", lty = 3)
#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet
lines(x, pgensh(x, shape, loc), col = "orange")
#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet
abline(h = 0, lty = 2) # \dontrun{}
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
pp <- (1:19) / 20 # Test two functions
max(abs(pgensh(qgensh(pp, shape, loc),
shape,loc) - pp)) # Should be 0
#> [1] 1.110223e-16