Exercise

Posterior point estimates

Recall the likelihood of the Bayesian regression model of weight \(Y\) by height \(X\): \(Y \sim N(m, s^2)\) where \(m = a + b X\). A 100,000 iteration RJAGS simulation of the posterior, weight_sim_big, is in your workspace along with a data frame of the Markov chain output:

> head(weight_chains, 2)
          a        b        s iter
1 -113.9029 1.072505 8.772007    1
2 -115.0644 1.077914 8.986393    2

The posterior means of the intercept & slope parameters, \(a\) & \(b\), reflect the posterior mean trend in the relationship between weight & height. In contrast, the full posteriors of \(a\) & \(b\) reflect the range of plausible parameters, thus posterior uncertainty in the trend. You will examine the trend and uncertainty in this trend below. The bdims data are in your workspace.

Instructions

100 XP
  • Obtain summary() statistics of the weight_sim_big chains.
  • The posterior mean of \(b\) is reported in Table 1 of the summary(). Use the raw weight_chains to verify this calculation.
  • Construct a scatterplot of the wgt vs hgt data in bdims. Use geom_abline() to superimpose the posterior mean trend.
  • Construct another scatterplot of wgt vs hgt. Superimpose the 20 regression lines defined by the first 20 sets of \(a\) & \(b\) parameter values in weight_chains.