ComeçarComece de graça

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.

Este exercício faz parte do curso

Bayesian Modeling with RJAGS

Ver curso

Instruções do exercício

  • Combine the a and b.2. chain values to construct a chain of 10,000 values for the typical weekday trail volume. Store this as weekday_mean in rail_chains_1.
  • Use ggplot() to construct a density plot of the weekday_mean chain values.
  • Construct a 95% credible interval for the typical weekday trail volume.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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
Editar e executar o código