# Help understanding prior specification

**URL:** <https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579>\
**Category:** Modeling\
**Tags:** specification\
**Created:** [January 10, 2020, 11:16pm UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579 "2020-01-10T23:16:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Longshot408](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/longshot408/32/6484_2.png) [@Longshot408](https://discourse.mc-stan.org/u/Longshot408)\
**Post date:** [January 10, 2020, 11:16pm UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/1 "2020-01-10T23:16:07Z")

</div>

Hello all,  
Quick and simple question about specifying priors for a logistic regression with stan\_glm. Can someone explain exactly what is meant by both “scale” and “location”? I thought I got it, then I read [this link](https://strengejacke.files.wordpress.com/2017/12/bayesian-regression-models.pdf) and talked to my mentor a bit, and now it’s fuzzy. I dug through the documentation in the user’s guide and manual and couldn’t find explicit definitions or references to either.

Specifically, does the location simply mean “expected regression coefficient”? And if so, in the case of a logistic model with stan\_glm, do I have to transform my expected coefficient values before putting them in the prior? Lets say I got a posterior beta weight of 1.3 for a coefficient in experiment one and wanted to set that as the prior location for experiment two. Would the location just be 1.3? Or log(1.3)? Etc.

Does scale mean the Standard Deviation? Or is it also a coefficient value, that is equal to 1 Standard Deviation? (e.g. I input 1.5, which means 1.0 Standard Deviations in that distribution=1.5 on the unit scale)

---

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [January 10, 2020, 11:34pm UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/2 "2020-01-10T23:34:16Z")

</div>

I think the scale and location lingo come from wanting to talk about parameters of lots of distributions (student-ts, cauchys), that don’t necessarily have means or standard deviations. For a normal, it is the mean and standard deviation.

> [@Longshot408](#):
>
> Lets say I got a posterior beta weight of 1.3 for a coefficient in experiment one and wanted to set that as the prior location for experiment two. Would the location just be 1.3? Or log(1.3)? Etc.

These scales and locations by default are adjusted according to your data, so if you’re moving them from experiment to experiment I’d guess you’d want to turn off the automatic adjustment: [Prior Distributions for rstanarm Models](https://cran.r-project.org/web/packages/rstanarm/vignettes/priors.html) (all of that is probably useful to read)

If you’re doing this sort of model in brms you can use `make_stancode` and `make_standata` to see what priors are actually getting generated in the code. The tradeoff there is then you gotta compile models all the time, but being able to see the actual Stan code helps a lot in terms of answering these questions.

---

<div class="post-metadata">

**Author:** ![Longshot408](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/longshot408/32/6484_2.png) [@Longshot408](https://discourse.mc-stan.org/u/Longshot408)\
**Post date:** [January 10, 2020, 11:45pm UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/3 "2020-01-10T23:45:38Z")

</div>

I’ve read most of those vignettes already, and sadly I’m still confused. Take this line of code for example, from the very last part of that page where he talks about setting more informed priors:

```
my_prior <- normal(location = c(-10, 0), scale = c(5, 2), autoscale = FALSE)
stan_glm(y ~ x1 + x2, data = dat, prior = my_prior)

```

I get that -10 could be a coefficient, but 5 for its Standard Deviation? At 3.0 SD’s you’ve captured 99.99% of the data already, so why 5? Or is 5.0 supposed to mean that 1 Standard Deviation in this distribution is equal to a change of 5 units?

---

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [January 10, 2020, 11:54pm UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/4 "2020-01-10T23:54:14Z")

</div>

5 and 2 would be the standard deviations of the first and second parameter.

So the prior for the first parameter is mean -10 with standard deviation 5. So 68% of the prior probability is between -15 and -5 in the prior.

---

<div class="post-metadata">

**Author:** ![Longshot408](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/longshot408/32/6484_2.png) [@Longshot408](https://discourse.mc-stan.org/u/Longshot408)\
**Post date:** [January 11, 2020, 12:00am UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/5 "2020-01-11T00:00:50Z")

</div>

AHA! That clears things up. Thank you!

---

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [January 11, 2020, 12:01am UTC](https://discourse.mc-stan.org/t/help-understanding-prior-specification/12579/6 "2020-01-11T00:01:28Z")

</div>

But if you care about the super-specifics of your priors, then maybe do a few experiments to understand what the adjustment is doing.
