| skewt2 | R Documentation |
Density, distribution function, quantile function, and random generation
for the skew t distribution reparameterised so that mean and sd
correspond to the true mean and standard deviation.
dskewt2(x, mean = 0, sd = 1, skew = 0, df = 100, log = FALSE)
pskewt2(q, mean = 0, sd = 1, skew = 0, df = 100,
method = 0, lower.tail = TRUE, log.p = FALSE)
qskewt2(p, mean = 0, sd = 1, skew = 0, df = 100, tol = 1e-08, method = 0)
rskewt2(n, mean = 0, sd = 1, skew = 0, df = 100)
x, q |
vector of quantiles |
mean |
mean parameter |
sd |
standard deviation parameter, must be positive. |
skew |
skewness parameter, can be positive or negative. |
df |
degrees of freedom, must be positive. |
log, log.p |
logical; if |
method |
an integer value between 0 and 5 which selects the computing method; see ‘Details’ in the |
lower.tail |
logical; if |
p |
vector of probabilities |
tol |
a scalar value which regulates the accuracy of the result of qsn, measured on the probability scale. |
n |
number of random values to return. |
This corresponds to the skew t type 2 distribution in GAMLSS (ST2), see pp. 411-412 of Rigby et al. (2019) and the version implemented in the sn package.
However, it is reparameterised in terms of a standard deviation parameter sd rather than just a scale parameter sigma. Details of this reparameterisation are given below.
This implementation of dskewt allows for automatic differentiation with RTMB while the other functions are imported from the sn package.
See sn::dst for more details.
Caution: In a numerial optimisation, the skew parameter should NEVER be initialised with exactly zero.
This will cause the initial and all subsequent derivatives to be exactly zero and hence the parameter will remain at its initial value.
For given skew = \alpha and df = \nu, define
\delta = \alpha / \sqrt{1 + \alpha^2}, \qquad
b_\nu = \sqrt{\nu / \pi}\, \Gamma((\nu-1)/2)/\Gamma(\nu/2),
then
E(X) = \mu + \sigma \delta b_\nu,\quad
Var(X) = \sigma^2 \left( \frac{\nu}{\nu-2} - \delta^2 b_\nu^2 \right).
dskewt2 gives the density, pskewt2 gives the distribution function, qskewt2 gives the quantile function, and rskewt2 generates random deviates.
skewt, skewnorm, skewnorm2
x <- rskewt2(1, 1, 2, 5, 5)
d <- dskewt2(x, 1, 2, 5, 5)
p <- pskewt2(x, 1, 2, 5, 5)
q <- qskewt2(p, 1, 2, 5, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.