Helpful Stan Functions
|
Functions | |
real | variance_adjusted_sgt (real sigma, real lambda, real p, real q) |
vector | mean_centered_sgt (vector x, real sigma, real lambda, real p, real q) |
real | mean_centered_sgt (real x, real sigma, real lambda, real p, real q) |
real | mean_centered_sgt (real x, real sigma, real lambda, real q) |
real | skew_generalized_t_lpdf (vector x, real mu, real sigma, real lambda, real p, real q) |
real | skew_t_lpdf (vector x, real mu, real sigma, real lambda, real q) |
real | generalized_t_lpdf (vector x, real mu, real sigma, real p, real q) |
real | skew_generalized_t_lcdf (real x, real mu, real sigma, real lambda, real p, real q) |
From the sgt R package Carter Davis (2015). sgt: Skewed Generalized T Distribution Tree. R package version 2.0. https://CRAN.R-project.org/package=sgt
The Skewed Generalized T Distribution is a univariate 5-parameter distribution introuced by Theodossiou (1998) and known for its extreme flexibility. Special and limiting cases of the SGT distribution include the skewed generalized error distribution, the generalized t distribution introduced by McDonald and Newey (1988), the skewed t proposed by Hansen (1994), the skewed Laplace distribution, the generalized error distribution (also known as the generalized normal distribution), the skewed normal distribution, the student t distribution, the skewed Cauchy distribution, the Laplace distribution, the uniform distribution, the normal distribution, and the Cauchy distribution.
Hansen, B. E., 1994, Autoregressive Conditional Density Estimation, International Economic Review 35, 705-730.
Hansen, C., J. B. McDonald, and W. K. Newey, 2010, Instrumental Variables Estimation with Flexible Distribution sigma Journal of Business and Economic Statistics 28, 13-25.
McDonald, J. B. and W. K. Newey, 1988, Partially Adaptive Estimation of Regression Models via the Generalized t Distribution, Econometric Theory 4, 428-457.
Theodossiou, Panayioti sigma 1998, Financial Data and the Skewed Generalized T Distribution, Management Science 44, 1650-166
real generalized_t_lpdf | ( | vector | x, |
real | mu, | ||
real | sigma, | ||
real | p, | ||
real | q | ||
) |
The Generalized T distribution
x | Vector |
mu | Real |
sigma | Real \(\in (0, \infty)\) scale parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
real mean_centered_sgt | ( | real | x, |
real | sigma, | ||
real | lambda, | ||
real | p, | ||
real | q | ||
) |
real mean_centered_sgt | ( | real | x, |
real | sigma, | ||
real | lambda, | ||
real | q | ||
) |
vector mean_centered_sgt | ( | vector | x, |
real | sigma, | ||
real | lambda, | ||
real | p, | ||
real | q | ||
) |
Skew Generalized T Center Mean
Centers the mean around mu, otherwise mu is the mode.
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
p | Real \(\in (0, \infty)\) kurtosis parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
reject | if \( pq \leq 1 \) |
real skew_generalized_t_lcdf | ( | real | x, |
real | mu, | ||
real | sigma, | ||
real | lambda, | ||
real | p, | ||
real | q | ||
) |
Skew Generalized T log cumulative density function
x | Real |
mu | Real |
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
p | Real \(\in (0, \infty)\) kurtosis parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
real skew_generalized_t_lpdf | ( | vector | x, |
real | mu, | ||
real | sigma, | ||
real | lambda, | ||
real | p, | ||
real | q | ||
) |
The Skewed Generalized T distribution is defined as
\[ f_{SGT}(x; \mu, \sigma, \lambda, p, q) = \frac{p}{2 v \sigma q^{1/p} B(\frac{1}{p},q) \left(\frac{| x-\mu + m |^p}{q (v \sigma)^p (\lambda sign(x-\mu + m)+1)^p}+1\right)^{\frac{1}{p}+q}} \]
where \(B\) is the beta function, \( \mu \) is the location parameter, \(\sigma > 0\) is the scale parameter, \(-1 < \lambda < 1\) is the skewness parameter, and \(p > 0\) and \(q > 0\) are the parameters that control the kurtosis. \(m\) and \(v\) are not parameter sigma
but functions of the other parameters that are used here to scale or shift the distribution appropriately to match the various parameterizations of this distribution.
In the original parameterization Theodossiou of the skewed generalized t distribution,
\[ m = \frac{2 v \sigma \lambda q^{\frac{1}{p}} B(\frac{2}{p},q-\frac{1}{p})}{B(\frac{1}{p},q)} \]
and
\[ v = \frac{q^{-\frac{1}{p}}}{\sqrt{ (3 \lambda^2 + 1) \frac{ B ( \frac{3}{p}, q - \frac{2}{p} )}{B (\frac{1}{p}, q )} -4 \lambda^2 \frac{B ( \frac{2}{p}, q - \frac{1}{p} )^2}{ B (\frac{1}{p}, q )^2}}}. \]
x | Vector |
mu | Real |
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
p | Real \(\in (0, \infty)\) kurtosis parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
real skew_t_lpdf | ( | vector | x, |
real | mu, | ||
real | sigma, | ||
real | lambda, | ||
real | q | ||
) |
The Skewed T distribution
x | Vector |
mu | Real |
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
q | Real \(\in (0, \infty)\) kurtosis parameter |
real variance_adjusted_sgt | ( | real | sigma, |
real | lambda, | ||
real | p, | ||
real | q | ||
) |
Skew Generalized T Rescale Sigma to be Variance
sigma | Real \(\in (0, \infty)\) scale parameter |
lambda | Real \(-1 < \lambda < 1\) |
p | Real \(\in (0, \infty)\) kurtosis parameter |
q | Real \(\in (0, \infty)\) kurtosis parameter |
reject | if \( pq \leq 2 \) |