Continuous distribution · also called folded Cauchy
Half-Cauchy distribution
The size of a centred Cauchy variable. Its main use is as a prior for a standard deviation in a Bayesian hierarchical model, such as the spread of group effects: it has most of its mass near zero, so it allows to be small, but its heavy tail does not rule out large values. Its median is the scale , and like the Cauchy it has no finite mean.
Half-Cauchy probability calculator
P(X ≤ 1) = 0.5
At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.
CDF
mean ∞ · variance ∞ · mode 0 · entropy 1.838 nats
Formulas
| Parameters |
|
|---|---|
| Support | |
| CDF | |
| Mean | |
| Variance | |
| Mode | |
| Entropy |
It is also the Student with one degree of freedom folded at zero (a half-). Gelman (2006) recommended it as a weakly informative prior on hierarchical standard deviations, and Stan and PyMC users often write tau ~ cauchy(0, 5) with constrained positive, which is this distribution.
Worked example
A hierarchical model puts a Half-Cauchy prior with scale 5 on the between-group standard deviation . What prior probability does it give to ?
. Half the mass is below the scale, 5, yet almost 30% is above twice the scale: the heavy tail at work. answer checked by code
How it relates to others
- Transformation← Cauchy: If is Cauchy(), is Half-Cauchy(). checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.halfcauchy(scale=1)
X.pdf(1.5) # f(1.5) = 0.1959
X.cdf(1.5) # P(X ≤ 1.5) = 0.6257
X.mean(), X.var() # ∞, ∞
X.ppf(0.95) # 95th percentile
X.rvs(size=10, random_state=0)
rng = np.random.default_rng(0)
np.abs(rng.standard_cauchy(size=10))Choosing between this and its neighbours? Which prior distribution should I use?