Half-Cauchy distribution


Story

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


Parameters

The Half-Cauchy distribution has a location parameter \(\mu\), which may take on any real value, though \(\mu = 0\) for most applications. The peak’s width is dictated by a positive scale parameter \(\sigma\).


Support

The Half-Cauchy 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;\mu, \sigma) = \frac{2}{\pi \sigma}\,\frac{1}{1 + (y-\mu)^2/\sigma^2}. \end{align}\]

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


Cumulative distribution function

\[\begin{split}\begin{align} F(y;\mu, \sigma) = \left\{\begin{array}{cll} \displaystyle{\frac{2}{\pi}\,\arctan\left(\frac{y-\mu}{\sigma}\right)} & & y \ge \mu \\[1em] 0 & & \text{otherwise}. \end{array}\right. \end{align}\end{split}\]

Moments

Mean: Undefined

Variance: Undefined


Usage

Package

Syntax

NumPy

mu + np.abs(sigma * rng.standard_cauchy())

SciPy

scipy.stats.halfcauchy(mu, sigma)

Distributions.jl

truncated(Cauchy(mu, sigma); lower=mu)

Stan sampling

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

Stan rng

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



Notes

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

  • The Half-Cauchy distribution with \(\mu = 0\) is a useful prior for nonnegative parameters that may be very large, as allowed by the very heavy tails of the Half-Cauchy distribution.


PDF and CDF plots