# Understanding Regularized HS prior

**URL:** <https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005>\
**Category:** Modeling\
**Created:** [March 11, 2019, 3:15am UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005 "2019-03-11T03:15:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Dean](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/joseph_dean/32/8132_2.png) [@Joseph\_Dean](https://discourse.mc-stan.org/u/Joseph_Dean)\
**Post date:** [March 11, 2019, 3:15am UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/1 "2019-03-11T03:15:08Z")

</div>

I am struggling to understand the various arguments of the `hs()` prior in rstanarm. I read through Piironen, Vehtari 2017 but I’m still struggling with some things. The calculation of tau0, or the global intercept, makes sense. But I’m having trouble with the others hyperparameters, though I find adjusting them does affect my predictive accuracy. I find the term “slab” particularly confusing. What would be nice is a sense of how the various hyperparameters affects the model. For example, one argument is simply ‘df’. I am unsure what exactly this refers to as there is also a global\_df and a slab\_df IIRC. If I do a prior\_summary call to my model in rstanarm, this df appears as the prior to coefficients. I’m working on a n\<\<p problem and finding many of my coefficients have very heavily skewed distributions, though I don’t seem to be having any sampling issues. It makes me suspicious some of my priors are reigning the estimates in too much but perhaps I’m misdiagnosising the issue.

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [March 14, 2019, 7:49pm UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/2 "2019-03-14T19:49:43Z")

</div>

hs refers to hierarchical shrinkage, and to get regularized horseshoe set df=1, global\_df=1. If you want sparsifying prior, it’s best to leave them like that. Then you need to choose global\_scale, slab\_df, and slab\_scale.

> [@Joseph\_Dean](#):
>
> The calculation of tau0, or the global intercept, makes sense.

That is the global\_scale and it seems you have that figured out.

> [@Joseph\_Dean](#):
>
> I find the term “slab” particularly confusing.

slab describes the prior for the large coefficients. slab is t-distribution and has scale and df, which you can choose based on your prior information about the magnitude of large coefficients. df is local df or local nu. slab is important, for example, in logistic regression with separable classes as without regularization horseshoe would have way too much mass for unfeasible large weights.

> [@Joseph\_Dean](#):
>
> I’m working on a n\<\<p problem

and which likelihood?

> [@Joseph\_Dean](#):
>
> and finding many of my coefficients have very heavily skewed distributions

posterior distributions? It’s fine if the posterior is skewed.

---

<div class="post-metadata">

**Author:** ![kcar](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@kcar](https://discourse.mc-stan.org/u/kcar)\
**Post date:** [May 29, 2019, 10:51am UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/3 "2019-05-29T10:51:08Z")

</div>

I had a similar problem with understanding the hs() prior. When global\_df =1 , does that mean that \tau \sim C^+(0,\tau\_0^2)? And how is df related to the model as in Piironen, Vehtari (2017)?

---

<div class="post-metadata">

**Author:** ![federico](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/federico/32/4948_2.png) [@federico](https://discourse.mc-stan.org/u/federico)\
**Post date:** [May 29, 2019, 2:43pm UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/4 "2019-05-29T14:43:12Z")

</div>

It should be that hs() is using half student\_t priors. The student\_t distribution with df=1 is equivalent to a Cauchy distribution, that is the reason of setting df=1 and global\_df=1.

---

<div class="post-metadata">

**Author:** ![kcar](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@kcar](https://discourse.mc-stan.org/u/kcar)\
**Post date:** [May 29, 2019, 4:06pm UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/5 "2019-05-29T16:06:50Z")

</div>

Yes i think that as well, however I can’t match the 5 inputs of hs() with the parameters of the regularised horseshoe. I assume hs() should match the following model:

c^2 \sim \text{inv-gamma}(\frac{\nu}{2},\frac{\nu s^2}{2} )

Where \nu is slab\_df and s is slab\_scale  
 \lambda\_i \sim C^+(0,1)

\hat\lambda\_i^2 = \frac{c^2\lambda\_i^2}{c^2 + \tau^2\lambda\_i^2}

\tau \sim \text{student-t}\_{\nu-global}^+(0, \tau\_0^2)

Where \nu\_{global} is global\_df and \tau\_0^2 is global\_scale.

\beta\_i \sim N(0,\tau\hat\lambda\_i)  
So that are 4 parameters in total and not 5 as in hs()

---

<div class="post-metadata">

**Author:** ![federico](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/federico/32/4948_2.png) [@federico](https://discourse.mc-stan.org/u/federico)\
**Post date:** [May 30, 2019, 5:40pm UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/6 "2019-05-30T17:40:04Z")

</div>

As far as I know:

- `global_scale` and `global_df` are for \tau (student-t distributed)
- `slab_df` and `slab_scale` are for c^{2} (not sure how the inv-gamma is parametrised)
- `df` refers to the degree of freedom for \lambda\_{i} which is still distributed as a student-t. For (regularised) horseshoe you want it to be `df=1` in order to have a Cauchy distribution

I suggest you to look at the Stan implementation in Section C.1 (Appendix C) of Piironen, Vehtari (2017). It might not correspond exactly to the actual implementation in rstanarm though.

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [May 30, 2019, 8:34pm UTC](https://discourse.mc-stan.org/t/understanding-regularized-hs-prior/8005/7 "2019-05-30T20:34:51Z")

</div>

> [@kcar](#):
>
> \lambda\_i \sim C^+(0,1)

`hs()` refers to Hierarchical Shrinkage (not HorseShoe). Hierarchical Shrinkage has  
\lambda\_i \sim t\_\nu^+(0,1)  
Thus five parameters of `hs()` define regularized hierarchical shrinkage prior, but if `df=1` it defines regularized horseshoe. See [[1508.02502] Projection predictive variable selection using Stan+R](https://arxiv.org/abs/1508.02502) and [Sparsity information and regularization in the horseshoe and other shrinkage priors](https://projecteuclid.org/euclid.ejs/1513306866) for more information.
