Helpful Stan Functions
|
Modules | |
Johnson Quantile Parameterized Distributions (J-QPD) functions | |
Student T Quantile functions | |
Functions | |
real | lognormal_qf (real p, real mu, real sigma) |
real | skew_generalized_t_qf (real x, real mu, real sigma, real lambda, real p, real q) |
real | unit_johnson_qf (real p, real mu, real sigma) |
In probability and statistics, the quantile function - also known as
an inverse cumulative distribution function - is, associated with a probability distribution of a random variable, specifies the value of the random variable such that the probability of the variable being less than or equal to that value equals the given probability.
See https://en.wikipedia.org/wiki/Quantile_function for more information.
real lognormal_qf | ( | real | p, |
real | mu, | ||
real | sigma | ||
) |
Lognormal Quantile Function
\begin{aligned} F^{-1}(p) &= \exp(\mu + \sqrt{2} \, \sigma \, \text{inv_erf}(2p - 1)) \\ &= \exp(\mu + \sigma \, \Phi^{−1}(x)) \end{aligned}
because
\begin{aligned} \Phi(x) &= \frac{1}{2\pi} \int_{-\infty}^x e^{-t^2}dt \\ &= \frac{1}{2} + \frac{1}{2}\text{erf}\bigg( \frac{x}{\sqrt{2}} \bigg) \end{aligned}
implies that \( \Phi^{-1}(x) = \sqrt{2} \, \text{inv_erf}(2x - 1) \).
p | Real on \([0,\,1]\) |
mu | Real \((-\infty, +\infty)\) |
sigma | Real \((0, +\infty)\) |
reject | if \( p \notin [0, 1] \) |
real skew_generalized_t_qf | ( | real | x, |
real | mu, | ||
real | sigma, | ||
real | lambda, | ||
real | p, | ||
real | q | ||
) |
Skewed Generalized T Quantile Function
For more information, please see Skew Generalized T distribution functions.
quant | Real on \([0,\,1]\) |
mu | Real |
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
r | Real \(\in (0, \infty)\) kurtosis parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
real unit_johnson_qf | ( | real | p, |
real | mu, | ||
real | sigma | ||
) |
Unit Johnson SU Quantile Function
\begin{aligned} F^{-1}(p, \, \mu, \, \sigma) &= \text{inv_logit}\bigg[ \sinh\bigg(\frac{\Phi^{-1}(p) - \mu}{\sigma}\bigg) \bigg]\\ \end{aligned}
p | Real on \([0,\,1]\) |
mu | Real \((-\infty, +\infty)\) |
sigma | Real \((0, +\infty)\) |
reject | if \( p \notin [0, 1] \) |