what is the unit/scale for priors

149 views
Skip to first unread message

Tristan Mahr

unread,
Aug 26, 2016, 3:57:38 PM8/26/16
to Stan users mailing list
Hi everyone,

rstanarm is terrific, and my gateway into Bayesian regression. I'm giving a tutorial on rstanarm next month to spread the word. I just would like to clarify one issue. What units are the normal/student priors expressed in? Are they expressed in the raw units of y or in some unit-less transformation of y? I can't find a definitive answer in the package documentation or in the vignettes. It certainly seems like the units are scaled in some way.

In the continuous models vignette, the example uses the default normal(0, 5) but one of the effects has a median effect of 51.8 with a MAD of 15.3. If they units are in the raw units of y, then a prior of normal(0, 5) would regularize a 50 +/- 15 effect. 

I also fit two stan_glm models on the iris dataset: `Sepal.Length ~ Sepal.Width * Species`. In one model, I scaled the continuous up measures by 1000 and left the measures unchanged in the other model, but I get comparable effects from both models. For example, the `Speciesversicolor` effect, I get 909.5  +/- 761.4 in the scaled data and 0.9 +/- 0.8 in the unscaled data. Both models have the normal(0, 5) prior, so it seems the prior works in some transformation of y.

Thanks,
Tristan

Ben Goodrich

unread,
Aug 26, 2016, 4:42:29 PM8/26/16
to Stan users mailing list
On Friday, August 26, 2016 at 3:57:38 PM UTC-4, Tristan Mahr wrote:
rstanarm is terrific, and my gateway into Bayesian regression. I'm giving a tutorial on rstanarm next month to spread the word. I just would like to clarify one issue. What units are the normal/student priors expressed in? Are they expressed in the raw units of y or in some unit-less transformation of y? I can't find a definitive answer in the package documentation or in the vignettes. It certainly seems like the units are scaled in some way.

The details depend on which stan_* function you are using, but rstanarm does not transform y internally ever.
 
In the continuous models vignette, the example uses the default normal(0, 5) but one of the effects has a median effect of 51.8 with a MAD of 15.3. If they units are in the raw units of y, then a prior of normal(0, 5) would regularize a 50 +/- 15 effect. 

stan_glm() with family = gaussian by default scales the given priors by the reciprocal standard deviations of the x variables.

Ben

Jonah Gabry

unread,
Aug 27, 2016, 5:14:49 PM8/27/16
to Stan users mailing list
Hey Tristan, looks like Ben already answered the question, but just wanted to say that I'm glad you like rstanarm, and let us know how the tutorial goes! We're always interested to know how people are using rstanarm, what features they would like to see that we currently don't support, which parts of the documentation are confusing, etc. 

Jonah

Jonah Gabry

unread,
Sep 27, 2016, 2:16:45 PM9/27/16
to Stan users mailing list
On Friday, August 26, 2016 at 4:42:29 PM UTC-4, Ben Goodrich wrote:

stan_glm() with family = gaussian by default scales the given priors by the reciprocal standard deviations of the x variables.

Ben

Ben, isn't this actually the reciprocal of twice the standard deviations of x? I think we should be more transparent about this (it's in the doc but not easy to find), as I've gotten several questions about this (and the related issue of rescaling predictors) recently when giving presentations.

Ben Goodrich

unread,
Sep 27, 2016, 2:38:03 PM9/27/16
to Stan users mailing list

Quite possibly but people should be doing QR = TRUE which takes precedence over this.

Jonah Sol Gabry

unread,
Sep 27, 2016, 2:42:28 PM9/27/16
to stan-...@googlegroups.com
Yeah, I don't think we mention that QR negates this behavior. I'll add that to the doc. 

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/_y6aDbkdANw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages