# Applying a horseshoe prior to a vector of normally distributed estimates

**URL:** <https://discourse.mc-stan.org/t/applying-a-horseshoe-prior-to-a-vector-of-normally-distributed-estimates/18751>\
**Category:** Modeling\
**Created:** [October 18, 2020, 10:52am UTC](https://discourse.mc-stan.org/t/applying-a-horseshoe-prior-to-a-vector-of-normally-distributed-estimates/18751 "2020-10-18T10:52:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sakari/32/9648_2.png) [@Sakari](https://discourse.mc-stan.org/u/Sakari)\
**Post date:** [October 18, 2020, 10:52am UTC](https://discourse.mc-stan.org/t/applying-a-horseshoe-prior-to-a-vector-of-normally-distributed-estimates/18751/1 "2020-10-18T10:52:58Z")

</div>

A user completely new to Stan here. I am trying to address the following problem using Stan: I have a vector of normally distributed estimates \hat\beta\_i=\mathcal{N}(\mu\_i,\sigma\_i^2) for i = 1,...,D from different regression models.

I want to apply the horseshoe prior (or some other shrinkage prior) to those estimates such that

\beta\_i | \lambda\_i,\tau \sim \mathcal{N}(0,\tau^2\lambda\_i^2)  
\lambda\_i \sim \mathcal{C}^+(0,1), \ \ i = 1,...,D

All of the examples I could find deal with estimating the regression model from individual level data using Stan, which is infeasible in my case, I have to impose the prior after estimating the coefficients. The coefficients come from an existing analysis pipeline on large-scale GWAS data, examining effects of multiple exposures on multiple outcomes.

I would appreciate some guidance on how to specify the Stan code to estimate the posterior \beta\_i coefficients using a shrinkage prior.

Toy data for D=4 would be:

```
mu = c(0.1, 0.1, 1, 0.1)
sigma = c(0.1, 0.1, 0.1, 0.1)

```

where hopefully three estimates will be shrunk to near 0 and the estimate of 1 stays at 1. If the prior were a normal distribution, the simple solution would be to use inverse-variance weighing.

Thanks for the help!

---

<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:** [October 19, 2020, 11:00am UTC](https://discourse.mc-stan.org/t/applying-a-horseshoe-prior-to-a-vector-of-normally-distributed-estimates/18751/2 "2020-10-19T11:00:29Z")

</div>

> [@Sakari](#):
>
> \hat\beta\_i=\mathcal{N}(\mu\_i,\sigma\_i^2) for i = 1,...,D

\mu\_i are your unknowns. Put the horseshoe prior on them (even better would be the regularised horseshoe prior)
