11.4 Dreaming bigger: Utilizing more than 2 predictors!

To improve our understanding and posterior predictive accuracy of afternoon temperatures, we can incorporate more and more predictors into our model.

weather_WU %>% 
  names()
## [1] "location"     "windspeed9am" "humidity9am"  "pressure9am"  "temp9am"     
## [6] "temp3pm"
weather_model_4 <- stan_glm(
  temp3pm ~ .,
  data = weather_WU, 
  family = gaussian, 
  prior_intercept = normal(25, 5),
  prior = normal(0, 2.5, autoscale = TRUE), 
  prior_aux = exponential(1, autoscale = TRUE),
  chains = 4, iter = 5000*2, 
  seed = 84735)
# Confirm prior specification
prior_summary(weather_model_4)
## Priors for model 'weather_model_4' 
## ------
## Intercept (after predictors centered)
##  ~ normal(location = 25, scale = 5)
## 
## Coefficients
##   Specified prior:
##     ~ normal(location = [0,0,0,...], scale = [2.5,2.5,2.5,...])
##   Adjusted prior:
##     ~ normal(location = [0,0,0,...], scale = [37.52, 2.37, 0.82,...])
## 
## Auxiliary (sigma)
##   Specified prior:
##     ~ exponential(rate = 1)
##   Adjusted prior:
##     ~ exponential(rate = 0.13)
## ------
## See help('prior_summary.stanreg') for more details
# Check MCMC diagnostics
mcmc_trace(weather_model_4)

mcmc_dens_overlay(weather_model_4)

mcmc_acf(weather_model_4)

# Posterior summaries
posterior_interval(weather_model_4, prob = 0.95)
##                            2.5%       97.5%
## (Intercept)        -23.92281904 98.96184755
## locationWollongong  -7.19827046 -5.66547243
## windspeed9am        -0.05491239  0.02975158
## humidity9am         -0.05169826 -0.01510501
## pressure9am         -0.08255876  0.03669673
## temp9am              0.72892547  0.87455883
## sigma                2.10496742  2.57179996