12.11 Negative Binomial Regression
\[\begin{array}{rcl} Y_{i} | \beta_{0}, \beta_{1}, \beta_{2}, r & \sim & \text{NegBin}(\mu_{i}) \\ \beta_{0c} & \sim & \text{N}(2, 0.5^{2}) \\ \beta_{1} & \sim & \text{N}(0, 0.15^{2}) \\ \beta_{2} & \sim & \text{N}(0, 5.01^{2}) \\ r & \sim & \text{Exp}(1) \\ \end{array}\]
<- stan_glm(
books_negbin_sim ~ age + wise_unwise,
books data = pulse, family = neg_binomial_2,
prior_intercept = normal(0, 2.5, autoscale = TRUE),
prior = normal(0, 2.5, autoscale = TRUE),
prior_aux = exponential(1, autoscale = TRUE),
chains = 4, iter = 5000*2, seed = 84735)
12.11.1 Prior Distribution
prior_summary(books_negbin_sim)
## Priors for model 'books_negbin_sim'
## ------
## Intercept (after predictors centered)
## ~ normal(location = 0, scale = 2.5)
##
## Coefficients
## Specified prior:
## ~ normal(location = [0,0], scale = [2.5,2.5])
## Adjusted prior:
## ~ normal(location = [0,0], scale = [0.15,5.01])
##
## Auxiliary (reciprocal_dispersion)
## ~ exponential(rate = 1)
## ------
## See help('prior_summary.stanreg') for more details
12.11.3 Interpretation
tidy(books_negbin_sim, conf.int = TRUE, conf.level = 0.80)
## # A tibble: 3 × 5
## term estimate std.error conf.low conf.high
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 2.23 0.131 2.07 2.41
## 2 age 0.000365 0.00239 -0.00270 0.00339
## 3 wise_unwiseWise but Unhappy 0.266 0.0798 0.162 0.368