HalfCauchy distribution
Story
The HalfCauchy 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 HalfCauchy 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 HalfCauchy 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
Moments
Mean: Undefined
Variance: Undefined
Usage
Package 
Syntax 

NumPy 

SciPy 

Stan sampling 

Stan rng 

Notes
In Stan, a HalfCauchy is defined by putting a lower bound of \(\mu\) on the variable and then using a Cauchy distribution with location parameter \(\mu\).
The HalfCauchy 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 HalfCauchy distribution.