Inference for volume by weekday
The 10,000 iteration RJAGS simulation output, rail_sim_1
, is in your workspace along with a data frame of the Markov chain output:
> head(rail_chains_1, 2)
a b.1. b.2. s
1 420.6966 0 -54.30783 118.2328
2 399.5823 0 -52.02570 119.9499
These chains provide 10,000 unique sets of values for a
, the typical trail volume on weekend days, and b.2.
, the contrast between typical weekday volume vs weekend volume. For example, the first set of parameters indicate that there are typically 420.6966
riders on weekend days and 54.30783
fewer riders on weekdays. Thus there are typically 420.6966 - 54.30783 = 366.3888
riders on weekdays. You will utilize these simulation data to make inferences about weekday trail volume.
This exercise is part of the course
Bayesian Modeling with RJAGS
Exercise instructions
- Combine the
a
andb.2.
chain values to construct a chain of 10,000 values for the typical weekday trail volume. Store this asweekday_mean
inrail_chains_1
. - Use
ggplot()
to construct a density plot of theweekday_mean
chain values. - Construct a 95% credible interval for the typical weekday trail volume.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Construct a chain of values for the typical weekday volume
rail_chains_1 <- rail_chains_1 %>%
mutate(weekday_mean = ___)
# Construct a density plot of the weekday chain
ggplot(___, aes(x = ___)) +
geom_density()
# 95% credible interval for typical weekday volume