| shash | R Documentation |
Density, distribution function, quantile function and random generation
for the Sinh-Arcsinh distribution with location parameter mu,
scale parameter sigma, skewness parameter epsilon, and
tail weight parameter delta.
dshash(x, mu = 0, sigma = 1, epsilon = 0, delta = 1, log = FALSE)
pshash(
q,
mu = 0,
sigma = 1,
epsilon = 0,
delta = 1,
lower.tail = TRUE,
log.p = FALSE
)
qshash(
p,
mu = 0,
sigma = 1,
epsilon = 0,
delta = 1,
lower.tail = TRUE,
log.p = FALSE
)
rshash(n, mu = 0, sigma = 1, epsilon = 0, delta = 1)
x, q |
vector of quantiles |
mu |
location parameter (default: 0) |
sigma |
scale parameter (must be > 0, default: 1) |
epsilon |
skewness parameter (default: 0, symmetric distribution) |
delta |
tail weight parameter (must be > 0, default: 1 for normal-like tails) |
log, log.p |
logical; if TRUE, probabilities p are given as log(p) |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x] |
p |
vector of probabilities |
n |
number of observations. If |
The Sinh-Arcsinh distribution (Jones & Pewsey, 2009) is defined by the transformation:
X = \mu + \sigma \cdot \sinh\left(\frac{\text{asinh}(Z) - \epsilon}{\delta}\right)
where Z \sim N(0,1) is a standard normal variable.
The four parameters control:
mu: Location (similar to mean)
sigma: Scale (similar to standard deviation)
epsilon: Skewness (epsilon = 0 gives symmetry)
delta: Tail weight (delta = 1 gives normal-like tails,
delta > 1 gives heavier tails, delta < 1 gives lighter tails)
dshash gives the density, pshash gives the distribution
function, qshash gives the quantile function, and rshash
generates random deviates.
The length of the result is determined by n for rshash, and
is the maximum of the lengths of the numerical arguments for the other functions.
Jones, M. C., & Pewsey, A. (2009). Sinh-arcsinh distributions. Biometrika, 96(4), 761-780. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/asp053")}
Normal for the normal distribution.
# Generate random samples
x <- rshash(1000, mu = 0, sigma = 1, epsilon = 0.5, delta = 1.2)
# Density
plot(density(x))
curve(dshash(x, mu = 0, sigma = 1, epsilon = 0.5, delta = 1.2),
add = TRUE, col = "red")
# Cumulative probability
pshash(0, mu = 0, sigma = 1, epsilon = 0.5, delta = 1.2)
# Quantiles
qshash(c(0.025, 0.5, 0.975), mu = 0, sigma = 1, epsilon = 0.5, delta = 1.2)
# Compare with normal distribution (epsilon = 0, delta = 1)
par(mfrow = c(2, 2))
x_vals <- seq(-4, 4, length.out = 200)
plot(x_vals, dshash(x_vals), type = "l", main = "Symmetric (like normal)")
plot(x_vals, dshash(x_vals, epsilon = 1), type = "l", main = "Right skewed")
plot(x_vals, dshash(x_vals, delta = 2), type = "l", main = "Heavy tails")
plot(x_vals, dshash(x_vals, delta = 0.5), type = "l", main = "Light tails")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.