Regression Example
Regression is a method to summarize how predictions or averages of an outcome varies across individuals defined by a set of predictors.
Example: US Presidential elections vs economic growth in period leading up to the election:
ggplot(data=hibbs, aes(x=growth, y=vote)) +
geom_point() + ylab('Incumbant Vote') + xlab('Precent Growth') +
geom_abline(intercept = coef(M1)[1], slope = coef(M1)[2], col='blue')
We can examine the coefficients by printing the model:
## stan_glm
## family: gaussian [identity]
## formula: vote ~ growth
## observations: 16
## predictors: 2
## ------
## Median MAD_SD
## (Intercept) 46.3 1.7
## growth 3.1 0.7
##
## Auxiliary parameter(s):
## Median MAD_SD
## sigma 3.9 0.8
##
## ------
## * For help interpreting the printed output see ?print.stanreg
## * For info on the priors used see ?prior_summary.stanreg
The median model is \(y = 46.3 + 3.0x\)