 # Help understanding prior specification

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 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)

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.

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: 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.

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?

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.

AHA! That clears things up. Thank you!

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

2 Likes