Converting unstandardized priors for rstanarm function arguments

Hi everyone in the Stan community!

I’m struggling to wrap my head around the usage of informative priors in rstanarm functions (in a case where I want exceptionally specific prior information to be included). I’m afraid that the more I think about it without expert feedback, the more I will get lost.
If I understand correctly, stan_glm runs models on transformed data. However, I’m still not 100% sure if it’s standardization or mean-centering (the part of the rstanarm manual on the prior_intercept statement got me confused there). Either way, I’m not sure how to express specific priors correctly.

To clarify my issue, here’s an example: Consider a simple linear regression model

y = a + bx

, where I’d like to apply specific unstandardized normal priors for both parameters a and b, let’s say

a \sim \mathcal{N}(100, 1) and
b \sim \mathcal{N}(5, 2)

How would I express these two specific priors within the prior and prior_intercept statement of stan_glm function? Given that stan_glm requires the expression of priors on a standardized scale, my first idea was to convert the parameters according to

b \hspace{1pt} '= b \hspace{1pt} \frac{\sigma_x}{\sigma_y} and

a \hspace{1pt} '= \frac{a + b \hspace{1pt} ' \hspace{1pt} \frac{\sigma_y}{\sigma_x} \hspace{1pt} \overline{x} - \overline{y}}{\sigma_y}

, where a’ and b’ represent the standardized parameters I could use in the prior arguments of stan_glm.
However, I can’t figure out how to continue from there. If anything, these formulas would only apply to the location argument of my specific priors ? But what about the scale argument?

It would be very appreciated if somebody could help me along on this topic. How do you convert a specific unstandardized normal prior to a scale that fits the requirements of the stan_glm prior arguments? What are the respecitive prior expressions for a and b in the fictional example above?

Thank you for your help,


1 Like


I may have found the answer to my question in Kruschke’s “Doing Bayesian Data Analysis”, but it would be much appreciated if someone who knows their maths better than me could sign it off (or please correct me if I’m wrong)

I believe the location parameters for the standardized slope and intercept would be according to the equations mentioned in my original post. For the scale parameter, Kruschke suggests that the difference between standardized and original scale is simply the factor \sigma_y (the standard deviation of the dependent variable) and the normality parameter is not affected. Kind of obvious if I look at it now. Therefore I’d propose the following solution to my example problem:

a\hspace{1pt}' \sim \mathcal{N} ( \frac{100 + b\hspace{1pt}' \frac{\sigma_y}{\sigma_x} \overline{x} - \overline{y} }{\sigma_y}, \hspace{1pt} \frac{1}{\sigma_y})

b\hspace{1pt}' \sim \mathcal{N} ( 5 \frac{\sigma_x}{\sigma_y}, \hspace{1pt} \frac{2}{\sigma_y})

Again, a\hspace{1pt}' and b\hspace{1pt}' would be the standardized expressions.

Yet one question still remains: how are the priors correctly included in rstanarm functions? If I understand correctly, I would have to set autoscale = FALSE in a normal() function when using standardized priors, and autoscale = TRUE if I use non-standardized priors. So is autoscale actually applying the abovementioned transformation, or is it doing something different? Also, will rstanarm functions always standardize my data before running the model?