Algorithm Search⌘K

Definitionresearch

Horseshoe prior

Also called horseshoe shrinkage prior.

A continuous shrinkage prior that is a normal scale mixture with half-Cauchy local scales. It pulls noise strongly to zero and leaves large signals almost unshrunk.

The horseshoe prior is a prior for a vector of coefficients that are believed to be mostly zero or near zero, with a few large ones. Each coefficient is normal given its own scale, and the scales have half-Cauchy distributions, so the prior has an infinitely tall peak at zero and heavy tails. In the normal means problem, the amount by which the posterior mean shrinks an observation has a Beta(1/2,1/2)(1/2, 1/2) prior law, whose density looks like a horseshoe: almost all mass is near "shrink completely" or near "do not shrink". It behaves like a spike-and-slab prior in its posterior mean, but it is continuous and has no indicators.

Definition

Let β1,…,βp\beta_1, \ldots, \beta_p be coefficients, for example the means in yj∼N(βj,σ2)y_j \sim N(\beta_j, \sigma^2) or the coefficients of a linear regression. The horseshoe prior with global scale τ>0\tau > 0 is

βj∣λj,τ∼N(0,λj2τ2),λj∼C+(0,1),independently for j=1,…,p,\beta_j \mid \lambda_j, \tau \sim N(0, \lambda_j^2 \tau^2), \qquad \lambda_j \sim C^+(0, 1), \qquad \text{independently for } j = 1, \ldots, p,

where C+(0,1)C^+(0, 1) is the half-Cauchy law with density 2π(1+λ2)\frac{2}{\pi(1 + \lambda^2)} on (0,∞)(0, \infty). The λj\lambda_j are the local scales. The global scale τ\tau is either fixed or given its own prior, usually τ∼C+(0,τ0)\tau \sim C^+(0, \tau_0). So the horseshoe is a two-level hierarchical model for the scales.

Shrinkage coefficient. In the normal means problem yj∼N(βj,σ2)y_j \sim N(\beta_j, \sigma^2), given λj\lambda_j and τ\tau the prior of βj\beta_j is normal, so

E[βj∣yj,λj,τ]=(1−κj) yj,κj=11+λj2τ2/σ2,\mathbb{E}[\beta_j \mid y_j, \lambda_j, \tau] = (1 - \kappa_j)\, y_j, \qquad \kappa_j = \frac{1}{1 + \lambda_j^2\tau^2/\sigma^2},

and E[βj∣yj,τ]=(1−E[κj∣yj,τ]) yj\mathbb{E}[\beta_j \mid y_j, \tau] = \big(1 - \mathbb{E}[\kappa_j \mid y_j, \tau]\big)\, y_j. The value κj=1\kappa_j = 1 means "set to zero" and κj=0\kappa_j = 0 means "keep yjy_j".

The horseshoe law of κ\kappa. If τ=σ=1\tau = \sigma = 1, then κ=1/(1+λ2)\kappa = 1/(1 + \lambda^2) has the Beta(1/2,1/2)(1/2, 1/2) law, with density and distribution function

p(κ)=1πκ(1−κ),P(κ≤t)=2πarcsin⁡t,0<κ<1.p(\kappa) = \frac{1}{\pi\sqrt{\kappa(1 - \kappa)}}, \qquad P(\kappa \le t) = \frac{2}{\pi}\arcsin\sqrt t, \qquad 0 < \kappa < 1.

Proof. The map λ↦κ=1/(1+λ2)\lambda \mapsto \kappa = 1/(1 + \lambda^2) is a decreasing bijection from (0,∞)(0, \infty) to (0,1)(0, 1) with inverse λ=(1−κ)/κ\lambda = \sqrt{(1 - \kappa)/\kappa} and ∣dλ/dκ∣=12κ−3/2(1−κ)−1/2\lvert d\lambda/d\kappa\rvert = \frac{1}{2}\kappa^{-3/2}(1 - \kappa)^{-1/2}. Since 1+λ2=1/κ1 + \lambda^2 = 1/\kappa, the change of variables gives

p(κ)=2κπ⋅12κ3/2(1−κ)1/2=1π κ1/2(1−κ)1/2,p(\kappa) = \frac{2\kappa}{\pi}\cdot\frac{1}{2\kappa^{3/2}(1 - \kappa)^{1/2}} = \frac{1}{\pi\,\kappa^{1/2}(1 - \kappa)^{1/2}},

which is the Beta(1/2,1/2)(1/2, 1/2) density because B(1/2,1/2)=πB(1/2, 1/2) = \pi. The substitution κ=sin⁡2φ\kappa = \sin^2\varphi gives the distribution function. □\square

The density is unbounded at both ends, which gives the name. For a general ratio a=τ2/σ2a = \tau^2/\sigma^2 the same change of variables gives

p(κ)=aπκ(1−κ) (1+(a−1)κ),P(κ≤12)=2πarctan⁡a,p(\kappa) = \frac{\sqrt a}{\pi\sqrt{\kappa(1 - \kappa)}\,\big(1 + (a - 1)\kappa\big)}, \qquad P(\kappa \le \tfrac12) = \frac{2}{\pi}\arctan\sqrt a,

so a small τ\tau moves the mass toward κ=1\kappa = 1, that is, toward more shrinkage.

Posterior of κ\kappa. With τ=σ=1\tau = \sigma = 1, y∣κ∼N(0,1/κ)y \mid \kappa \sim N(0, 1/\kappa), so

p(κ∣y)∝κ1/2e−κy2/2⋅κ−1/2(1−κ)−1/2=(1−κ)−1/2e−κy2/2.p(\kappa \mid y) \propto \kappa^{1/2}e^{-\kappa y^2/2}\cdot\kappa^{-1/2}(1 - \kappa)^{-1/2} = (1 - \kappa)^{-1/2}e^{-\kappa y^2/2}.

At y=0y = 0 this is Beta(1,1/2)(1, 1/2), with mean 2/32/3. For large ∣y∣\lvert y\rvert the factor e−κy2/2e^{-\kappa y^2/2} makes κ\kappa approximately exponential with mean 2/y22/y^2, so E[β∣y]≈y−2/y\mathbb{E}[\beta \mid y] \approx y - 2/y: the shrinkage of a large signal goes to 0.

The marginal density. The prior density of β\beta has no closed form. Carvalho, Polson and Scott (2010, Theorem 1) show that with τ=1\tau = 1 it is unbounded at 0 and satisfies

K2log⁡(1+4β2)<p(β)<Klog⁡(1+2β2),K=12π3,\frac{K}{2}\log\Big(1 + \frac{4}{\beta^2}\Big) < p(\beta) < K\log\Big(1 + \frac{2}{\beta^2}\Big), \qquad K = \frac{1}{\sqrt{2\pi^3}},

so it has a logarithmic pole at 0 and tails like β−2\beta^{-2}. This bound is cited, not proved here; a numerical integration agrees with it at β=0.1,0.5,1,2,5\beta = 0.1, 0.5, 1, 2, 5, for example p(1)=0.1172p(1) = 0.1172 between 0.10220.1022 and 0.13950.1395.

Examples and non-examples

Example: the normal means rule. With τ=σ=1\tau = \sigma = 1, numerical integration of p(κ∣y)p(\kappa \mid y) gives

yy 0 0.5 1 2 3 5 10
E[κ∣y]\mathbb{E}[\kappa \mid y] 0.667 0.655 0.620 0.469 0.263 0.084 0.020
E[β∣y]\mathbb{E}[\beta \mid y] 0 0.172 0.380 1.063 2.210 4.579 9.798

At y=10y = 10, E[κ∣y]=0.0202\mathbb{E}[\kappa \mid y] = 0.0202 is close to 2/y2=0.022/y^2 = 0.02. The table on the spike-and-slab prior page puts this rule next to the spike-and-slab and normal rules.

Example: a Monte Carlo check of the law of κ\kappa. Draw λ=∣tan⁡(π(U−1/2))∣\lambda = \lvert\tan(\pi(U - 1/2))\rvert with UU uniform, which is half-Cauchy, 200000200000 times with random.Random(2024), and set κ=1/(1+λ2)\kappa = 1/(1 + \lambda^2). The Kolmogorov-Smirnov distance to 2πarcsin⁡t\frac{2}{\pi}\arcsin\sqrt t is 0.002280.00228, so ND=1.02\sqrt N D = 1.02, below the 5% critical value 1.361.36. This is a check of the proof above, not a replacement for it.

Example: sparse regression. For a regression with DD coefficients of which about p0p_0 are expected to be nonzero, Piironen and Vehtari (2017) suggest the global scale τ0=p0D−p0⋅σn\tau_0 = \frac{p_0}{D - p_0}\cdot\frac{\sigma}{\sqrt n}, so that the prior expected number of effectively nonzero coefficients is about p0p_0.

Non-example: the Laplace prior. The Bayesian version of the lasso uses βj∼\beta_j \sim Laplace, which is a normal scale mixture with exponential mixing on λj2\lambda_j^2. Its density is bounded at 0 and its tails are exponential, so it shrinks small values less than the horseshoe and large values by a constant amount that does not vanish.

Non-example: a normal prior. A fixed scale, λj=1\lambda_j = 1, gives the normal prior of ridge regression, with the same κ\kappa for every coefficient. There is no adaptation to the size of each signal.

Non-example: the spike-and-slab prior. The spike-and-slab prior has a point mass at 0 and gives inclusion probabilities. The horseshoe has neither: every βj\beta_j is nonzero with probability 1. Values of 1−E[κj∣y]1 - \mathbb{E}[\kappa_j \mid y] are often used like inclusion probabilities, but they are shrinkage weights.

  • Global-local shrinkage priors. The horseshoe is the main example of the family βj∼N(0,λj2τ2)\beta_j \sim N(0, \lambda_j^2\tau^2) with a heavy-tailed law for the local scales λj\lambda_j and a small global scale τ\tau. The global scale sets the overall level of sparsity; the local scales let single coefficients escape.
  • The global scale. Polson and Scott (2012) argue for τ∼C+(0,1)\tau \sim C^+(0, 1), or C+(0,τ0)C^+(0, \tau_0) after scaling. Estimating τ\tau by maximizing the marginal likelihood is empirical Bayes, and the estimate can collapse to 0, which shrinks every coefficient to zero.
  • Regularized horseshoe. Piironen and Vehtari (2017) replace λj2\lambda_j^2 by λ~j2=c2λj2c2+τ2λj2\tilde\lambda_j^2 = \frac{c^2\lambda_j^2}{c^2 + \tau^2\lambda_j^2}. Small coefficients are treated as before, and large ones see a normal slab of width cc, which helps when the data do not identify the large coefficients well, as in logistic regression with separation.
  • Theory. Van der Pas, Kleijn and van der Vaart (2014) show that, for a suitable choice of τ\tau depending on the number of nonzero means, the posterior contracts around a sparse mean vector at the minimax rate up to a constant.
  • Computation. Given the scales, the model is a Bayesian linear regression, so Gibbs sampling alternates between the coefficients and the scales, often with auxiliary inverse gamma variables for the half-Cauchy laws. Hamiltonian Monte Carlo also works, but the funnel shape between βj\beta_j and λjτ\lambda_j\tau needs a non-centred form, βj=λjτzj\beta_j = \lambda_j\tau z_j with zj∼N(0,1)z_j \sim N(0, 1).
  • Relation to James-Stein. With one common scale and no local scales, the normal means rule shrinks every coordinate by the same factor, as the James-Stein estimator does; the local scales are what let the horseshoe treat noise and signals differently.

References

  1. Carlos M. Carvalho, Nicholas G. Polson and James G. Scott, The horseshoe estimator for sparse signals, Biometrika 97(2), 2010, pages 465 to 480; the shrinkage coefficient kappa and its Beta(1/2, 1/2) law, and Theorem 1 (the bounds K/2 log(1 + 4/theta^2) < p(theta) < K log(1 + 2/theta^2) on the marginal density, K = 1/sqrt(2 pi^3))
  2. Juho Piironen and Aki Vehtari, Sparsity information and regularization in the horseshoe and other shrinkage priors, Electronic Journal of Statistics 11(2), 2017, the effective number of nonzero coefficients, the reference value tau0 = p0/(D - p0) sigma/sqrt(n) for the global scale, and the regularized horseshoe (general locator)
  3. Polson and Scott 2012, the half-Cauchy prior for the global scale tau (general locator)
  4. van der Pas, Kleijn and van der Vaart 2014, posterior contraction at the near-minimax rate for a suitable global scale (general locator)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/1R00W2/text.yaml