Half-Student-t distribution


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.


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\).


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{split} \begin{align} f(y;\mu, \sigma) = \left\{\begin{array}{cll} \frac{\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}} & & y \ge \mu \\[1em] 0 & & \text{otherwise}. \end{array}\right. \end{align}\end{split}\]


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.





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

SciPy sampling

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

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))


  • 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 Half-Student-t distribution by performing a transformation on the samples out of the standard Student-t distribution, as shown in the usage, above.

  • 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