Half-Student-t distribution


Story

The Half-Student-t distribution is a Student-t distribution truncated to only have nonzero probability density for values greater than or equal to the location of the peak.


Parameters

The Half-Student-t distribution is peaked at its location parameter \(\mu\). The peak’s width is dictated by scale parameter \(\sigma\), which is positive. Finally, the shape parameter, called “degrees of freedom,” is \(\nu\). This last parameter imparts the distribution with a heavy tail for small \(\nu\).


Support

The Half-Student-t distribution is supported on the set of all real numbers that are greater than or equal to \(\mu\), that is on \([\mu, \infty)\).


Probability density function

\[ \begin{align} f(y;\nu, \mu, \sigma) = \frac{2\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)\sqrt{\pi \nu \sigma^2}}\left(1 + \frac{(y-\mu)^2}{\nu \sigma^2}\right)^{-\frac{\nu + 1}{2}}. \end{align}\]

Note that the distribution is only supported for \(y \ge \mu\).


Cumulative distribution function

\[\begin{split}\begin{align} F(y;\nu, \mu, \sigma) = \left\{ \begin{array}{cll} \displaystyle{1 - I_{\nu/x^2 + \nu}\left(\frac{\nu}{2}, \frac{1}{2}\right)} & & y \ge \mu,\\[0.5em] 0 & & \text{otherwise}, \end{array}\right. \end{align}\end{split}\]

where \(x = (y-\mu) / \sigma\) and \(I_x(a, b)\) denotes the regularized incomplete beta function.


Moments

Mean: \(\mu + 2\sigma\sqrt{\frac{\nu}{\pi}}\,\frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)(\nu-1)}\) for \(\nu > 1\), otherwise undefined.

Variance: \(\sigma^2\left(\frac{\nu}{\nu - 2}-\frac{4\nu}{\pi(\nu-1)^2}\left(\frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\right)^2\right)\) for \(\nu > 2\). If \(1 < \nu < 2\), then the variance is infinite. If \(\nu \le 1\), the variance is undefined.


Usage

Package

Syntax

NumPy

mu + sigma * np.abs(rng.standard_t(nu))

SciPy sampling

mu + np.abs(scipy.stats.t.rvs(nu, 0, sigma))

Distributions.jl

mu .+ sigma .* rand(truncated(TDist(nu); lower=mu), x)

Stan sampling

real<lower=mu> y; y ~ student_t(nu, mu, sigma)

Stan rng

real<lower=mu> y; y = mu + abs(student_t(nu, 0, sigma))



Notes

  • In Stan, a Half-Student-t is defined by putting a lower bound of \(\mu\) on the variable and then using a Student-t distribution with location parameter \(\mu\).

  • Only the standard Student-t distribution (\(\mu = 0\) and \(\sigma = 1\)) is available in NumPy. You can still draw out of the Student-t distribution by performing a transformation on the samples out of the standard Student-t distribution, as shown in the usage, above. The same is true for Distributions.jl. Shown is an example where \(x\) random numbers are drawn from the distribution and transformed using broadcasting.

  • The Half-Student-t distribution is not available in SciPy. To compute the PDF for \(y \ge \mu\), use 2 * scipy.stats.t.pdf(y, nu, mu, sigma). To compute the CDF for \(y \ge \mu\), use 2 * scipy.stats.t.cdf(y, nu, mu, sigma) - 1.

  • The Half-Student-t distribution with \(\mu = 0\) is a useful prior for nonnegative parameters. The parameter \(\nu\) of the Half-Student-t can be tuned to allow for a heavy tail (\(\nu\) close to 1) or a light tail (large \(\nu\)).


PDF and CDF plots