Gensh | R Documentation |
Density, 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)
x , q , p , n , log , lower.tail |
Similar meaning as in |
shape |
Numeric.
Shape parameter, called |
location , scale |
Numeric. The location and (positive) scale parameters. |
tol0 |
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)).
dgensh
gives the density,
pgensh
gives the distribution function,
qgensh
gives the quantile function, and
rgensh
generates random deviates.
Numerical problems may occur when some argument values are extreme.
T. W. Yee.
gensh
,
logistic
,
hypersecant
,
Logistic
.
x <- seq(-2, 4, by = 0.01)
loc <- 1; shape <- -pi /2
## Not run: 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)
lines(qgensh((1:19) / 20, shape, loc), type = "h",
dgensh(qgensh((1:19) / 20, shape, loc),
shape, loc), col = "purple", lty = 3)
lines(x, pgensh(x, shape, loc), col = "orange")
abline(h = 0, lty = 2)
## End(Not run)
pp <- (1:19) / 20 # Test two functions
max(abs(pgensh(qgensh(pp, shape, loc),
shape,loc) - pp)) # Should be 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.