Posterior inference for multivariate regression
The 10,000 iteration RJAGS simulation output, rail_sim_2, is in your workspace along with a data frame of the Markov chain output:
> head(rail_chains_2, 2)
a b.1. b.2. c s
1 49.76954 0 -12.62112 4.999202 111.02247
2 30.22211 0 -3.16221 4.853491 98.11892
You will use these 10,000 unique sets of parameter values to summarize the posterior mean trend in the relationships between trail volume, weekday status, and hightemp.
本练习是课程的一部分
Bayesian Modeling with RJAGS
练习说明
Construct a scatterplot of volume by hightemp.
- Use
colorto distinguish between weekdays & weekends. - Superimpose a
redline that represents the posterior mean trend of the linear relationship betweenvolumeandhightempfor weekends:m = a + c Z - Superimpose a
turquoise3line that represents the posterior mean trend of the linear relationship betweenvolumeandhightempfor weekdays:m = (a + b.2.) + c Z
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Plot the posterior mean regression models
ggplot(___, aes(x = ___, y = ___, color = ___)) +
geom_point() +
geom_abline(intercept = mean(___), slope = mean(___), color = "red") +
geom_abline(intercept = mean(___) + mean(___), slope = mean(___), color = "turquoise3")