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.
Bu egzersiz
Bayesian Modeling with RJAGS
kursunun bir parçasıdırEgzersiz talimatları
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
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# 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")