# Boundary-Avoiding Priors

**URL:** <https://discourse.mc-stan.org/t/boundary-avoiding-priors/3452>\
**Category:** Modeling\
**Tags:** loo\
**Created:** [March 4, 2018, 3:30pm UTC](https://discourse.mc-stan.org/t/boundary-avoiding-priors/3452 "2018-03-04T15:30:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![anon75146577](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon75146577](https://discourse.mc-stan.org/u/anon75146577)\
**Post date:** [March 4, 2018, 11:20pm UTC](https://discourse.mc-stan.org/t/boundary-avoiding-priors/3452/3 "2018-03-04T23:20:46Z")

</div>

> [@ignacio](#):
>
> I’m trying to figure out what prior I should use for the dispersion parameter of a negative binomial distribution (phi).

My recommendation would be the PC prior on the over-dispersion parameter. It can be found here. [rejoinder.pdf](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/2/2f5132a4d48ced593f0f9d2815474e9a21a26f54.pdf) (236.0 KB)

R-code for the log-density:

```no-highlight
INLA::inla.pc.dgamma function (x, lambda = 1, log = FALSE) 
{
    inv.x = 1/x
    d = sqrt(2 * (log(inv.x) - psigamma(inv.x)))
    ld = -lambda * d - log(d) + log(lambda) - 2 * log(x) + log(psigamma(inv.x, 
        deriv = 1) - x)
    return(if (log) ld else exp(ld))
}

```

This is the default in INLA and it’s worked quite well in applications.

---

_[View the full topic](https://discourse.mc-stan.org/t/boundary-avoiding-priors/3452)._
