Helpful Stan Functions
|
Functions | |
real | JQPDS_qf (real p, real lower_bound, data real alpha, vector quantiles) |
real | JQPDS2_qf (real p, real lower_bound, real alpha, vector quantiles) |
real | JQPDB_qf (real p, row_vector bounds, data real alpha, vector quantiles) |
Christopher C. Hadlock, J. Eric Bickel The Generalized Johnson Quantile-Parameterized Distribution System. Decision Analysis 16 (1) 67-85 https://doi.org/10.1287/deca.2018.0376
real JQPDB_qf | ( | real | p, |
row_vector | bounds, | ||
data real | alpha, | ||
vector | quantiles | ||
) |
Quantile function of the J-QPD-B bounded distribution
\begin{aligned} F^{-1}(p, u, l, x_\alpha) = l + (u - l)\theta \Phi(\xi + \lambda \sinh(\delta \Phi^{-1}(p) + nc)) \end{aligned}
where
\begin{aligned} c &= \Phi^{-1}(1 - \alpha), \\ L &= \Phi^{-1}\bigg( \frac{x_\alpha - l}{u - l} \bigg), \\ B &= \Phi^{-1}\bigg( \frac{ x_{0.5} - l}{u - l} \bigg), \\ H &= \Phi^{-1}\bigg( \frac{x_{1-\alpha} - l}{u - l} \bigg), \\ n &= \text{sgn}(L + H - 2B) \\ \theta &= \begin{cases} L, \, n = 1 \\ B, \, n = 0 \\ H, \, n = -1 \end{cases}, \\ \delta &= \frac{1}{c} \cosh^{-1}\bigg(\frac{H - L}{2\min(B-L, \, H-B)} \bigg), \\ \lambda &= \frac{H - L}{\sinh(2\delta c)}. \end{aligned}
See equation 7 of http://metalogdistributions.com/images/Johnson_Quantile-Parameterized_Distributions.pdf
p | real cumulative probability |
alpha | fixed proportion of distribution below quantiles[1] |
bounds | vector of size two containing the lower and upper bounds |
quantiles | vector of size three ordered quantiles |
reject | if \( p \notin [0, 1] \) |
reject | if bounds \( \ne 2 \) |
reject | if \( \alpha \notin [0, 1] \) |
reject | if quantiles \( != 3\) |
real JQPDS2_qf | ( | real | p, |
real | lower_bound, | ||
real | alpha, | ||
vector | quantiles | ||
) |
Quantile function of the J-QPD-S-II semi-bounded distribution, which lacks moments
\begin{aligned} F^{-1}(p, l, x_\alpha) = l + \theta \exp(\lambda \sinh(\delta \Phi^{-1}(p) + nc)) \end{aligned}
where
\begin{aligned} c &= \Phi^{-1}(1 - \alpha), \\ L &= \log(x_\alpha - l), \\ B &= \log(x_{0.5} - l), \\ H &= \log(x_{1-\alpha} - l), \\ n &= \text{sgn}(L + H - 2B) \\ \theta &= \begin{cases} x_\alpha - 1, \, n = 1 \\ x_{0.5} - l, \, n = 0 \\ x_{1-\alpha} - 1, \, n = -1 \end{cases}, \\ \delta &= \frac{1}{c} \cosh^{-1}\bigg(\frac{H - L}{2\min(B-L, \, H-B)} \bigg), \\ \lambda &= \frac{1}{\sinh(\delta c)}\min(H - B, \, B - L). \end{aligned}
See equation 14 of http://metalogdistributions.com/images/Johnson_Quantile-Parameterized_Distributions.pdf It is the limit of the J-QPD-B distribution as the upper bound diverges.
p | real cumulative probability |
alpha | fixed proportion of distribution below quantiles[1] |
lower_bound | real lower bound to the random variable |
quantiles | vector of size three ordered quantiles |
reject | if \( p \notin [0, 1] \) |
reject | if \( \alpha \notin [0, 1] \) |
reject | if quantiles \( \ne 3\) |
real JQPDS_qf | ( | real | p, |
real | lower_bound, | ||
data real | alpha, | ||
vector | quantiles | ||
) |
Quantile function of the J-QPD-S semi-bounded distribution, which has moments
\begin{aligned} F^{-1}(p, l, x_\alpha) = l + \theta \exp(\lambda \sinh(\sinh_{-1}(\delta \Phi^{-1}(p) + \sinh^{-1}(nc\delta)))) \end{aligned}
where
\begin{aligned} c &= \Phi^{-1}(1 - \alpha), \\ L &= \log(x_\alpha - l), \\ B &= \log(x_{0.5} - l), \\ H &= \log(x_{1-\alpha} - l), \\ n &= \text{sgn}(L + H - 2B) \\ \theta &= \begin{cases} x_\alpha - 1, \, n = 1 \\ x_{0.5} - l, \, n = 0 \\ x_{1-\alpha} - 1, \, n = -1 \end{cases}, \\ \delta &= \frac{1}{c}\sinh\bigg( \cosh^{-1}\bigg(\frac{H - L}{2\min(B-L, \, H-B)} \bigg) \bigg), \\ \lambda &= \frac{1}{\delta c}\min(H - B, \, B - L). \end{aligned}
See equation 9 of http://metalogdistributions.com/images/Johnson_Quantile-Parameterized_Distributions.pdf
p | real cumulative probability |
alpha | fixed proportion of distribution below quantiles[1] |
lower_bound | real lower bound to the random variable |
quantiles | vector of size three ordered quantiles |
reject | if \( p \notin [0, 1] \) |
reject | if \( \alpha \notin [0, 1] \) |
reject | if quantiles \( \ne 3\) |