Exercise

# Regression priors

Let \(Y\)_{i} be the weight (in kg) of subject \(i\). Past studies have shown that weight is linearly related to height \(X\)_{i} (in cm). The average weight \(m\)_{i} among adults of any shared height \(X\)_{i} can be written as \(m\)_{i} \(= a + b X\)_{i}. But height isn't a perfect predictor of weight - individuals vary from the trend. To this end, it's reasonable to assume that \(Y\)_{i} are Normally distributed around \(m\)_{i} with *residual standard deviation* \(s\): \(Y\)_{i} \(\sim N(m\)_{i}, \(s^2)\).

Note the 3 parameters in the model of weight by height: intercept \(a\), slope \(b\), & standard deviation \(s\). In the first step of your Bayesian analysis, you will simulate the following prior models for these parameters: \(a \sim N(0, 200^2)\), \(b \sim N(1, 0.5^2)\), and \(s \sim Unif(0, 20)\).

Instructions

**100 XP**

- Sample 10,000 draws from each of the \(a\), \(b\), and \(s\) priors. Assign the output to
`a`

,`b`

, and`s`

. These are subsequently combined in the`samples`

data frame along with`set = 1:10000`

, an indicator of the draw numbers. - Construct separate density plots of each of the
`a`

,`b`

, and`s`

samples.