# Rstanarm: How to define informative priors from previous studies using stan\_glm?

**URL:** <https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484>\
**Category:** Modeling\
**Tags:** priors, rstanarm, rstan\
**Created:** [March 25, 2021, 10:41am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484 "2021-03-25T10:41:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![IJerkovic](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@IJerkovic](https://discourse.mc-stan.org/u/IJerkovic)\
**Post date:** [March 25, 2021, 10:41am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/1 "2021-03-25T10:41:16Z")

</div>

Hi all,

I am a begginer to Bayesian approach, so I appologise for my question in advance.

I am trying to develop a linear regression model for estimating stature from handprint measurements. I would like to employ the Bayesian approach and define informative priors from the previous studies. I have a data set with several predictors (several linear measurements) and stature measurements (as a target variable).

From previous studies, there is information on descriptive statistics (mean and sd) of the height - my target variable. So, my question is, how can I use that information to extract the informative priors for my study? For example, if I have this data for Stature from the previous study:

mean (STATURE) = 180, SD (STATURE) = 5

how can I use them to construct prior and prior\_intercept in my model:

```stan
Model <- stan_glm(STATURE ~ HL, data = mydata, prior = ?, prior_intercept = ?)

```

Thank you!  
Ivan

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [March 25, 2021, 10:46am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/2 "2021-03-25T10:46:17Z")

</div>

You could do prior predictive checks and ensure that, sampling only from the priors, the outcome is around \mu=180 with a sd of 10 perhaps. That way you allow some room. **But** , would it be possible to get your hands on the previous data and incorporate this into your model instead?

---

<div class="post-metadata">

**Author:** ![IJerkovic](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@IJerkovic](https://discourse.mc-stan.org/u/IJerkovic)\
**Post date:** [March 25, 2021, 12:11pm UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/3 "2021-03-25T12:11:43Z")

</div>

Thanks for quick feedback! Could you tell me how to employ available μ and sd for outcome to stan\_glm framework or other bayesian options in R?

Previous data that would include same predictors and outcomes do not exist for my population.  
In analysed population, I collected data on print measurements (predictors) and height of those participants (outcome). From previous studies (of different type) on same population, I have only information on height.

The main premise of this research type is that all populations are different, so I am not sure if could use models and parameters from the studies conducted on other populations, e.g.,

Height = 69.723 +5 .567 x predictor, SEE = 4.83, r = 0.73  
, and which parameters to consider.

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [March 25, 2021, 12:16pm UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/4 "2021-03-25T12:16:25Z")

</div>

The only sane way to go forward here is to look what your priors imply on the outcome. In short, do prior predictive checks. You’d like to have priors that ‘sort of’ reflect the prior knowledge you have.

---

<div class="post-metadata">

**Author:** ![IJerkovic](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@IJerkovic](https://discourse.mc-stan.org/u/IJerkovic)\
**Post date:** [March 25, 2021, 12:22pm UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/5 "2021-03-25T12:22:06Z")

</div>

Thank you, I will try.

---

<div class="post-metadata">

**Author:** ![IJerkovic](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@IJerkovic](https://discourse.mc-stan.org/u/IJerkovic)\
**Post date:** [March 30, 2021, 9:10am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/6 "2021-03-30T09:10:44Z")

</div>

I checked again some previous studies from the field, which showed that taking stature prior from other sources could be an appropriate approach (mainly because the stature is one of the standard biological traits).

I completed an introductory course to the rstanarm, but I see now that I am missing some basic concepts regarding the prior distributions. I checked many topics but didn’t find a relevant example that could help me specify a prior distribution for modeling or predictive checks.

Suppose I know that my variable is relatively normal with a mean 180 and sd 5. So, in that case, what should be my prior and prior intercept? How to specify them? I know that this question can be basic, but I see that I have to define those two parameters both for modeling and predictive checks.

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [March 30, 2021, 9:15am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/7 "2021-03-30T09:15:47Z")

</div>

You conduct prior predictive checks to see what the priors imply. See here for a simple example taken largely from McElreath’s book,  
[https://torkar.github.io/BDA\_in\_ESE/](https://torkar.github.io/BDA_in_ESE/)

---

<div class="post-metadata">

**Author:** ![IJerkovic](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@IJerkovic](https://discourse.mc-stan.org/u/IJerkovic)\
**Post date:** [March 30, 2021, 9:18am UTC](https://discourse.mc-stan.org/t/rstanarm-how-to-define-informative-priors-from-previous-studies-using-stan-glm/21484/8 "2021-03-30T09:18:14Z")

</div>

Thank you!
