README.md

Multilevel Regression and Marginal Poststratification

This README.md file gives a quick overview of the code used to generate state level MRmP estimates (For further information on MRmP please refer to Leemann and Wasserfallen's 2014 paper: Extending the Use and Prediction Precision of Subnational Public Opinion Estimation).

Unique Estimates

This code can be used to generate unique MRmP estimates:

x <- get_margins(states = c("ALL"), vars = c('sex', 'age', 'race', 'education', 'religion', 'party')) 
joints <- get_joint_probs(x)

individualvars <- c("age + stname  + sex + education + race + party + religion")
groupingvars <- c("obama12 + medianhhincome + percent_gdp_increase")

test <- mrmp(
  survey_data     = df,
  jointp_list     = joints,
  individualvars  = individualvars,
  groupingvars    = groupingvars,
  response        = 'y',
  survey_sample   = 10000
) %>% 
  bind_rows()


jwyatt85/MRmP documentation built on May 20, 2019, 6:27 a.m.