Inference for the Poisson rate parameter
Again, recall the likelihood structure for your Bayesian Poisson regression model of volume \(Y\)i by weekday status \(X\)i and temperature \(Z\)i:
\(Y\)i \(\sim Pois(l\)i) where \(l\)i\( \; = exp(a + b \; X\)i \(+ c \; Z\)i\()\)
Your 10,000 iteration RJAGS simulation of the model posterior, poisson_sim
, is in your workspace along with a data frame of the Markov chain output:
> head(poisson_chains, 2)
a b.1. b.2. c
1 5.019807 0 -0.1222143 0.01405269
2 5.018642 0 -0.1217608 0.01407691
Using these 10,000 unique sets of posterior plausible values for parameters \(a\), \(b\), and \(c\) you will make inferences about the typical trail volume on 80 degree days.
Este exercício faz parte do curso
Bayesian Modeling with RJAGS
Instruções do exercício
From each set of
poisson_chains
parameter values, calculate the typical trail volumes \(l\) on an 80 degree weekend day. Store these trends as a new variable,l_weekend
, inpoisson_chains
.Similarly, calculate the typical trail volumes on an 80 degree weekday. Store these as a new variable,
l_weekday
.Calculate 95% posterior credible intervals for the typical volume on an 80 degree weekend day and the typical volume on an 80 degree weekday.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Calculate the typical volume on 80 degree weekends & 80 degree weekdays
poisson_chains <- poisson_chains %>%
mutate(l_weekend = exp(___ + ___ * 80)) %>%
mutate(l_weekday = exp(___ + ___ + ___ * 80))
# Construct a 95% CI for typical volume on 80 degree weekend
# Construct a 95% CI for typical volume on 80 degree weekday