The horseshoe distribution (Carvalho et al., 2008) is a heavy-tailed continuous distribution defined as a scale mixture of normals. It is primarily used as a shrinkage prior in sparse Bayesian regression, where it concentrates mass near zero while retaining heavy tails that leave large signals unshrunk.
dist_horseshoe(lambda, tau)We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_horseshoe.html
In the following, let \(X\) be a horseshoe random variable with local
scale parameter lambda = \(\lambda > 0\) and global scale parameter
tau = \(\tau > 0\).
Support: \(x \in \mathbb{R}\), the set of all real numbers.
Mean: \(E(X)\) — not available in closed form.
Variance: \(\mathrm{Var}(X)\) — not available in closed form.
Probability density function (p.d.f):
The horseshoe density does not have a simple closed form but can be expressed as a scale mixture:
$$ X \mid \lambda, \tau \sim \mathcal{N}(0,\, \lambda^2 \tau^2) $$
where the half-Cauchy hyperprior \(\lambda \sim C^+(0, 1)\) induces the characteristic horseshoe shrinkage behaviour.
Carvalho, C.M., Polson, N.G., and Scott, J.G. (2008). "The Horseshoe Estimator for Sparse Signals". Discussion Paper 2008-31. Duke University Department of Statistical Science.
Carvalho, C.M., Polson, N.G., and Scott, J.G. (2009). "Handling Sparsity via the Horseshoe". Journal of Machine Learning Research, 5, p. 73–80.
dist <- dist_horseshoe(lambda = c(0.5, 1, 2), tau = 1)
dist
#> <distribution[3]>
#> [1] HS(0.5, 1) HS(1, 1) HS(2, 1)
support(dist)
#> <support_region[3]>
#> [1] R R R
generate(dist, 10)
#> [[1]]
#> [1] -0.07444917 -0.08891168 0.40156093 -0.20789767 0.60624479 0.62018002
#> [7] 0.34283794 -0.01339934 0.15479025 0.12493216
#>
#> [[2]]
#> [1] -1.35646087 0.59937977 0.00864779 0.09071661 -0.65705741 -0.48178225
#> [7] 0.01775788 -0.85953576 1.35770498 1.21506118
#>
#> [[3]]
#> [1] 2.9078258 -0.1718240 -1.2351375 -0.4365205 -2.6520104 -4.7244178
#> [7] -2.8199391 0.5087943 0.5917406 0.1135796
#>
density(dist, 0)
#> [1] 0.7978846 0.3989423 0.1994711
density(dist, 0, log = TRUE)
#> [1] -0.2257914 -0.9189385 -1.6120857