Exercise
Whether a survey respondent agrees or disagrees with a conservative statement about the role of women in society
- 1974/1975 Survey
- Women should take care of running their homes and leave running the country up to men
- Modeled as a function of the gender and years of education (0-20) of the respondents
- Data from the HSAUR3 package
- Observations are aggregate counts at education levels for men and women
Run a binomial logistic regression modeling the proportion of those who agreed - If you are more familiar with binary logistic regression, you may ‘unrole’ this data to be disagree-agree for each individual (the analysis is the same)
data("womensrole", package = "HSAUR3")
# alternative not requiring package
womensrole = readr::read_csv('https://github.com/m-clark/easy-bayes/raw/master/data/womensrole.csv')
womensrole_glm <- glm(cbind(agree, disagree) ~ education + gender,
data = womensrole,
family = binomial)
summary(womensrole_glm)
Now use brms or rstanarm to run the same analysis
Explore it fully by:
- plotting the coefficients (stanplot)
- use shinystan to explore diagnostics (launch_shinystan)
- explore the posterior predictive distribtution (pp_check)
- plot the marginal effect of the predictor variables (marginal_effects)