Skip to content

Instantly share code, notes, and snippets.

@ryanburge
Created May 22, 2019 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanburge/0ecd4d33446aecabc0a9e208a0f11a8d to your computer and use it in GitHub Desktop.
Save ryanburge/0ecd4d33446aecabc0a9e208a0f11a8d to your computer and use it in GitHub Desktop.
CCES PolAct Interaction
cces16 <- cces16 %>%
mutate(att = recode(pew_churatd, "1=6; 2=5; 3=4; 4=3; 5=2; 6=1; else = NA")) %>%
mutate(college = car::recode(educ, "1:4=0; 5:6=1; else = NA")) %>%
mutate(meet = recode(CC16_417a_1, "1=1; else =0")) %>%
mutate(sign = recode(CC16_417a_2, "1=1; else =0")) %>%
mutate(vol = recode(CC16_417a_3, "1=1; else =0")) %>%
mutate(money = recode(CC16_417a_4, "1=1; else =0")) %>%
mutate(blood = recode(CC16_417a_5, "1=1; else =0")) %>%
mutate(activity = meet + sign + vol + money + blood) %>%
mutate(den = case_when(religpew == 1 & religpew_protestant !=3 ~ "Denom",
religpew_protestant == 3 ~ "Non-Denom"))
reg1 <- lm(activity ~ att*den + educ + pid7, data = cces16)
gg2 <- interact_plot(reg1, pred = att, modx = den, interval = TRUE, int.width = .76)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment