############################## ## ## Resistance Is Not Futile ## ############################## # Clear the environment rm(list=ls()) # set working directory setwd("/Users/nmiras/Desktop/PSQ Submission/Supplementary Materials") getwd() # load packages library(dplyr) library(stargazer) library(sjPlot) library(ggplot2) library(lme4) library(gridExtra) ############################### ## ## Bivariate Analysis ## ############################### # load the dataset for the bivariate analysis bv.vote <- read.csv("bv_vote.csv") # set the color scheme for producing ggplots cols <- c("Democrat" = "blue", "Republican" = "red") # figure 1: 2017 women's march attendance and all Senate votes tiff("figure1.tiff", height = 6, width = 7.5, res = 300, units = 'in') ggplot(bv.vote, aes(x = bv.vote$wm.per.vepbg, y = bv.vote$v.for.trump, colour = party)) + theme_bw() + scale_color_manual(values = cols) + labs(y = "Percentage of Votes With President Trump's Position", x = "2017 Women's March Intensity") + geom_smooth(method = lm) + theme(legend.title = element_blank(), legend.position = "none") + geom_text(aes(label = last, colour = party)) dev.off() # figure 2: 2017 women's march attendance and nomination votes tiff("figure2.tiff", height = 6, width = 7.5, res = 300, units = 'in') ggplot(bv.vote, aes(x = bv.vote$wm.per.vepbg, y = bv.vote$v.for.trump.n, colour = party)) + theme_bw() + scale_color_manual(values = cols) + labs(y = "Percentage of Votes With President Trump's Position", x = "2017 Women's March Intensity") + geom_smooth(method = lm) + theme(legend.title = element_blank(), legend.position = "none") + geom_text(aes(label = last, colour = party)) dev.off() # get correlations and statistical significance d.bv <- bv.vote %>% filter(party == "Democrat") r.bv <- bv.vote %>% filter(party == "Republican") # correlation for Democrats (Women's March intensity) cor.test(d.bv$wm.per.vepbg, d.bv$v.for.trump, method = "pearson") #r = -0.53 cor.test(d.bv$wm.per.vepl, d.bv$v.for.trump, method = "pearson") #r = -0.55 cor.test(d.bv$wm.per.veph, d.bv$v.for.trump, method = "pearson") #r = -0.50 cor.test(d.bv$wm.per.vepbg, d.bv$v.for.trump.n, method = "pearson") #r = -0.55 # correlation for Republicans (Women's March intensity) cor.test(r.bv$wm.per.vepbg, r.bv$v.for.trump, method = "pearson") #r = -0.15 (insig) cor.test(r.bv$wm.per.vepl, r.bv$v.for.trump, method = "pearson") #r = -0.21 (insig) cor.test(r.bv$wm.per.veph, r.bv$v.for.trump, method = "pearson") #r = -0.11 (insig) cor.test(r.bv$wm.per.vepbg, r.bv$v.for.trump.n, method = "pearson") #r = -0.34 ############################### ## ## Tweet clouds ## ############################### ## NOTE: For some reason, this code has problems running on Mac (but works on PC!) # load data for word cloud of tweets cloud <- read.csv("total_tweets.csv") # create separate sets for Republicans and Democrats R.tweets <- cloud %>% filter(i.party == "Republican") D.tweets <- cloud %>% filter(i.party == "Democrat") # Starting with Republicans -- take the text of the tweets R.text <- R.tweets$tweet # Replace @UserName R.text <- gsub("@\\w+", "", R.text) # Remove links R.text <- gsub("http\\w+", "", R.text) # Remove punctuation R.text <- gsub("[[:punct:]]", "", R.text) # Remove tabs R.text <- gsub("[ |\t]{2,}", "", R.text) # Remove blank spaces at the beginning R.text <- gsub("^ ", "", R.text) # Replace blank space ("rt") R.text <- gsub("rt", "", R.text) # Remove blank spaces at the end R.text <- gsub(" $", "", R.text) # Remove emojis and junk R.text <- iconv(R.text, 'UTF-8', 'ASCII') # only do this if it's giving this error -- seems to be very picky # convert all text to lower case R.text <- tolower(R.text) # Load the 'tm' package: library(tm) # Create a corpus: R.text.corpus <- Corpus(VectorSource(R.text)) # Remove stop words: R.text.corpus <- tm_map(R.text.corpus, function(x)removeWords(x,stopwords())) # Remove "amp" and "will" (these are just the function messing up, need to remove them): R.text.corpus <- tm_map(R.text.corpus, removeWords, c("amp", "will", "2017", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec")) # Load the 'wordcloud' package: library(wordcloud) # Create the word cloud for Republicans: (figure 3) wordcloud(R.text.corpus, min.freq = 2, scale = c(7,0.5), colors = brewer.pal(8, "Dark2"), random.color = TRUE, random.order = FALSE, max.words = 150) # Now with Democrats -- take the text of the tweets D.text <- D.tweets$tweet # Replace @UserName D.text <- gsub("@\\w+", "", D.text) # Remove links D.text <- gsub("http\\w+", "", D.text) # Remove punctuation D.text <- gsub("[[:punct:]]", "", D.text) # Remove tabs D.text <- gsub("[ |\t]{2,}", "", D.text) # Remove blank spaces at the beginning D.text <- gsub("^ ", "", D.text) # Replace blank space ("rt") D.text <- gsub("rt", "", D.text) # Remove blank spaces at the end D.text <- gsub(" $", "", D.text) # Remove emojis and junk # tweets.text <- iconv(tweets.text, 'UTF-8', 'ASCII') # only do this if it's giving this error -- seems to be very picky # convert all text to lower case D.text <- tolower(D.text) # Create a corpus: D.text.corpus <- Corpus(VectorSource(D.text)) # Remove stop words: D.text.corpus <- tm_map(D.text.corpus, function(x)removeWords(x,stopwords())) # Remove "amp" and "will" (these are just the function messing up, need to remove them): D.text.corpus <- tm_map(D.text.corpus, removeWords, c("amp", "will", "2017", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", "today")) # Create the word cloud: (figure 4) wordcloud(D.text.corpus, min.freq = 2, scale = c(7,0.5), colors = brewer.pal(8, "Dark2"), random.color = TRUE, random.order = FALSE, max.words = 150) ####################################### ## ## Legislative Opposition ## ####################################### # load data all.votes <- read.csv("vote_data.csv") # the next two steps are necessary to get around the problem that occurs when # using the scale() function. Once you scale something using that function, R runs # into problems when you try to perform functions with that variable (e.g., 'dplyr' # for instance is picky and gives errors when you try to use it after doing this). To # get around this, we can just export the dataset with the new variable to a .csv, and # then re-load it so that R no longer recognizes the use of the scale() function. # create re-scaled ideology variable all.votes$citi <- scale(all.votes$citi.2016) # save to .csv file write.csv(all.votes, file = "vote_data_2.csv") # remove the original dataset and re-load the new one rm(all.votes) all.votes <- read.csv("vote_data_2.csv") # create dataset for just nominations votes nom.votes <- all.votes %>% filter(nomination == 1) # subset for Republicans (all votes) R.all.votes <- all.votes %>% filter(i.party == "Republican") # subset for Republicans (nominations votes) R.nom.votes <- nom.votes %>% filter(i.party == "Republican") # subset for Democrats (all votes) D.all.votes <- all.votes %>% filter(i.party == "Democrat") # subset for Democrats (nominations votes) D.nom.votes <- nom.votes %>% filter(i.party == "Democrat") ####################################### ## ## Table 1 models (Senate votes) ## ####################################### # Democrats, all votes maga1 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga1) # Democrats, nominations votes maga2 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepbg + s.net.approve + m.protest.1000 + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.nom.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga2) # Republicans, all votes maga3 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga3) # Can't even run the model for Republicans with nominations votes. # Not enough variation -- only 8 instances out of over 1000 where they voted against # the nominee. Provides support for my hypothesis. # Table for models: sjt.glmer(maga1, maga2, maga3, exp.coef = FALSE, digits.est = 3, emph.p = TRUE, p.numeric = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.re.var = TRUE, show.loglik = TRUE, show.aic = TRUE, separate.ci.col = FALSE, file = "table2.doc") # Plots for Women's March Intensity: plot1 <- plot_model(maga1, type = "eff", terms = "s.wm.per.vepbg", title = "Democrats, All Bills", axis.lim = c(0, 1)) + theme_bw() + labs(x = "Women's March Intensity", y = "Pr(Legislative Support)") plot2 <- plot_model(maga2, type = "eff", terms = "s.wm.per.vepbg", title = "Democrats, Nominations Bills", axis.lim = c(0, 1)) + theme_bw() + labs(x = "Women's March Intensity", y = "Pr(Legislative Support)") plot3 <- plot_model(maga3, type = "eff", terms = "s.wm.per.vepbg", title = "Republicans, All Bills", axis.lim = c(0, 1)) + theme_bw() + labs(x = "Women's March Intensity", y = "Pr(Legislative Support)") # arrange plots into grid tiff("figure5.tiff", height = 9, width = 5, res = 300, units = 'in') grid.arrange(plot1, plot2, plot3, ncol = 1) dev.off() ############################### ## ## Extralegislative Opposition ## ############################### # load tweet dataset tweets <- read.csv("total_tweets.csv") # rescale the citizen ideology variable tweets$citi <- scale(tweets$citi.2016) # the next two steps are necessary to get around the problem that occurs when # using the scale() function. Once you scale something using that function, R runs # into problems when you try to perform functions with that variable (e.g., 'dplyr' # for instance is picky and gives errors when you try to use it after doing this). To # get around this, we can just export the dataset with the new variable to a .csv, and # then re-load it so that R no longer recognizes the use of the scale() function. # save to .csv file write.csv(tweets, file = "total_tweets_2.csv") # remove the original dataset and re-load the new one rm(tweets) tweets <- read.csv("total_tweets_2.csv") # create a new variable to create the cross-tabulation tweets$tweet.content <- ifelse(tweets$trump.critical == 1, 1, ifelse(tweets$trump.neutral == 1, 2, ifelse(tweets$trump.positive == 1, 3, ifelse(tweets$trump.critical == 0 & tweets$trump.neutral == 0 & tweets$trump.positive == 0, 4, 0)))) # Cross tabulation (for paper) library(gmodels) CrossTable(y = tweets$tweet.content, x = tweets$i.party, prop.c = F, prop.t = F, prop.chisq = F, chisq = T, format = "SPSS") # subset for Republicans R.tweets <- tweets %>% filter(i.party == "Republican") # subset for Democrats D.tweets <- tweets %>% filter(i.party == "Democrat") # Democrats, critical tweets maga5 <- glmer(trump.critical ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga5) # fails to converge with max grad 0.003 -- can safely ignore. # Democrats, neutral tweets maga6 <- glmer(trump.neutral ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga6) # fails to converge with max grad 0.002 -- can safely ignore. # Democrats, positive tweets maga7 <- glmer(trump.positive ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga7) # converges # Republicans, critical tweets maga8 <- glmer(trump.critical ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga8) # converges # Republicans, neutral tweets maga9 <- glmer(trump.neutral ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga9) # fails to converge with max grad 0.002 -- can safely ignore. # Republicans, positive tweets maga10 <- glmer(trump.positive ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.tweets, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2000000))) summary(maga10) # fails to converge with max grad 0.001 -- can safely ignore. # Table for democratic results: sjt.glmer(maga5, maga6, maga7, exp.coef = FALSE, emph.p = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.loglik = TRUE, show.aic = TRUE, digits.est = 3, file = "table3.doc") # Table for Republican results: sjt.glmer(maga8, maga9, maga10, exp.coef = FALSE, emph.p = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.loglik = TRUE, show.aic = TRUE, digits.est = 3, file = "table4.doc") # Create plots with predicted probability plot7 <- plot_model(maga5, type = "eff", terms = "m.protest.1000", title = "Senate Democrats") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Critical Tweet)") plot8 <- plot_model(maga6, type = "eff", terms = "m.protest.1000", title = "") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Neutral Tweet)") plot9 <- plot_model(maga7, type = "eff", terms = "m.protest.1000", title = "") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Positive Tweet)") plot10 <- plot_model(maga8, type = "eff", terms = "m.protest.1000", title = "Senate Republicans") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Critical Tweet)") plot11 <- plot_model(maga9, type = "eff", terms = "m.protest.1000", title = "") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Neutral Tweet)") plot12 <- plot_model(maga10, type = "eff", terms = "m.protest.1000", title = "") + theme_bw() + labs(x = "Anti-Trump Demonstrations", y = "Pr(Positive Tweet)") tiff("figure6.tiff", height = 7, width = 7, res = 300, units = 'in') grid.arrange(plot7, plot10, plot8, plot11, plot9, plot12, ncol = 2) dev.off() ####################################### ## ## Appendix A: Odds Ratios (votes) ## ####################################### # Odds ratio plot, Senate Democrats (all votes) or1 <- plot_model(maga1, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Senate Democrats, All Votes", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Citizen ideology")) + theme_bw() # Odds ratio plot, Senate Democrats (nominations votes) or2 <- plot_model(maga2, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Senate Democrats, Nom. Votes", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Citizen ideology")) + theme_bw() # Odds ratio plot, Senate Republicans or3 <- plot_model(maga3, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Senate Republicans, All Votes", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Endorsed Trump", "Citizen ideology")) + theme_bw() # Odds ratio plot, all tiff("figureb1.tiff", height = 5.5, width = 13, res = 300, units = 'in') grid.arrange(or1, or2, or3, ncol = 3) dev.off() ####################################### ## ## Appendix A: Odds Ratios (tweets) ## ####################################### # Odds ratio plots: or4 <- plot_model(maga5, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Critical Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Citizen ideology")) + theme_bw() or5 <- plot_model(maga6, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Neutral Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Citizen ideology")) + theme_bw() or6 <- plot_model(maga7, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Positive Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Citizen ideology")) + theme_bw() # Odds ratio plot for Democrats tiff("figureb2.tiff", height = 5.5, width = 13, res = 300, units = 'in') grid.arrange(or4, or5, or6, ncol = 3) dev.off() or7 <- plot_model(maga8, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Critical Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Endorsed Trump", "Citizen ideology")) + theme_bw() or8 <- plot_model(maga9, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Neutral Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Endorsed Trump", "Citizen ideology")) + theme_bw() or9 <- plot_model(maga10, show.values = TRUE, show.p = TRUE, value.offset = 0.3, colors = "bw", vline.color = "grey", title = "Positive Tweets", axis.labels = c("Women's March intensity", "Trump 2016 vote share", "Trump net approval", "Senator ideology", "Anti-Trump protests", "Reelection 2018", "Party leadership", "Endorsed Trump", "Citizen ideology")) + theme_bw() # Odds ratio plot tiff("figureb3.tiff", height = 5.5, width = 13, res = 300, units = 'in') grid.arrange(or7, or8, or9, ncol = 3) dev.off() ####################################### ## ## Appendix B: Robustness Checks (Votes) ## ####################################### ### Low estimates of Women's March intensity: # Democrats, all votes maga1.r <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepl + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga1.r) # Democrats, nominations votes maga2.r <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepl + s.net.approve + m.protest.1000 + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.nom.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga2.r) # Republicans, all votes maga3.r <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.vepl + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga3.r) ### High estimates of Women's March intensity: # Democrats, all votes maga1.r2 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.veph + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga1.r2) # Democrats, nominations votes maga2.r2 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.veph + s.net.approve + m.protest.1000 + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.nom.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga2.r2) # Republicans, all votes maga3.r2 <- glmer(v.for.trump ~ s.trump.2016 + s.wm.per.veph + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.all.votes, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga3.r2) # Table for models (robustness, low estimates): sjt.glmer(maga1.r, maga2.r, maga3.r, exp.coef = FALSE, digits.est = 3, emph.p = TRUE, p.numeric = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.re.var = TRUE, show.loglik = TRUE, show.aic = TRUE, separate.ci.col = FALSE, file = "tablec1.doc") # Table for models (robustness, high estimates): sjt.glmer(maga1.r2, maga2.r2, maga3.r2, exp.coef = FALSE, digits.est = 3, emph.p = TRUE, p.numeric = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.re.var = TRUE, show.loglik = TRUE, show.aic = TRUE, separate.ci.col = FALSE, file = "tablec2.doc") ####################################### ## ## Appendix B: Robustness Checks (Tweets) ## ####################################### # Excluding events from the January 2017 Women's March: D.tweets.nj <- D.tweets %>% filter(month != 1) R.tweets.nj <- R.tweets %>% filter(month != 1) # Democrats, critical tweets maga5.r <- glmer(trump.critical ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.minority.leadership + i.reelection.2018 + citi + nominate + (1|senator) + (1|month) + (1|state), data = D.tweets.nj, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 100000))) summary(maga5.r) # Republicans, critical tweets maga8.r <- glmer(trump.critical ~ s.trump.2016 + s.wm.per.vepbg + m.protest.1000 + s.net.approve + i.majority.leadership + i.reelection.2018 + i.endorse.trump + citi + nominate + (1|senator) + (1|month) + (1|state), data = R.tweets.nj, family = binomial(link = "logit"), control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 200000))) summary(maga8.r) # Table for models: sjt.glmer(maga5.r, maga8.r, exp.coef = FALSE, emph.p = TRUE, show.ci = FALSE, show.se = TRUE, show.r2 = TRUE, show.icc = FALSE, show.loglik = TRUE, show.aic = TRUE, digits.est = 3, file = "tabled1.doc") ############################### ## Extra analyses per reviewer comments ############################### states <- read.csv("state_data.csv") plot(states$citi.2016, states$wm.per.vepbg) cor.test(states$citi.2016, states$wm.per.vepbg, method = "pearson") # r = 0.43. cor.test(states$erikson.2011, states$wm.per.vepbg, method = "pearson") # r = 0.43. cor.test(states$ek.2010, states$wm.per.vepbg, method = "pearson") # r = 0.34. # correlation between citizen ideology and Women's March intensity is only .43. # Suggests that there is some moderate association, but it's not particularly # strong. plot(bv.vote$citi.2016, bv.vote$nominate) plot(bv.vote$wm.per.vepbg, bv.vote$ nominate) cor.test(bv.vote$wm.per.vepbg, bv.vote$nominate, method = "pearson") cor.test(bv.vote$citi.2016, bv.vote$nominate, method = "pearson") # correlation between citizen ideology (Berry et al. measure) and Women's March # intensity is -.71. cor.test(bv.vote$erikson.2011, bv.vote$nominate, method = "pearson") # correlation between citizen ideology (Erikson et al. measure) and Women's # March intensity is -0.57. cor.test(bv.vote$ek.2010, bv.vote$nominate, method = "pearson") # correlation between citizen ideology (Enns and Koch 2010 measure) and # Women's March intensity is -0.65. # What about the correlations between citizen ideology and legislative opposition? # Democrats, all bills: plot(d.bv$citi.2016, d.bv$v.for.trump) cor.test(d.bv$citi.2016, d.bv$v.for.trump, method = "pearson") # r = -0.66. cor.test(d.bv$erikson.2011, d.bv$v.for.trump, method = "pearson") # r = -0.36. cor.test(d.bv$ek.2010, d.bv$v.for.trump, method = "pearson") # r = -0.36. # Democrats, nominations votes: plot(d.bv$citi.2016, d.bv$v.for.trump.n) cor.test(d.bv$citi.2016, d.bv$v.for.trump.n, method = "pearson") # r = -0.65 cor.test(d.bv$erikson.2011, d.bv$v.for.trump.n, method = "pearson") # r = -0.35 cor.test(d.bv$ek.2010, d.bv$v.for.trump.n, method = "pearson") # r = -0.34. # Republicans, all bills: plot(r.bv$citi.2016, r.bv$v.for.trump) cor.test(r.bv$citi.2016, r.bv$v.for.trump, method = "pearson") #r = -0.17 (insig) cor.test(r.bv$erikson.2011, r.bv$v.for.trump, method = "pearson") # r = -0.034 (insig) cor.test(r.bv$ek.2010, r.bv$v.for.trump, method = "pearson") # r = -0.19