#Data Analysis Script for #Is Fair Representation Good for Children? Effects of Electoral Partisan Bias in State #Legislatures on Policies Affecting Children’s Health and Well-Being # PRELIMINARIES ---- #This chunk loads the data file, creates various sub-data frames & variables, & #runs a few home-made functions ## Running the packages ---- library(ggplot2) library(tidyverse) library(scales) library(pastecs) library(plotly) library(showtext) font_files() font_add(family = "Arial", regular = "Arial.ttf") #see C:/Windows/Fonts for more font names showtext_auto() library(gplots) library(GGally) library(plm) library(lmtest) library(lspline) library(gridExtra) library(formattable) library(plotrix) library(readxl) ## Importing the main dataframe ---- ##change the file path for your directory setwd("C:/Users/karat004/Documents/Work stuff/Child Welfare Stuff/Redistricting/Redistricting data/") RedistrictingR_whole_data_set <- read.csv("RedistrictingR.csv", na.strings = c("", "NA", "#REF!")) ## Creating new variables ---- RedistrictingR_whole_data_set$State_factor <- as.factor(RedistrictingR_whole_data_set$State) RedistrictingR_whole_data_set$Vote_seat_percent <- RedistrictingR_whole_data_set$Vote_seat_discrepancy*100 RedistrictingR_whole_data_set$Directional_vote_seat_percent <- RedistrictingR_whole_data_set$Directional_vote_seat_discrepancy*100 RedistrictingR_whole_data_set$Vote_squared<- RedistrictingR_whole_data_set$Vote_seat_percent^2 RedistrictingR_whole_data_set$Efficiency_gap_absolute_100<-RedistrictingR_whole_data_set$Efficiency_gap_absolute*100 RedistrictingR_whole_data_set$Directional_efficiency_gap <- RedistrictingR_whole_data_set$Efficiency_gap*100 RedistrictingR_whole_data_set$Whites_percent <- RedistrictingR_whole_data_set$Whites_proportion*100 RedistrictingR_whole_data_set$Under18_percent <- RedistrictingR_whole_data_set$Under18_proportion*100 RedistrictingR_whole_data_set$Foreign_born_percent <- RedistrictingR_whole_data_set$Foreign_born_proportion*100 RedistrictingR_whole_data_set$Policy_conservatism_cultural_100 <- RedistrictingR_whole_data_set$Policy_conservatism_cultural*100 RedistrictingR_whole_data_set$Policy_conservatism_economic_100 <- RedistrictingR_whole_data_set$Policy_conservatism_economic*100 RedistrictingR_whole_data_set$Unified_control_factor <- as.factor(RedistrictingR_whole_data_set$Unified_control) levels(RedistrictingR_whole_data_set$Unified_control_factor) <- c("Divided control", "D control", "R control") RedistrictingR_whole_data_set$Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy<-RedistrictingR_whole_data_set$Lower_chamber_proportion_by_party_favored_by_vote_seat_discrepancy*100 RedistrictingR_whole_data_set$Lower_chamber_percent_by_party_favored_by_efficiency_gap<-RedistrictingR_whole_data_set$Lower_chamber_proportion_by_party_favored_by_efficiency_gap*100 RedistrictingR_whole_data_set$Proportion_of_votes_for_D_for_lower_chamber_num <- as.numeric (RedistrictingR_whole_data_set$Proportion_of_votes_for_D_for_lower_chamber) #gives an error message indicating that this variable is a "character," maybe because of the FALSEs in pre-1980s?, converted to numeric variable RedistrictingR_whole_data_set$Proportion_of_votes_for_R_for_lower_chamber_num <- as.numeric (RedistrictingR_whole_data_set$Proportion_of_votes_for_R_for_lower_chamber) #ditto RedistrictingR_whole_data_set$Lower_chamber_Democrats_percent<-RedistrictingR_whole_data_set$Lower_chamber_proportion_Democrats*100 RedistrictingR_whole_data_set$Lower_chamber_Democrats_percent <- RedistrictingR_whole_data_set$Lower_chamber_proportion_Democrats*100 RedistrictingR_whole_data_set$Lower_chamber_Ds_compared_to_50_percent_cut <- cut(RedistrictingR_whole_data_set$Lower_chamber_Ds_compared_to_50_percent, breaks=c(-50, 0, 50), labels=c("0% to 50%","50% to 100%")) ## Limiting the dataframe to 1980 to 2019 ---- RedistrictingR_with_metro <- RedistrictingR_whole_data_set %>% filter(!Year == 1974, !Year == 1975, !Year == 1976, !Year == 1977, !Year == 1978, !Year == 1979, !Year == 2020, !Year == 2021, !Year == 2022, !Year == 2023) Metropolitan_data <-subset(RedistrictingR_with_metro, RedistrictingR_with_metro$Year != "NA" & RedistrictingR_with_metro$State != "NA" & RedistrictingR_with_metro$Proportion_metro != "NA" & RedistrictingR_with_metro$Proportion_non_metro != "NA" & RedistrictingR_with_metro$Proportion_metro_unknown != "NA", select=c("Year", "State", "Proportion_metro", "Proportion_non_metro", "Proportion_metro_unknown")) ## Removing metropolitan status data ---- RedistrictingR_with_LA <- subset(RedistrictingR_with_metro, select = -c(Proportion_metro)) ## Removing Louisiana ---- RedistrictingR <- RedistrictingR_with_LA[RedistrictingR_with_LA$State!="LA",] ## Removing NAs from the data frames ---- ## This removes the missing years for Vermont from the main data frame & creates a new data frame for Medicaid only, without the missing early years RedistrictingR_complete<- RedistrictingR %>% filter(State_Year != "VT-1980" & State_Year != "VT-1981" & State_Year != "VT-1982" & State_Year != "VT-1983" & State_Year != "VT-1984" & State_Year != "VT-1985") RedistrictingR_Medicaid_complete <- RedistrictingR_complete %>% filter (Medicaid_inflation_adjusted !="NA" & Medicaid_inflation_adjusted != 0) ## Creating separate dataframes for R trifecta vs. D trifecta vs. divided control ---- RedistrictingR_D_trifecta <- subset(RedistrictingR_complete, Unified_control ==1) RedistrictingR_R_trifecta <- subset(RedistrictingR_complete, Unified_control ==2) RedistrictingR_divided_gov <- subset(RedistrictingR_complete, Unified_control ==0) ## Functions used in exploratory data analyses ---- ### This is a function for generating frequency & proportion data mytable<-function(x, exclude="") { freq<-table(x, exclude="") prop<-round(prop.table(table(x, exclude=""))*100,1) cbind(Freq=freq, Percent=prop) } ### This is a function for calculating proportion of outliers outlierSummary<-function(variable, digits = 2){ zvariable<-(variable-mean(variable, na.rm = TRUE))/sd(variable, na.rm = TRUE) outlier95<-abs(zvariable) >= 1.96 outlier99<-abs(zvariable) >= 2.58 outlier999<-abs(zvariable) >= 3.29 ncases<-length(na.omit(zvariable)) percent95<-round(100*length(subset(outlier95, outlier95 == TRUE))/ncases, digits) percent99<-round(100*length(subset(outlier99, outlier99 == TRUE))/ncases, digits) percent999<-round(100*length(subset(outlier999, outlier999 == TRUE))/ncases, digits) cat("Absolute z-score greater than 1.96 = ", percent95, "%", "\n") cat("Absolute z-score greater than 2.58 = ", percent99, "%", "\n") cat("Absolute z-score greater than 3.29 = ", percent999, "%", "\n") } ### This is a function for doing exploratory data analyses with continuous variables explore_cont<-function(x){ oldpar<-par(no.readonly=TRUE,mfrow=c(2,2),mar=c(2,4,1,2)) hist(x, main="") plot(density(x, na.rm=TRUE), xlim=c(min(x, na.rm=TRUE),max(x,na.rm=TRUE)), type = "l", main="") qqnorm(y=x, main="");qqline(y=x, distribution=qnorm) boxplot(x,main="") print(str(x)) print(round(stat.desc(x,basic=TRUE, norm=TRUE),1)) outlierSummary(x) par(oldpar) } ### This is a function for doing exploratory data analysis with categorical variables explore_categ<-function(x) { print(attributes(x)) print(mytable(x)) cat("\n") cat("Total N = ", length(x)) } ## Checking the main data file ---- ## this is to make sure everything, including variable characteristics, looks in order class(RedistrictingR) dim(RedistrictingR) str(RedistrictingR) names(RedistrictingR) # EXPLORATORY DATA ANALYSES ---- #This section does exploratory data analyses on all the variables ## % Checking missing data in the whole dataframe percent((colMeans(is.na(RedistrictingR[RedistrictingR$Year>1979 & RedistrictingR$Year<2021,])))) ## Predictors ---- ### Absolute value of vote-seat discrepancy ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Vote_seat_percent) #### Descriptive statistics for absolute value in 1980 & 2019 RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Vote_seat_percent, na.rm=TRUE),Median = median(Vote_seat_percent,na.rm =TRUE), Minimum = min(Vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Vote_seat_percent, na.rm=TRUE),Median = median(Vote_seat_percent,na.rm =TRUE), Minimum = min(Vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) #### Absolute value of vote-seat discrepancy, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Vote_seat_percent))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,20),breaks=seq(0, 20, 1))+ labs(x="Year", y="Absolute Value of Vote Seat Discrepancy (%)")+ theme(text = element_text(family = "Arial"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Absolute value of vote-seat discrepancy, broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Vote_seat_percent))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ scale_y_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_hline(yintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Absolute vote-seat discrepancy (%)")+ ggtitle("Absolute Value of Vote-Seat Discrepancy by State and Year")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Absolute vote-seat discrepancy in a single state; change state abbreviation for other states ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Vote_seat_percent))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,100),breaks=seq(0, 100, 10))+ labs(x="Year", y="Absolute Value of Vote-Seat Discrepancy (%)")+ theme(text = element_text(family = "Arial"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Directional vote-seat discrepancy ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Directional_vote_seat_percent) #### Descriptive statistics for directional value in 1980 & 2019 RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Directional_vote_seat_percent, na.rm=TRUE),Median = median(Directional_vote_seat_percent,na.rm =TRUE), Minimum = min(Directional_vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 1999) %>% summarize(Mean =mean(Directional_vote_seat_percent, na.rm=TRUE),Median = median(Directional_vote_seat_percent,na.rm =TRUE), Minimum = min(Directional_vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 2018) %>% summarize(Mean =mean(Directional_vote_seat_percent, na.rm=TRUE),Median = median(Directional_vote_seat_percent,na.rm =TRUE), Minimum = min(Directional_vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Directional_vote_seat_percent, na.rm=TRUE),Median = median(Directional_vote_seat_percent,na.rm =TRUE), Minimum = min(Directional_vote_seat_percent,na.rm =TRUE), Maximum=max(Directional_vote_seat_percent,na.rm =TRUE)) 4.728424+2.666821 # average shift in directional vote-seat discrepancy between 1980 & 2019, for the main measures 2.392867+2.919124 # average shift in directional vote-seat discrepancy between 1999 & 2018, for the composite measure of safety net benefits #### Directional vote-seat discrepancy, averaged across all states ggplot(RedistrictingR_complete, aes(x = Year, y = Directional_vote_seat_percent))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-12,12),breaks=seq(-12, 12, 2))+ geom_hline(yintercept =0) + labs(x="Year", y="Directional Vote-Seat Disrepancy (%)")+ theme(text = element_text(family = "Arial"))+ annotate("segment", x = 1980, xend = 1980, y = 3, yend = 8, colour = "blue", size = 1, arrow = arrow())+ annotate("text", x = 1981, y = 8, label = "Pro-D", color= "blue")+ annotate("segment", x = 1980, xend = 1980, y = -3, yend = -8, colour = "red", size = 1, arrow = arrow())+ annotate("text", x = 1981, y = -8, label = "Pro-R", color= "red")+ theme(axis.text=element_text(color="black",size=15))+ theme(axis.title.x = element_text (color = "black", size = 20,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) #### Directional vote-seat discrepancy, broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Directional_vote_seat_percent))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ scale_y_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_hline(yintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Directional Vote-Seat Discrepancy (%)")+ ggtitle("Directional Vote-Seat Discrepancy by State and Year")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Directional vote-seat discrepancy, showing variability across states (Directional_vote_seat_discrepancy_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Directional_vote_seat_percent, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 2, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-40,40),breaks=seq(-40, 40, 5))+ geom_hline(yintercept =0, linewidth=1.2, color = "red") + labs(x="Year", y="Directional Vote-Seat Discrepancy (%) \n (+ = Pro-Democrat Bias, - = Pro-Republican Bias")+ labs(color = "State")+ theme(text = element_text(family = "Arial"))+ annotate("segment", x = 1981, xend = 1981, y = 24, yend = 34, colour = "blue", size = 1, arrow = arrow())+ annotate("text", x = 1982, y = 22, label = "Pro-D", color= "blue")+ annotate("segment", x = 1981, xend = 1981, y = -24, yend = -34, colour = "red", size = 1, arrow = arrow())+ annotate("text", x = 1982, y = -22, label = "Pro-R", color= "red")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Directional_vote_seat_discrepancy_plot, tooltip = c("State")) #by state ### Absolute value of efficiency gap ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Efficiency_gap_absolute_100) #### Absolute efficiency gap, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Efficiency_gap_absolute_100))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,40),breaks=seq(0, 40, 5))+ #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Absolute efficiency gap X 100")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average ### Directional efficiency gap ---- RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Directional_efficiency_gap, na.rm=TRUE),Median = median(Directional_efficiency_gap,na.rm =TRUE), Minimum = min(Directional_efficiency_gap,na.rm =TRUE), Maximum=max(Directional_efficiency_gap,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 1999) %>% summarize(Mean =mean(Directional_efficiency_gap, na.rm=TRUE),Median = median(Directional_efficiency_gap,na.rm =TRUE), Minimum = min(Directional_efficiency_gap,na.rm =TRUE), Maximum=max(Directional_efficiency_gap,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 2018) %>% summarize(Mean =mean(Directional_efficiency_gap, na.rm=TRUE),Median = median(Directional_efficiency_gap,na.rm =TRUE), Minimum = min(Directional_efficiency_gap,na.rm =TRUE), Maximum=max(Directional_efficiency_gap,na.rm =TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Directional_efficiency_gap, na.rm=TRUE),Median = median(Directional_efficiency_gap,na.rm =TRUE), Minimum = min(Directional_efficiency_gap,na.rm =TRUE), Maximum=max(Directional_efficiency_gap,na.rm =TRUE)) 5.166959+1.540134 # average shift in directional efficiency gap between 1980 & 2019 3.584691+-1.646799 # average shift in directional efficiency gap between 1999 & 2018 #### Directional efficiency gap (before being multiplied by 100), averaged across all states ggplot(RedistrictingR_complete, aes(x = Year, y = Efficiency_gap))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-0.2,0.2),breaks=seq(-0.2,0.2, 0.05))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Directional Efficiency Gap\n (<0 = Pro-Republican Bias, >0 = Pro-Democratic Bias)")+ annotate("segment", x = 1980, xend = 1980, y = 0.05, yend = 0.15, colour = "blue", size = 1, arrow = arrow())+ annotate("text", x = 1983, y = 0.18, label = "Pro-Democratic", color= "blue")+ annotate("segment", x = 1980, xend = 1980, y = -0.05, yend = -0.15, colour = "red", size = 1, arrow = arrow())+ annotate("text", x = 1983, y = -0.18, label = "Pro-Republican", color= "red")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 14,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=14, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) #### Directional efficiency gap (after being multiplied by 100), averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Directional_efficiency_gap))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-40,40),breaks=seq(-40, 40, 5))+ geom_hline(yintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Directional efficiency gap X 100")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Directional efficiency gap, showing variability across states (Efficiency_gap_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Directional_efficiency_gap, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1.5, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-40,40),breaks=seq(-40,40, 5))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Directional Efficiency Gap\n (+ = Pro-Democrat Bias, - = Pro-Republican Bias)")+ geom_hline(yintercept =0, linewidth = 1, color = "red") + labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Efficiency_gap_plot, tooltip = c("State")) #### Directional efficiency gap in a single state; change state abbreviation for other states ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Directional_efficiency_gap))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-40,40, 5),breaks=seq(-40,40, 5))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Efficiency gap\n (<0 = pro-Republican bias, >0 = pro-Democratic bias)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Correlations between the two predictors ---- cor.test(RedistrictingR_complete$Directional_vote_seat_percent, RedistrictingR_complete$Directional_efficiency_gap, method="pearson") ggplotly(ggplot(RedistrictingR_complete, aes(x=Directional_vote_seat_percent, y=Directional_efficiency_gap)) + geom_point()+ geom_text(aes(label=State))+ scale_x_continuous(limits=c(-40,40, 5),breaks=seq(-40,40, 5))+ scale_y_continuous(limits=c(-40,40, 5),breaks=seq(-40,40, 5))+ labs(x="Directional Vote-Seat Discrepancy", y="Directional Efficiency Gap")+ theme(text = element_text(family = "Arial"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ## Policies ---- ### Minimum wage ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Minimum_wage_inflation_adjusted) RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Minimum_wage_inflation_adjusted, na.rm=TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Minimum_wage_inflation_adjusted, na.rm=TRUE)) ((10.18866-9.999021)/10.18866)*100 #change in minimum wage from 1980 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### Minimum wage averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Minimum_wage_inflation_adjusted))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(2,12),breaks=seq(2, 12, by = 1))+ labs(x="Year", y="Inflation-Adjusted Minimum Wage ($)")+ theme(text = element_text(family = "Arial"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Minimum wage, showing variability across states (Minimum_wage_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Minimum_wage_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(1,12),breaks=seq(1, 12, by = 1))+ labs(x="Year", y="Inflation-Adjusted Minimum Wage ($)")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text = element_text(family = "Arial"))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Minimum_wage_plot, tooltip = c("State")) #### Minimum wage in a single state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Minimum_wage_inflation_adjusted)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(1,15),breaks=seq(1, 15, by = 1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Minimum Wage ($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Maximum unemployment benefits ---- ###(Note: MA 1999 & 2020 are both entered correctly) #### Basic descriptive stats explore_cont(RedistrictingR$Unemployment_inflation_adjusted) RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Unemployment_inflation_adjusted, na.rm=TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Unemployment_inflation_adjusted, na.rm=TRUE)) ((13222.73- 13669.27)/13222.73)*100 #change in unemployment benefits from 1980 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### Unemployment benefits averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Unemployment_inflation_adjusted))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(5000,15000),breaks=seq(5000,15000, 500))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Maximum Unemployment Benefits($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Unemployment benefits, showing variability across states (Unemployment_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Unemployment_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(2000,36000),breaks=seq(2000,36000, 2000))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Maximum Unemployment Benefits($)")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Unemployment_plot, tooltip = c("State")) #### Unemployment benefits broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Unemployment_inflation_adjusted))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Maximum Unemployment Benefits ($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Unemployment benefits in a single state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Unemployment_inflation_adjusted)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(2000,36000),breaks=seq(2000,36000, 2000))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Maximum Unemployment Benefits ($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Education expenditures per child ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Education_inflation_adjusted) RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(Education_inflation_adjusted, na.rm=TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Education_inflation_adjusted, na.rm=TRUE)) ((5838.507- 2864.176)/2864.176)*100 #change in education expenditures from 1980 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### Education expenditures per child, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Education_inflation_adjusted))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(1000,5000),breaks=seq(1000, 5000, 500))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Education Expenditure per Child($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Inflation-adjusted education spending per child, showing variability across states (Education_plot<-ggplot(data=RedistrictingR_complete, aes(x=Year, y=Education_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,15000),breaks=seq(0,15000, 1000))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Education Expenditure per Child($)")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Education_plot, tooltip = c("State")) #### Education expenditures per child in a single state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"), aes(x=Year, y=Education_inflation_adjusted)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 4))+ scale_y_continuous(limits=c(0,15000),breaks=seq(0,15000, 1000))+ theme(text = element_text(family = "Arial"))+ labs(title="Inflation-adjusted education spending", x="Year", y="Inflation-Adjusted Education Expenditure per Child($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Monthly AFDC/TANF benefits for 3-person households ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$AFDC_TANF_inflation_adjusted) RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(AFDC_TANF_inflation_adjusted, na.rm=TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(AFDC_TANF_inflation_adjusted, na.rm=TRUE)) ((987.171- 535.6453)/987.171)*100 #change in AFDC/TANF benefits from 1980 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### AFDC/TANF benefits averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = AFDC_TANF_inflation_adjusted))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1800),breaks=seq(0,1800, 100))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted AFDC/TANF benefits for 3-person households($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### AFDC-TANF benefits, showing variability across states (AFDC_TANF_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=AFDC_TANF_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,2000),breaks=seq(0,2000, 100))+ labs(x="Year", y="Inflation-Adjusted AFDC/TANF benefits for 3-person households($)"))+ theme(text = element_text(family = "Arial"))+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(AFDC_TANF_plot, tooltip = c("State")) #by state #### AFDC/TANF benefits, broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = AFDC_TANF_inflation_adjusted))+ stat_summary(fun= "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted AFDC/TANF benefits for 3-person households($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### AFDC/TANF benefits in a single state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=AFDC_TANF_inflation_adjusted))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1100),breaks=seq(0,1100, 100))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted AFDC/TANF benefits for 3-person households($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Monthly AFDC/TANF recipients, per population ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$AFDC_TANF_recipients_percentage) mean(RedistrictingR_complete$AFDC_TANF_recipients_percentage) min(RedistrictingR_complete$AFDC_TANF_recipients_percentage) max(RedistrictingR_complete$AFDC_TANF_recipients_percentage) RedistrictingR_complete %>% filter(Year == 1980) %>% summarize(Mean =mean(AFDC_TANF_recipients_percentage, na.rm=TRUE)) RedistrictingR_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(AFDC_TANF_recipients_percentage, na.rm=TRUE)) ((3.758134- 0.6344002)/3.758134)*100 #change in AFDC/TANF recipients from 1980 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### AFDC/TANF recipients averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = AFDC_TANF_recipients_percentage*100))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Average monthly percentage of the state population \n receiving AFDC/TANF benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### AFDC-TANF recipients, showing variability across states (AFDC_TANF_plot_recipients<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=AFDC_TANF_recipients_percentage*100, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ labs(x="Year", y="Average monthly percentage of the state population \n receiving AFDC/TANF benefits"))+ theme(text = element_text(family = "Arial"))+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(plot.title = element_text(size=12))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(AFDC_TANF_plot_recipients, tooltip = c("State")) #by state #### AFDC/TANF recipients, broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = AFDC_TANF_recipients_percentage*100))+ stat_summary(fun= "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Average monthly percentage of the state population \n receiving AFDC/TANF benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### AFDC/TANF benefits in a single state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=AFDC_TANF_recipients_percentage*100))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Average monthly percentage of the state population \n receiving AFDC/TANF benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Medicaid benefits per capita ---- #### Basic descriptive stats explore_cont(RedistrictingR_Medicaid_complete$Medicaid_inflation_adjusted) RedistrictingR_Medicaid_complete %>% filter(Year == 1983) %>% summarize(Mean =mean(Medicaid_inflation_adjusted, na.rm=TRUE)) RedistrictingR_Medicaid_complete %>% filter(Year == 2019) %>% summarize(Mean =mean(Medicaid_inflation_adjusted, na.rm=TRUE)) ((681.9864- 199.4766)/165.5232)*100 #change in Medicaid benefits from 1983 to 2019 (note that, because of the lags, 2019 corresponds to actual year 2021 in the data set) #### Medicaid benefits averaged across all states ggplotly(ggplot(RedistrictingR_Medicaid_complete, aes(x = Year, y = Medicaid_inflation_adjusted))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,600),breaks=seq(0, 600, 100))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Medicaid Expenditures Per Capita ($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Medicaid benefits, showing variability across states (Medicaid_plot<-ggplot(data=RedistrictingR_Medicaid_complete,aes(x=Year, y=Medicaid_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(100,1700),breaks=seq(100,1700, 100))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Medicaid Expenditures Per Capita ($)")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(text=element_text(color = "black"))+ theme(plot.title = element_text(size=12))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Medicaid_plot, tooltip = c("State")) #### Medicaid benefits in a single state ggplotly(ggplot(data=subset(RedistrictingR_Medicaid_complete, State=="MN"),aes(x=Year, y=Medicaid_inflation_adjusted)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(100,1700),breaks=seq(100,1700, 100))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Medicaid Expenditures Per Capita ($)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Bundle of safety net programs ---- #### Basic descriptive stats explore_cont(RedistrictingR$Ave_cash_food_benefits_inflation_adjusted) #### Bundle of safety net program benefits averaged across all states ggplotly(ggplot(RedistrictingR, aes(x = Year, y = Ave_cash_food_benefits_inflation_adjusted))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1999, 2018),breaks=seq(1999, 2018, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Average Cash and Food Benefits \n from Safety Net Programs")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) #### Bundle of safety net program benefits s, showing variability across states (Safety_net_plot<-ggplot(data=RedistrictingR,aes(x=Year, y=Ave_cash_food_benefits_inflation_adjusted, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1999, 2018),breaks=seq(1999, 2018, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Average Cash and Food Benefits \n from Safety Net Programs")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(text=element_text(color = "black"))+ theme(plot.title = element_text(size=12))+ theme(axis.text=element_text(color="black",size=16))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Safety_net_plot, tooltip = c("State")) #### Bundle of safety net benefits in a single state ggplotly(ggplot(data=subset(RedistrictingR, State=="MN"),aes(x=Year, y=Ave_cash_food_benefits_inflation_adjusted)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1999, 2018),breaks=seq(1999, 2018, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Inflation-Adjusted Average Cash and Food Benefits \n from Safety Net Programs")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Correlations among the outcome variables ---- ggpairs(RedistrictingR_complete [, c("Minimum_wage_inflation_adjusted","Unemployment_inflation_adjusted", "Education_inflation_adjusted", "Medicaid_inflation_adjusted","AFDC_TANF_inflation_adjusted")], lower=list(continuous="smooth")) ##Total state population ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Population_total) #### Total state population, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Population_total))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Total State Population")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Total state population, showing all states (Population_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Population_total, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Total State Population"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Population_plot, tooltip = c("State")) #by state #### Total state population in only one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Population_total))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Total State Population")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ## Covariates ---- ### Percentage under 18 ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Under18_proportion) #### Percentage under 18, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Under18_proportion))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of People Under 18 in the State")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage under 18, showing all states (Age_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Under18_proportion, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0.15,0.4),breaks=seq(0.15, 0.4, 0.05))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of People Under 18 in the State"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Age_plot, tooltip = c("State")) #by state #### Percentage under 18, in only one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Under18_proportion))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0.15,0.4),breaks=seq(0.15, 0.4, 0.05))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of People Under 18 in the State")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Percentage of Whites ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Whites_proportion) #### Percentage of Whites, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Whites_proportion))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Whites in the State")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage of Whites, showing all states (Race_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Whites_proportion, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Whites in the State"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Race_plot, tooltip = c("State")) #by state #### Percentage of Whites in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Whites_proportion))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Whites in the State")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Percentage of foreign-borns ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Foreign_born_proportion) #### Percentage of foreign-borns averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Foreign_born_proportion))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Who Are Foreign-Born")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage of foreign-borns, showing all states (Foreign_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Foreign_born_proportion, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black", linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Who Are Foreign-Born"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Foreign_plot, tooltip = c("State")) #by state #### Percentage of foreign-borns in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Foreign_born_proportion))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Who Are Foreign-Born")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Percentage living in metropolitan & non-metropolitan areas ---- #### Basic descriptive stats explore_cont(RedistrictingR_with_metro$Proportion_metro) explore_cont(RedistrictingR_with_metro$Proportion_non_metro) explore_cont(RedistrictingR_with_metro$Proportion_metro_unknown) #### Percentage living in metropolitan areas, averaged across all states ggplotly(ggplot(RedistrictingR_with_metro, aes(x = Year, y = Proportion_metro))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Metropolitan Areas")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage living in nonmetropolitan areas, averaged across all states ggplotly(ggplot(RedistrictingR_with_metro, aes(x = Year, y = Proportion_non_metro))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Nonmetropolitan Areas")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage whose metropolitan status is unknown, averaged across all states ggplotly(ggplot(RedistrictingR_with_metro, aes(x = Year, y = Proportion_metro_unknown))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Whose Metropolitan Status is Unknown")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage living in metropolitan areas, showing all states (Metro_plot<-ggplot(data=Metropolitan_data,aes(x=Year, y=Proportion_metro, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Metropolitan Areas"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Metro_plot, tooltip = c("State")) #by state #### Percentage living in nonmetropolitan areas, showing all states (Non_metro_plot<-ggplot(data=Metropolitan_data,aes(x=Year, y=Proportion_non_metro, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Nonmetropolitan Areas"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Non_metro_plot, tooltip = c("State")) #by state #### Percentage whose metropolitan status is unknown, showing all states (Unknown_metro_plot<-ggplot(data=Metropolitan_data,aes(x=Year, y=Proportion_metro_unknown, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Whose Metropolitan Status is Unknown"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Unknown_metro_plot, tooltip = c("State")) #by state #### Percentage living in metropolitan areas in one state ggplotly(ggplot(data=subset(Metropolitan_data, State=="WY"),aes(x=Year, y=Proportion_metro))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Metropolitan Areas")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Percentage living in nonmetropolitan areas in one state ggplotly(ggplot(data=subset(Metropolitan_data, State=="WY"),aes(x=Year, y=Proportion_non_metro))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Living in Nonmetropolitan Areas)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Percentage whose metropolitan status is unknown, in one state ggplotly(ggplot(data=subset(Metropolitan_data, State=="WY"),aes(x=Year, y=Proportion_metro_unknown))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",size = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of State's Population Whose Metropolitan Status is Unknown)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### State GDP per capita ---- ###(in millions of inflation-adjusted U.S. dollars) #### Basic descriptive stats explore_cont(RedistrictingR_complete$State_GDP_inflation_adjusted)#basic descriptive stats #### State GDP, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = State_GDP_inflation_adjusted))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="State GDP Per Capita (in Inflation-Adjusted U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### State GDP, showing all states (GDP_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=State_GDP_inflation_adjusted, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="State GDP Per Capita (in Inflation-Adjusted U.S. Dollars)"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(GDP_plot, tooltip = c("State")) #by state #### State GDP, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=State_GDP_inflation_adjusted))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="State GDP Per Capita (in Inflation-Adjusted U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Poverty rate ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Poverty_rate) #### Poverty rate, averaged across all states ggplotly(ggplot(RedistrictingR, aes(x = Year, y = Poverty_rate))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,30),breaks=seq(0, 30, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Poverty Rate (%)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Poverty rate, showing all states (Poverty_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Poverty_rate, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,30),breaks=seq(0, 30, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Poverty Rate (%)"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Poverty_plot, tooltip = c("State")) #by state #### Poverty rate, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Poverty_rate))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,30),breaks=seq(0, 30, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Poverty Rate (%)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Income inequality ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Income_inequality) #### Income inequality, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Income_inequality))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,40),breaks=seq(0, 40, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Income Share Reported by the Top 1%")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Income inequality, showing all states (Inequality_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Income_inequality, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,40),breaks=seq(0, 40, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Income Share Reported by the Top 1%"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Inequality_plot, tooltip = c("State")) #by state #### Income inequality, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Income_inequality))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,40),breaks=seq(0, 40, 2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Income Share Reported by the Top 1%")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Policy conservatism ---- #### Basic descriptive stats explore_cont(RedistrictingR_complete$Policy_conservatism_cultural) explore_cont(RedistrictingR_complete$Policy_conservatism_economic) #### Cultural policy conservatism, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Policy_conservatism_cultural))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Cultural Policy Conservatism (<0 = Liberal, >0 = Conservative")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Economic policy conservatism, averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Policy_conservatism_economic))+stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Economic Policy Conservatism (<0 = Liberal, >0 = Conservative")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Cultural policy conservatism, showing all states (Cultural_policy_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Policy_conservatism_cultural, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Cultural Policy Conservatism (<0 = Liberal, >0 = Conservative"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Cultural_policy_plot, tooltip = c("State")) #by state #### Economic policy conservatism, showing all states (Economic_policy_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Policy_conservatism_economic, color=State)) +geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Economic Policy Conservatism (<0 = Liberal, >0 = Conservative"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) ggplotly(Economic_policy_plot, tooltip = c("State")) #by state #### Cultural policy conservatism, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Policy_conservatism_cultural))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Cultural Policy Conservatism (<0 = Liberal, >0 = Conservative")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Economic policy conservatism, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Policy_conservatism_economic))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(-2,2),breaks=seq(-2, 2, 0.2))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Economic Policy Conservatism (<0 = Liberal, >0 = Conservative")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ### Correlations among covariates ---- #### Correlations among the demographic covariates round(cor(RedistrictingR_complete[ ,c("Whites_percent", "Foreign_born_percent","Under18_percent")],use="complete.obs"),digits=2) #### Correlations among the economic covariates round(cor(RedistrictingR_complete[ ,c("State_GDP_inflation_adjusted", "Poverty_rate","Income_inequality")],use="complete.obs"),digits=2) #### Correlations between the political covariates round(cor(RedistrictingR_complete$Policy_conservatism_cultural, RedistrictingR_complete$Policy_conservatism_economic, use = "complete.obs", method = "pearson"), digits = 2) ggplotly(ggplot(RedistrictingR_complete, aes(x=Policy_conservatism_cultural, y=Policy_conservatism_economic)) + geom_point()+ theme(text = element_text(family = "Arial"))+ labs(x="Cultural Policy Conservatism (<0 = Liberal, >0 = Conservative)", y="Economic Policy Conservatism (<0 = Liberal, >0 = Conservative)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Correlation matrix for all the covariates round(cor(RedistrictingR_complete[ ,c("Whites_percent","Under18_percent","Foreign_born_percent", "State_GDP_inflation_adjusted", "Poverty_rate","Income_inequality","Policy_conservatism_cultural_100","Policy_conservatism_economic_100")],use="complete.obs"),digits=2) (covariates_matrix<-ggpairs(RedistrictingR_complete[, c("Whites_percent","Under18_percent","Foreign_born_percent", "State_GDP_inflation_adjusted", "Poverty_rate","Income_inequality","Policy_conservatism_cultural_100","Policy_conservatism_economic_100")],lower=list(continuous="smooth"))) ## Mediator: Lower chamber seat share ---- #### Dichotomous lower chamber control by party favored by vote-seat discrepancy explore_categ(RedistrictingR_complete$Lower_chamber_control_by_party_favored_by_partisan_bias) RedistrictingR_complete[RedistrictingR_complete$Lower_chamber_control_by_party_favored_by_partisan_bias == 2, 4] #### Percentage of lower chamber seats by party favored by vote-seat discrepancy, #### basic descriptive stats explore_cont(RedistrictingR_complete$Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy) #### Percentage of lower chamber seats by party favored by vote-seat discrepancy, #### averaged across all states ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy))+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,100),breaks=seq(0, 100, 10))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Lower Chamber Seats Held by \n Party Favored by Vote-Seat Discrepancy")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage of lower chamber seats by party favored by vote-seat discrepancy, #### showing all states (Lower_chamber_vote_seat_plot<-ggplot(data=RedistrictingR_complete,aes(x=Year, y=Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy, color=State)) + geom_line()+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,100),breaks=seq(0, 100, 10))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Lower Chamber Seats Held by \n Party Favored by Vote-Seat Discrepancy")+ labs(color = "State")+ theme(legend.title = element_text(size=18))+ theme(legend.text=element_text(size=16))+ theme(text=element_text(color = "black"))+ theme(axis.text=element_text(color="black",size=12,family = "Arial"))+ theme(axis.title.x = element_text (size = 20,vjust=-2))+ theme(axis.title.y = element_text(size =20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Lower_chamber_vote_seat_plot, tooltip = c("State")) #### Percentage of lower chamber seats by party favored by vote-seat discrepancy, #### broken down by state ggplotly(ggplot(RedistrictingR_complete, aes(x = Year, y = Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy))+ stat_summary(fun = "mean", geom = "point",size=0.5,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 10))+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Percentage of Lower Chamber Seats Held by \n Party Favored by Vote-Seat Discrepancy")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))#nationwide average #### Percentage of lower chamber seats by party favored by vote-seat discrepancy, in one state ggplotly(ggplot(data=subset(RedistrictingR_complete, State=="MN"),aes(x=Year, y=Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy))+ geom_line()+ stat_summary(fun = "mean", geom = "point",size=3,color="black", shape=21, fill="black")+ stat_summary(fun="mean", geom = "line", aes(group =1),color = "black",linewidth = 1, linetype = "solid")+ scale_x_continuous(limits=c(1980,2019),breaks=seq(1980, 2019, 2))+ scale_y_continuous(limits=c(0,100),breaks=seq(0, 100, 10))+ theme(text = element_text(family = "Arial"))+ labs(x="Year", y="Proportion of Lower Chamber Seats Held by \n Party favored by Vote-Seat Discrepancy")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Correlation between percentage of lower chamber seats by party favored by vote-seat discrepancy #### and vote-seat discrepancy ggplot(RedistrictingR_complete, aes(x=Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy, y=Vote_seat_percent)) + geom_jitter(color="black", size=1, alpha=0.9) + geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Percentage of Lower Chamber Seats Held by \n Party Favored by Vote-Seat Discrepancy", y="Vote-Seat Discrepancy (%)")+ theme(axis.text=element_text(color="black",size=14))+ theme(axis.title.x = element_text (color = "black", size = 20,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) #### Descriptive stats for the cut variable for testing mediational effects explore_categ(RedistrictingR_complete$Lower_chamber_Ds_compared_to_50_percent_cut) #### Distribution of directional vote-seat bias scores as a function of Democrats’ seat share in lower chambers ggplot(RedistrictingR_complete, aes(x=Lower_chamber_Ds_compared_to_50_percent_cut, y=Directional_vote_seat_percent)) + geom_boxplot()+ geom_jitter(color="black", size=1, alpha=0.9) + geom_hline(yintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Percentage of Democrats in the Lower Chamber", y="Directional Vote-Seat Discrepancy (+ = Pro-Democrat, - = Pro-Republican")+ theme(axis.text=element_text(color="black",size=14))+ theme(axis.title.x = element_text (color = "black", size = 20,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=20, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) #### Correlations between the two predictors vs. lower chamber seat share cor.test (RedistrictingR_complete$Vote_seat_percent,RedistrictingR_complete$Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy, method = "pearson") cor.test (RedistrictingR_complete$Efficiency_gap_absolute,RedistrictingR_complete$Lower_chamber_percent_by_party_favored_by_efficiency_gap, method = "pearson") #### Lower chamber seat share vs. vote-seat discrepancy ggplotly(ggplot(RedistrictingR_complete, aes(x=Vote_seat_percent, y=Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy, label = State)) + geom_point()+ geom_text(hjust=0, vjust=0)+ theme(text = element_text(family = "Arial"))+ labs(x="Vote-seat discrepancy (%)", y="Percentage of Lower Chamber Seats Held by \n Party Favored by Vote-Seat Discrepancy")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line #### Lower chamber seat share vs. efficiency gap ggplotly(ggplot(RedistrictingR_complete, aes(x=Efficiency_gap_absolute, y=Lower_chamber_percent_by_party_favored_by_efficiency_gap, label = State)) + geom_point()+ geom_text(hjust=0, vjust=0)+ theme(text = element_text(family = "Arial"))+ labs(x="Absolute Value of the Efficiency gap", y="Percentage of Lower Chamber Seats Held by \n Party Favored by Efficiency Gap")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")))# plots for examining individual states; just change the state abbreviation in the first line ## Modifier: Extent of Government Control ---- ### Basic descriptive stats on party affiliation of the governor explore_categ(RedistrictingR_complete$Governor_party) ### Basic descriptive stats on unified control explore_categ(RedistrictingR_complete$Unified_control) (485+465)/1914 ### Basic descriptive stats on minority_rule by either party explore_categ(RedistrictingR_complete$Minority_D_rule_lower_chamber) explore_categ(RedistrictingR_complete$Minority_R_rule_upper_chamber) ### Basic descriptive stats on the effect modifier variable explore_categ(RedistrictingR_complete$Effect_modifier_0_4) explore_categ(RedistrictingR_complete$Effect_modifier) # AIM 1 ---- #State- and year- fixed effects models, with covariates #For all of these analyses, I ran the analyses first w/the quadratic term for vote-seat percent (Vote_seat_percent^2) #in addition to the linear term for vote-seat percent & dropped it if it wasn't significant w/the robust SEs. #The quadratic term was not significant for any of the analyses; so I used the linear term in the equation for all analyses ## Vote-seat discrepancy as the predictor ---- ### Running the full model summary(AFDC_TANF_vote_fe_twoways_covariates_mod <- plm(AFDC_TANF_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) #### coefficients & their significance, without the robust SEs coefficients(summary(AFDC_TANF_vote_fe_twoways_covariates_mod)) #### coefficients w/robust SEs coeftest(AFDC_TANF_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") #### 95% confidence intervals coefci(AFDC_TANF_vote_fe_twoways_covariates_mod, vcov. = vcovHC(AFDC_TANF_vote_fe_twoways_covariates_mod, type = 'HC1')) ### Getting to know the model class(AFDC_TANF_vote_fe_twoways_covariates_mod) nobs(AFDC_TANF_vote_fe_twoways_covariates_mod) # of observations pdim(AFDC_TANF_vote_fe_twoways_covariates_mod) #dimensions of the panel head(index(AFDC_TANF_vote_fe_twoways_covariates_mod)) #state & year in the data set, starting w/AK, 1980-2016 index(AFDC_TANF_vote_fe_twoways_covariates_mod,"State_factor") #only state index(AFDC_TANF_vote_fe_twoways_covariates_mod,"Year") #only year AFDC_TANF_vote_fe_twoways_covariates_mod$call # main formula, the call AFDC_TANF_vote_fe_twoways_covariates_mod$formula #an object of class "Formula" describing the model head(AFDC_TANF_vote_fe_twoways_covariates_mod$model,10) #actual predictors & outcomes used in the model, #starting w/AK, the model frame is a "pdata.frame" containing the variables used for estimation: the response is in first column followed by the other variables; #the individual and time indexes are in the 'index' attribute of model is.pconsecutive(AFDC_TANF_vote_fe_twoways_covariates_mod) #checks for each individual if its associated time periods are consecutive (no "gaps" in time dimension per individual) is.pbalanced(AFDC_TANF_vote_fe_twoways_covariates_mod)# checks if the data are balanced, i.e., if each individual has the same time periods ### Extracting the state & year fixed effects summary(fixef(AFDC_TANF_vote_fe_twoways_covariates_mod)) #state fixed effects; #each state fixed effect is the estimated AFDC value for that state when the year is at its lowest (1980) and when vote seat percent is 0 summary(fixef(AFDC_TANF_vote_fe_twoways_covariates_mod,effect="time")) #Year fixed effects = adjusting for trends over time & controlling for secular trends #year FEs are specific to AK; each year fixed effect is the value for the state at the reference/lowest value (AK) when vote seat percent is 0. ### Extracting r-squared, intercept, coefficients, residuals, etc. r.squared(AFDC_TANF_vote_fe_twoways_covariates_mod,dfcor=T) #adjusted R-squared within_intercept(AFDC_TANF_vote_fe_twoways_covariates_mod) #overall intercept of the fixed effect model along with its standard error AFDC_TANF_vote_fe_twoways_covariates_mod$coefficients #the vector of coefficients print(AFDC_TANF_vote_fe_twoways_covariates_mod)# print summary for coefficients AFDC_TANF_vote_fe_twoways_covariates_mod$vcov #the variance-covariance matrix of the coefficients head(AFDC_TANF_vote_fe_twoways_covariates_mod$residuals, 10) #vector of residuals, starting w/AK residuals_AFDC_TANF_vote_fe_twoways_covariates_mod<-AFDC_TANF_vote_fe_twoways_covariates_mod$residuals hist(AFDC_TANF_vote_fe_twoways_covariates_mod$residuals) ### Trying out different ways of extracting fitted values, as data frame & as vector AFDC_TANF_vote_fe_twoways_covariates_mod_fitted <- data.frame(AFDC_TANF_vote_fe_twoways_covariates_mod$model[[1]] - AFDC_TANF_vote_fe_twoways_covariates_mod$residuals) head(AFDC_TANF_vote_fe_twoways_covariates_mod_fitted) class(AFDC_TANF_vote_fe_twoways_covariates_mod_fitted) dim(AFDC_TANF_vote_fe_twoways_covariates_mod_fitted) str(AFDC_TANF_vote_fe_twoways_covariates_mod_fitted) fitted_AFDC_TANF_vote_fe_twoways_covariates_mod <- as.numeric(AFDC_TANF_vote_fe_twoways_covariates_mod$model[[1]] - AFDC_TANF_vote_fe_twoways_covariates_mod$residuals) class(fitted_AFDC_TANF_vote_fe_twoways_covariates_mod) str(fitted_AFDC_TANF_vote_fe_twoways_covariates_mod) head(fitted_AFDC_TANF_vote_fe_twoways_covariates_mod) is.vector(fitted_AFDC_TANF_vote_fe_twoways_covariates_mod) hist(fitted_AFDC_TANF_vote_fe_twoways_covariates_mod) ### Creating a pdata.frame, sorted first by the state index & then the time index pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) class(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates) head(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates) index(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates) #to extract the index variables; starts w/AK index(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates, "State_factor") index(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates, "Year") ### adding the fitted values & residuals to the pdata.frame pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates$fitted_AFDC_TANF_vote_fe_twoways_covariates_mod<-fitted_AFDC_TANF_vote_fe_twoways_covariates_mod pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates$residuals_AFDC_TANF_vote_fe_twoways_covariates_mod<-residuals_AFDC_TANF_vote_fe_twoways_covariates_mod head(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates) ### Converting the pdataframe to a regular data frame that includes the fitted values & residuals from this analysis ### change the path as necessary write.csv(pRedistrictingR_AFDC_TANF_vote_fe_twoways_covariates,"Aim1a_AFDC_TANF_vote.csv") Aim1a_AFDC_TANF_vote<-read.csv(file="Aim1a_AFDC_TANF_vote.csv") ### Same analysis w/other outcomes & vote-seat discrepancy summary(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod <- plm(AFDC_TANF_recipients_percentage ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod, vcov. = vcovHC(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod, type = 'HC1')) round(2.687276e-02,2) fitted_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod <- as.numeric(AFDC_TANF_recipients_vote_fe_twoways_covariates_mod$model[[1]] - AFDC_TANF_recipients_vote_fe_twoways_covariates_mod$residuals) residuals_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod<-AFDC_TANF_recipients_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod$fitted_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod<-fitted_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod pRedistrictingR_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod$residuals_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod<-residuals_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod,"Aim1a_AFDC_TANF_recipients_vote.csv") Aim1a_AFDC_TANF_recipients_vote<-read.csv(file="Aim1a_AFDC_TANF_recipients_vote.csv") summary(Minimum_wage_vote_fe_twoways_covariates_mod <- plm(Minimum_wage_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_vote_fe_twoways_covariates_mod, vcov. = vcovHC(Minimum_wage_vote_fe_twoways_covariates_mod, type = 'HC1')) fitted_minimum_wage_vote_fe_twoways_covariates_mod <- as.numeric(Minimum_wage_vote_fe_twoways_covariates_mod$model[[1]] - Minimum_wage_vote_fe_twoways_covariates_mod$residuals) residuals_minimum_wage_vote_fe_twoways_covariates_mod<-Minimum_wage_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_minimum_wage_vote_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_minimum_wage_vote_fe_twoways_covariates_mod$fitted_minimum_wage_vote_fe_twoways_covariates_mod<-fitted_minimum_wage_vote_fe_twoways_covariates_mod pRedistrictingR_minimum_wage_vote_fe_twoways_covariates_mod$residuals_minimum_wage_vote_fe_twoways_covariates_mod<-residuals_minimum_wage_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_minimum_wage_vote_fe_twoways_covariates_mod,"Aim1a_minimum_wage_vote.csv") Aim1a_minimum_wage_vote<-read.csv(file="Aim1a_minimum_wage_vote.csv") summary(Unemployment_vote_fe_twoways_covariates_mod <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_fe_twoways_covariates_mod, vcov. = vcovHC(Unemployment_vote_fe_twoways_covariates_mod, type = 'HC1')) fitted_unemployment_vote_fe_twoways_covariates_mod <- as.numeric(Unemployment_vote_fe_twoways_covariates_mod$model[[1]] - Unemployment_vote_fe_twoways_covariates_mod$residuals) residuals_unemployment_vote_fe_twoways_covariates_mod<-Unemployment_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_unemployment_vote_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_unemployment_vote_fe_twoways_covariates_mod$fitted_unemployment_vote_fe_twoways_covariates_mod<-fitted_unemployment_vote_fe_twoways_covariates_mod pRedistrictingR_unemployment_vote_fe_twoways_covariates_mod$residuals_unemployment_vote_fe_twoways_covariates_mod<-residuals_unemployment_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_unemployment_vote_fe_twoways_covariates_mod,"Aim1a_unemployment_vote.csv") Aim1a_unemployment_vote<-read.csv(file="Aim1a_unemployment_vote.csv") ### Unemployment benefit results don't change with the outlier, MA, excluded summary(Unemployment_vote_fe_twoways_covariates_no_MA <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete,State!="MA"), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_fe_twoways_covariates_no_MA))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_fe_twoways_covariates_no_MA, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs summary(Education_vote_fe_twoways_covariates_mod <- plm(Education_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Education_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_vote_fe_twoways_covariates_mod, vcov. = vcovHC(Education_vote_fe_twoways_covariates_mod, type = 'HC1')) fitted_education_vote_fe_twoways_covariates_mod <- as.numeric(Education_vote_fe_twoways_covariates_mod$model[[1]] - Education_vote_fe_twoways_covariates_mod$residuals) residuals_education_vote_fe_twoways_covariates_mod<-Education_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_education_vote_fe_twoways_covariates_mod <- pdata.frame(subset(RedistrictingR_complete),index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_education_vote_fe_twoways_covariates_mod$fitted_education_vote_fe_twoways_covariates_mod<-fitted_education_vote_fe_twoways_covariates_mod pRedistrictingR_education_vote_fe_twoways_covariates_mod$residuals_education_vote_fe_twoways_covariates_mod<-residuals_education_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_education_vote_fe_twoways_covariates_mod,"Aim1a_education_vote.csv") Aim1a_education_vote<-read.csv(file="Aim1a_education_vote.csv") ###(note the different dataframe for Medicaid) summary(Medicaid_vote_fe_twoways_covariates_mod <- plm(Medicaid_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_Medicaid_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_vote_fe_twoways_covariates_mod, vcov. = vcovHC(Medicaid_vote_fe_twoways_covariates_mod, type = 'HC1')) fitted_Medicaid_vote_fe_twoways_covariates_mod <- as.numeric(Medicaid_vote_fe_twoways_covariates_mod$model[[1]] - Medicaid_vote_fe_twoways_covariates_mod$residuals) residuals_Medicaid_vote_fe_twoways_covariates_mod<-Medicaid_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_Medicaid_vote_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_Medicaid_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_Medicaid_vote_fe_twoways_covariates_mod$fitted_Medicaid_vote_fe_twoways_covariates_mod<-fitted_Medicaid_vote_fe_twoways_covariates_mod pRedistrictingR_Medicaid_vote_fe_twoways_covariates_mod$residuals_Medicaid_vote_fe_twoways_covariates_mod<-residuals_Medicaid_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_Medicaid_vote_fe_twoways_covariates_mod,"Aim1a_Medicaid_vote.csv") Aim1a_Medicaid_vote<-read.csv(file="Aim1a_Medicaid_vote.csv") ### Note that this analysis & the resulting dataframes are restricted to 1999-2018 because of data availability summary(Ave_cash_food_vote_fe_twoways_covariates_mod <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Year > 1998 & Year <2019), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Ave_cash_food_vote_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Ave_cash_food_vote_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Ave_cash_food_vote_fe_twoways_covariates_mod, vcov. = vcovHC(Ave_cash_food_vote_fe_twoways_covariates_mod, type = 'HC1')) fitted_ave_cash_food_vote_fe_twoways_covariates_mod <- as.numeric(Ave_cash_food_vote_fe_twoways_covariates_mod$model[[1]] - Ave_cash_food_vote_fe_twoways_covariates_mod$residuals) residuals_ave_cash_food_vote_fe_twoways_covariates_mod<-Ave_cash_food_vote_fe_twoways_covariates_mod$residuals pRedistrictingR_ave_cash_food_vote_fe_twoways_covariates_mod <- pdata.frame(subset(RedistrictingR_complete, Year > 1998 & Year<2019),index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_ave_cash_food_vote_fe_twoways_covariates_mod$fitted_ave_cash_food_vote_fe_twoways_covariates_mod<-fitted_ave_cash_food_vote_fe_twoways_covariates_mod pRedistrictingR_education_vote_fe_twoways_covariates_mod$residuals_education_vote_fe_twoways_covariates_mod<-residuals_education_vote_fe_twoways_covariates_mod write.csv(pRedistrictingR_ave_cash_food_vote_fe_twoways_covariates_mod,"Aim1a_safety_net_vote.csv") Aim1a_safety_net_vote<-read.csv(file="Aim1a_safety_net_vote.csv") ## Efficiency gap as the predictor ---- ## Same analyses & steps as above summary(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod <- plm(AFDC_TANF_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod)) coeftest(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod<-AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod$fitted_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod<-fitted_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod$residuals_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod<-residuals_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_AFDC_TANF_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_AFDC_TANF_efficiency_gap.csv") Aim1a_AFDC_TANF_efficiency_gap<-read.csv(file="Aim1a_AFDC_TANF_efficiency_gap.csv") summary(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod <- plm(AFDC_TANF_recipients_percentage ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod)) coeftest(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) round(3.507173e-02,3) fitted_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod<-AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod$fitted_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod<-fitted_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod$residuals_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod<-residuals_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_AFDC_TANF_recipients_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_AFDC_TANF_recipients_efficiency_gap.csv") Aim1a_AFDC_TANF_recipients_efficiency_gap<-read.csv(file="Aim1a_AFDC_TANF_recipients_efficiency_gap.csv") summary(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod <- plm(Minimum_wage_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod)) coeftest(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_minimum_wage_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(Minimum_wage_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - Minimum_wage_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_minimum_wage_efficiency_gap_fe_twoways_covariates_mod<-Minimum_wage_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_Minimum_wage_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_Minimum_wage_efficiency_gap_fe_twoways_covariates_mod$fitted_minimum_wage_efficiency_gap_fe_twoways_covariates_mod<-fitted_minimum_wage_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_Minimum_wage_efficiency_gap_fe_twoways_covariates_mod$residuals_minimum_wage_efficiency_gap_fe_twoways_covariates_mod<-residuals_minimum_wage_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_Minimum_wage_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_AFDC_TANF_efficiency_gap.csv") Aim1a_AFDC_TANF_efficiency_gap<-read.csv(file="Aim1a_AFDC_TANF_efficiency_gap.csv") summary(Unemployment_efficiency_gap_fe_twoways_covariates_mod <- plm(Unemployment_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_efficiency_gap_fe_twoways_covariates_mod)) coeftest(Unemployment_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(Unemployment_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(Unemployment_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_unemployment_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(Unemployment_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - Unemployment_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_unemployment_efficiency_gap_fe_twoways_covariates_mod<-Unemployment_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_unemployment_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_unemployment_efficiency_gap_fe_twoways_covariates_mod$fitted_unemployment_efficiency_gap_fe_twoways_covariates_mod<-fitted_unemployment_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_unemployment_efficiency_gap_fe_twoways_covariates_mod$residuals_unemployment_efficiency_gap_fe_twoways_covariates_mod<-residuals_unemployment_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_unemployment_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_unemployment_efficiency_gap.csv") Aim1a_unemployment_efficiency_gap<-read.csv(file="Aim1a_unemployment_efficiency_gap.csv") summary(Education_efficiency_gap_fe_twoways_covariates_mod <- plm(Education_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_efficiency_gap_fe_twoways_covariates_mod)) coeftest(Education_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(Education_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(Education_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_education_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(Education_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - Education_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_education_efficiency_gap_fe_twoways_covariates_mod<-Education_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_education_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_education_efficiency_gap_fe_twoways_covariates_mod$fitted_education_efficiency_gap_fe_twoways_covariates_mod<-fitted_education_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_education_efficiency_gap_fe_twoways_covariates_mod$residuals_education_efficiency_gap_fe_twoways_covariates_mod<-residuals_education_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_education_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_education_efficiency_gap.csv") Aim1a_education_efficiency_gap<-read.csv(file="Aim1a_education_efficiency_gap.csv") ###(note the different dataframe for Medicaid) summary(Medicaid_efficiency_gap_fe_twoways_covariates_mod <- plm(Medicaid_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_Medicaid_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_efficiency_gap_fe_twoways_covariates_mod)) coeftest(Medicaid_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1") coefci(Medicaid_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(Medicaid_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_Medicaid_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(Medicaid_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - Medicaid_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_Medicaid_efficiency_gap_fe_twoways_covariates_mod<-Medicaid_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_Medicaid_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(RedistrictingR_Medicaid_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_Medicaid_efficiency_gap_fe_twoways_covariates_mod$fitted_Medicaid_efficiency_gap_fe_twoways_covariates_mod<-fitted_Medicaid_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_Medicaid_efficiency_gap_fe_twoways_covariates_mod$residuals_Medicaid_efficiency_gap_fe_twoways_covariates_mod<-residuals_Medicaid_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_Medicaid_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_Medicaid_efficiency_gap.csv") Aim1a_Medicaid_efficiency_gap<-read.csv(file="Aim1a_Medicaid_efficiency_gap.csv") ### Note that this analysis & the resulting dataframes are restricted to 1999-2018 because of data availability summary(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Year > 1998 & Year <2019), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod))# coefficients & their significance w/o the robust SEs coeftest(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod, vcov. = vcovHC(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod, type = 'HC1')) fitted_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod <- as.numeric(Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod$model[[1]] - Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod$residuals) residuals_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod<-Ave_cash_food_efficiency_gap_fe_twoways_covariates_mod$residuals pRedistrictingR_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod <- pdata.frame(subset(RedistrictingR_complete, Year > 1998 & Year<2019),index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod$fitted_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod<-fitted_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod pRedistrictingR_education_efficiency_gap_fe_twoways_covariates_mod$residuals_education_efficiency_gap_fe_twoways_covariates_mod<-residuals_education_efficiency_gap_fe_twoways_covariates_mod write.csv(pRedistrictingR_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod,"Aim1a_safety_net_efficiency_gap.csv") Aim1a_safety_net_efficiency_gap<-read.csv(file="Aim1a_safety_net_efficiency_gap.csv") ## Tile plots of fitted values for Aim 1 ---- ## These plot the fitted values of each outcome against vote-seat discrepancy within each state ggplotly(ggplot(data=Aim1a_AFDC_TANF_vote, aes(x=Vote_seat_percent, y=fitted_AFDC_TANF_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. AFDC-TANF", x="Vote-Seat Discrepancy", y="Fitted Values of Inflation-Adjusted \n AFDC/TANF Benefits (in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_AFDC_TANF_recipients_vote, aes(x=Vote_seat_percent, y=fitted_AFDC_TANF_recipients_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. AFDC-TANF recipients", x="Vote-Seat Discrepancy", y="Fitted Values of AFDC/TANF Recipients")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_unemployment_vote, aes(x=Vote_seat_percent, y=fitted_unemployment_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. Unemployment Benefits", x="Vote-Seat Discrepancy", y="Fitted values of Inflation-Adjusted \n Unemployment Benefits (in 2016 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_minimum_wage_vote, aes(x=Vote_seat_percent, y=fitted_minimum_wage_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. Minimum Wage", x="Vote-Seat Discrepancy", y="Fitted values of Inflation-Adjusted \n Minimum Wage(in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_education_vote, aes(x=Vote_seat_percent, y=fitted_education_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. Education Spending per Child", x="Vote-Seat Discrepancy", y="Fitted values Inflation-Adjusted of \n Education Spending (in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_Medicaid_vote, aes(x=Vote_seat_percent, y=fitted_Medicaid_vote_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. Medicaid Benefits", x="Vote-Seat Discrepancy", y="Fitted values of Inflation-Adjusted \n Medicaid Benefits (in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(ggplot(data=Aim1a_safety_net_vote, aes(x=Vote_seat_percent, y=fitted_ave_cash_food_efficiency_gap_fe_twoways_covariates_mod)) + geom_point()+ scale_x_continuous(limits=c(0,40),breaks=seq(0, 40, 10))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Vote-seat discrepancy vs. Bundle of Safety Net Benefits", x="Vote-Seat Discrepancy", y="Fitted Values of Inflation-Adjusted \n Bundle of Safety Net Benefits (in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ## Interactions between vote-seat discrepancy & level of control by the party favored by the bias ---- summary(AFDC_TANF_vote_seat_share_controlled_effect_interaction <- plm(AFDC_TANF_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(AFDC_TANF_vote_seat_share_controlled_effect_interaction, type = 'HC1')) summary(AFDC_TANF_recipients_vote_seat_share_controlled_effect_interaction <- plm(AFDC_TANF_recipients_percentage ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(AFDC_TANF_recipients_vote_seat_share_controlled_effect_interaction, type = 'HC1')) summary(Unemployment_vote_seat_share_controlled_effect_interaction <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(Unemployment_vote_seat_share_controlled_effect_interaction, type = 'HC1')) fitted_unemployment_vote_seat_share_controlled_effect_interaction <- as.numeric(Unemployment_vote_seat_share_controlled_effect_interaction$model[[1]] - Unemployment_vote_seat_share_controlled_effect_interaction$residuals) residuals_unemployment_vote_seat_share_controlled_effect_interaction<-Unemployment_vote_seat_share_controlled_effect_interaction$residuals pRedistrictingR_unemployment_vote_seat_share_controlled_effect_interaction <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_unemployment_vote_seat_share_controlled_effect_interaction$fitted_unemployment_vote_seat_share_controlled_effect_interaction<-fitted_unemployment_vote_seat_share_controlled_effect_interaction pRedistrictingR_unemployment_vote_seat_share_controlled_effect_interaction$residuals_unemployment_vote_seat_share_controlled_effect_interaction<-residuals_unemployment_vote_seat_share_controlled_effect_interaction write.csv(pRedistrictingR_unemployment_vote_seat_share_controlled_effect_interaction,"Unemployment_vote_seat_share_controlled_effect_interaction.csv") Graph_unemployment_vote_seat_share_controlled_effect_interaction<-read.csv(file="Unemployment_vote_seat_share_controlled_effect_interaction.csv") ggplot(Graph_unemployment_vote_seat_share_controlled_effect_interaction, aes(x=Vote_seat_percent, y=fitted_unemployment_vote_seat_share_controlled_effect_interaction)) + geom_point()+ geom_smooth(method = "lm",formula = y ~x, size=1.5, linetype="solid", se=TRUE, aes(color=Lower_chamber_Ds_compared_to_50_percent_cut)) + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote-seat percent", y="Fitted values of inflation-adjusted unemployment benefits")+ guides(color = guide_legend(title = "% Ds in lower chamber"))+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))# plots for examining individual states; just change the state abbreviation in the first line #follow-up on the interaction for unemployment summary(Unemployment_vote_seat_share_controlled_effect_interaction_stratified <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete,Lower_chamber_Ds_compared_to_50_percent_cut=="0% to 50%"), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_seat_share_controlled_effect_interaction_stratified))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, vcov. = vcovHC(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, type = 'HC1')) summary(Unemployment_vote_seat_share_controlled_effect_interaction_stratified <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete,Lower_chamber_Ds_compared_to_50_percent_cut=="50% to 100%"), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_seat_share_controlled_effect_interaction_stratified))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, vcov. = vcovHC(Unemployment_vote_seat_share_controlled_effect_interaction_stratified, type = 'HC1')) summary(Minimum_wage_vote_seat_share_controlled_effect_interaction <- plm(Minimum_wage_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(Minimum_wage_vote_seat_share_controlled_effect_interaction, type = 'HC1')) summary(Education_vote_seat_share_controlled_effect_interaction <- plm(Education_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(Education_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(Education_vote_seat_share_controlled_effect_interaction, type = 'HC1')) summary(Medicaid_vote_seat_share_controlled_effect_interaction <- plm(Medicaid_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(Medicaid_vote_seat_share_controlled_effect_interaction, type = 'HC1')) ### Note that this is limited to 1999-2018 summary(Safety_net_vote_seat_share_controlled_effect_interaction <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Vote_seat_percent + Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Vote_seat_percent*Lower_chamber_percent_by_party_favored_by_vote_seat_discrepancy+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Year >1998 & Year < 2019), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_vote_seat_share_controlled_effect_interaction))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_vote_seat_share_controlled_effect_interaction, vcov. = vcovHC(Safety_net_vote_seat_share_controlled_effect_interaction, type = 'HC1')) ## Aim 1 under trifecta vs. divided government ---- ### For the subset of state-years in which there was a trifecta, ### did the directional value of the vote-seat discrepancy for the party in control of the trifecta matter? ### These are the same analyses as for Aim 1, but with the dataframe restricted to trifecta years explore_categ(RedistrictingR_complete$Unified_control) (485+465)/1914 #proportion of state-years in which there was a trifecta by either party #### Vote-seat discrepancy ---- summary(AFDC_TANF_vote_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_vote_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_vote_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_vote_trifecta, vcov. = vcovHC(AFDC_TANF_vote_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_vote_trifecta <- plm(AFDC_TANF_recipients_percentage ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_vote_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_vote_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_vote_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_vote_trifecta, type = 'HC1')) round(2.744362e-02,2) summary(Minimum_wage_vote_trifecta <- plm(Minimum_wage_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_vote_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_vote_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_vote_trifecta, vcov. = vcovHC(Minimum_wage_vote_trifecta, type = 'HC1')) summary(Unemployment_vote_trifecta <- plm(Unemployment_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_trifecta, vcov. = vcovHC(Unemployment_vote_trifecta, type = 'HC1')) summary(Education_vote_trifecta <- plm(Education_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_vote_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Education_vote_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_vote_trifecta, vcov. = vcovHC(Education_vote_trifecta, type = 'HC1')) summary(Medicaid_vote_trifecta <- plm(Medicaid_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_vote_trifecta)) coeftest(Medicaid_vote_trifecta, vcov. = vcovHC, type = "HC1") coefci(Medicaid_vote_trifecta, vcov. = vcovHC(Medicaid_vote_trifecta, type = 'HC1')) summary(Safety_net_vote_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Vote_seat_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_vote_trifecta)) coeftest(Safety_net_vote_trifecta, vcov. = vcovHC, type = "HC1") coefci(Safety_net_vote_trifecta, vcov. = vcovHC(Safety_net_vote_trifecta, type = 'HC1')) #### Efficiency gap ---- summary(AFDC_TANF_efficiency_gap_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_efficiency_gap_trifecta)) coeftest(AFDC_TANF_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_efficiency_gap_trifecta, vcov. = vcovHC(AFDC_TANF_efficiency_gap_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_efficiency_gap_trifecta <- plm(AFDC_TANF_recipients_percentage ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_efficiency_gap_trifecta)) coeftest(AFDC_TANF_recipients_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_recipients_efficiency_gap_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_efficiency_gap_trifecta, type = 'HC1')) round(1.417174e-02,2) summary(Minimum_wage_efficiency_gap_trifecta <- plm(Minimum_wage_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_efficiency_gap_trifecta)) coeftest(Minimum_wage_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(Minimum_wage_efficiency_gap_trifecta, vcov. = vcovHC(Minimum_wage_efficiency_gap_trifecta, type = 'HC1')) summary(Unemployment_efficiency_gap_trifecta <- plm(Unemployment_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_efficiency_gap_trifecta)) coeftest(Unemployment_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(Unemployment_efficiency_gap_trifecta, vcov. = vcovHC(Unemployment_efficiency_gap_trifecta, type = 'HC1')) summary(Education_efficiency_gap_trifecta <- plm(Education_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_efficiency_gap_trifecta)) coeftest(Education_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(Education_efficiency_gap_trifecta, vcov. = vcovHC(Education_efficiency_gap_trifecta, type = 'HC1')) summary(Medicaid_efficiency_gap_trifecta <- plm(Medicaid_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_efficiency_gap_trifecta)) coeftest(Medicaid_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(Medicaid_efficiency_gap_trifecta, vcov. = vcovHC(Medicaid_efficiency_gap_trifecta, type = 'HC1')) summary(Safety_net_efficiency_gap_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Efficiency_gap_for_trifecta_party + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==1|Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_efficiency_gap_trifecta)) coeftest(Safety_net_efficiency_gap_trifecta, vcov. = vcovHC, type = "HC1") coefci(Safety_net_efficiency_gap_trifecta, vcov. = vcovHC(Safety_net_efficiency_gap_trifecta, type = 'HC1')) ### Divided government analyses for Aim 1 ### For the subset of state-years in which there was divided government, ### did the directional value of the vote-seat discrepancy for the party in control of the trifecta matter? ### These are the same analyses as for Aim 1, but with the dataframe restricted to divided government years #### Vote-seat discrepancy ---- summary(AFDC_TANF_vote_divided <- plm(AFDC_TANF_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_vote_divided, vcov. = vcovHC(AFDC_TANF_vote_divided, type = 'HC1')) summary(AFDC_TANF_recipients_vote_divided <- plm(AFDC_TANF_recipients_percentage ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_vote_divided, vcov. = vcovHC(AFDC_TANF_recipients_vote_divided, type = 'HC1')) round(3.045287e-02, 2) summary(Minimum_wage_vote_divided <- plm(Minimum_wage_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_vote_divided, vcov. = vcovHC(Minimum_wage_vote_divided, type = 'HC1')) summary(Unemployment_vote_divided <- plm(Unemployment_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_vote_divided, vcov. = vcovHC(Unemployment_vote_divided, type = 'HC1')) summary(Education_vote_divided <- plm(Education_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(Education_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_vote_divided, vcov. = vcovHC(Education_vote_divided, type = 'HC1')) summary(Medicaid_vote_divided <- plm(Medicaid_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_vote_divided, vcov. = vcovHC(Medicaid_vote_divided, type = 'HC1')) summary(Safety_net_vote_divided <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Vote_seat_percent + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_vote_divided))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_vote_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_vote_divided, vcov. = vcovHC(Safety_net_vote_divided, type = 'HC1')) #### Efficiency gap ---- summary(AFDC_TANF_efficiency_gap_divided <- plm(AFDC_TANF_inflation_adjusted ~ Efficiency_gap_absolute_100+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_efficiency_gap_divided, vcov. = vcovHC(AFDC_TANF_efficiency_gap_divided, type = 'HC1')) summary(AFDC_TANF_recipients_efficiency_gap_divided <- plm(AFDC_TANF_recipients_percentage ~ Efficiency_gap_absolute_100+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_efficiency_gap_divided, vcov. = vcovHC(AFDC_TANF_recipients_efficiency_gap_divided, type = 'HC1')) round(3.857976e-02, 2) summary(Minimum_wage_efficiency_gap_divided <- plm(Minimum_wage_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_efficiency_gap_divided, vcov. = vcovHC(Minimum_wage_efficiency_gap_divided, type = 'HC1')) summary(Unemployment_efficiency_gap_divided <- plm(Unemployment_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_efficiency_gap_divided, vcov. = vcovHC(Unemployment_efficiency_gap_divided, type = 'HC1')) summary(Education_efficiency_gap_divided <- plm(Education_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(Education_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_efficiency_gap_divided, vcov. = vcovHC(Education_efficiency_gap_divided, type = 'HC1')) summary(Medicaid_efficiency_gap_divided <- plm(Medicaid_inflation_adjusted ~ Efficiency_gap_absolute_100 + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_efficiency_gap_divided, vcov. = vcovHC(Medicaid_efficiency_gap_divided, type = 'HC1')) summary(Safety_net_efficiency_gap_divided <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Efficiency_gap_absolute_100+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_efficiency_gap_divided))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_efficiency_gap_divided, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_efficiency_gap_divided, vcov. = vcovHC(Safety_net_efficiency_gap_divided, type = 'HC1')) # AIM 2 ---- ## Vote-seat discrepancy as the predictor ---- ## These analyses all include a spline knot at 0 but are otherwise the same as for Aim 1 summary(AFDC_TANF_directional_vote_spline <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(AFDC_TANF_directional_vote_spline)) # coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_vote_spline, vcov. = vcovHC, type = "HC1") # coefficients with robust SEs coefci(AFDC_TANF_directional_vote_spline, vcov. = vcovHC(AFDC_TANF_directional_vote_spline, type = 'HC1')) #95% confidence intervals ### Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame ### Change the file paths as necessary fitted_AFDC_TANF_directional_vote_spline <- as.numeric(AFDC_TANF_directional_vote_spline$model[[1]] - AFDC_TANF_directional_vote_spline$residuals) residuals_AFDC_TANF_directional_vote_spline<-AFDC_TANF_directional_vote_spline$residuals pRedistrictingR_AFDC_TANF_directional_vote_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_directional_vote_spline$fitted_AFDC_TANF_directional_vote_spline<-fitted_AFDC_TANF_directional_vote_spline pRedistrictingR_AFDC_TANF_directional_vote_spline$residuals_AFDC_TANF_directional_vote_spline<-residuals_AFDC_TANF_directional_vote_spline write.csv(pRedistrictingR_AFDC_TANF_directional_vote_spline,"Aim2a_AFDC_TANF_vote.csv") Aim2a_AFDC_TANF_vote<-read.csv(file="Aim2a_AFDC_TANF_vote.csv") summary(AFDC_TANF_recipients_directional_vote_spline <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(AFDC_TANF_recipients_directional_vote_spline)) # coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_vote_spline, vcov. = vcovHC, type = "HC1") # coefficients with robust SEs coefci(AFDC_TANF_recipients_directional_vote_spline, vcov. = vcovHC(AFDC_TANF_recipients_directional_vote_spline, type = 'HC1')) #95% confidence intervals round(9.283661e-03, 2) ### Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame ### Change the file paths as necessary fitted_AFDC_TANF_recipients_directional_vote_spline <- as.numeric(AFDC_TANF_recipients_directional_vote_spline$model[[1]] - AFDC_TANF_recipients_directional_vote_spline$residuals) residuals_AFDC_TANF_recipients_directional_vote_spline<-AFDC_TANF_recipients_directional_vote_spline$residuals pRedistrictingR_AFDC_TANF_recipients_directional_vote_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_recipients_directional_vote_spline$fitted_AFDC_TANF__recipientsdirectional_vote_spline<-fitted_AFDC_TANF_recipients_directional_vote_spline pRedistrictingR_AFDC_TANF_recipients_directional_vote_spline$residuals_AFDC_TANF_recipients_directional_vote_spline<-residuals_AFDC_TANF_recipients_directional_vote_spline write.csv(pRedistrictingR_AFDC_TANF_recipients_directional_vote_spline,"Aim2a_AFDC_TANF_recipients_vote.csv") Aim2a_AFDC_TANF_recipients_vote<-read.csv(file="Aim2a_AFDC_TANF_recipients_vote.csv") summary(Unemployment_directional_vote_spline <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Unemployment_directional_vote_spline)) coeftest(Unemployment_directional_vote_spline, vcov. = vcovHC, type = "HC1") coefci(Unemployment_directional_vote_spline, vcov. = vcovHC(Unemployment_directional_vote_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_unemployment_directional_vote_spline <- as.numeric(Unemployment_directional_vote_spline$model[[1]] - Unemployment_directional_vote_spline$residuals) residuals_unemployment_directional_vote_spline<-Unemployment_directional_vote_spline$residuals pRedistrictingR_unemployment_directional_vote_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_unemployment_directional_vote_spline$fitted_unemployment_directional_vote_spline<-fitted_unemployment_directional_vote_spline pRedistrictingR_unemployment_directional_vote_spline$residuals_unemployment_directional_vote_spline<-residuals_unemployment_directional_vote_spline write.csv(pRedistrictingR_unemployment_directional_vote_spline,"Aim2a_unemployment_vote.csv") Aim2a_unemployment_vote<-read.csv(file="Aim2a_unemployment_vote.csv") ###Checking the unemployment benefit results without MA, the outlier summary(Unemployment_directional_vote_spline_no_MA <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_complete,State !="MA"), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Unemployment_directional_vote_spline_no_MA))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_vote_spline_no_MA, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_vote_spline_no_MA, vcov. = vcovHC(Unemployment_directional_vote_spline_no_MA, type = 'HC1')) summary(Minimum_wage_directional_vote_spline <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Minimum_wage_directional_vote_spline)) coeftest(Minimum_wage_directional_vote_spline, vcov. = vcovHC, type = "HC1") coefci(Minimum_wage_directional_vote_spline, vcov. = vcovHC(Minimum_wage_directional_vote_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_minimum_wage_directional_vote_spline <- as.numeric(Minimum_wage_directional_vote_spline$model[[1]] - Minimum_wage_directional_vote_spline$residuals) residuals_minimum_wage_directional_vote_spline<-Minimum_wage_directional_vote_spline$residuals pRedistrictingR_minimum_wage_directional_vote_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_minimum_wage_directional_vote_spline$fitted_minimum_wage_directional_vote_spline<-fitted_minimum_wage_directional_vote_spline pRedistrictingR_minimum_wage_directional_vote_spline$residuals_minimum_wage_directional_vote_spline<-residuals_minimum_wage_directional_vote_spline write.csv(pRedistrictingR_minimum_wage_directional_vote_spline,"Aim2a_minimum_wage_vote.csv") Aim2a_minimum_wage_vote<-read.csv(file="Aim2a_minimum_wage_vote.csv") summary(Education_directional_vote_spline <- plm(Education_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_complete), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Education_directional_vote_spline)) coeftest(Education_directional_vote_spline, vcov. = vcovHC, type = "HC1") coefci(Education_directional_vote_spline, vcov. = vcovHC(Education_directional_vote_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_education_directional_vote_spline <- as.numeric(Education_directional_vote_spline$model[[1]] - Education_directional_vote_spline$residuals) residuals_education_directional_vote_spline<-Education_directional_vote_spline$residuals pRedistrictingR_education_directional_vote_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_education_directional_vote_spline$fitted_education_directional_vote_spline<-fitted_education_directional_vote_spline pRedistrictingR_education_directional_vote_spline$residuals_education_directional_vote_spline<-residuals_education_directional_vote_spline write.csv(pRedistrictingR_education_directional_vote_spline,"Aim2a_education_vote.csv") Aim2a_education_vote<-read.csv(file="Aim2a_education_vote.csv") summary(Medicaid_directional_vote_spline <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_Medicaid_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Medicaid_directional_vote_spline)) coeftest(Medicaid_directional_vote_spline, vcov. = vcovHC, type = "HC1") coefci(Medicaid_directional_vote_spline, vcov. = vcovHC(Medicaid_directional_vote_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_Medicaid_directional_vote_spline <- as.numeric(Medicaid_directional_vote_spline$model[[1]] - Medicaid_directional_vote_spline$residuals) residuals_Medicaid_directional_vote_spline<-Medicaid_directional_vote_spline$residuals pRedistrictingR_Medicaid_directional_vote_spline <- pdata.frame(RedistrictingR_Medicaid_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_Medicaid_directional_vote_spline$fitted_Medicaid_directional_vote_spline<-fitted_Medicaid_directional_vote_spline pRedistrictingR_Medicaid_directional_vote_spline$residuals_Medicaid_directional_vote_spline<-residuals_Medicaid_directional_vote_spline write.csv(pRedistrictingR_Medicaid_directional_vote_spline,"Aim2a_Medicaid_vote.csv") Aim2a_Medicaid_vote<-read.csv(file="Aim2a_Medicaid_vote.csv") ### Medicaid before 2010 (i.e., before ACA) ### These analyses test whether the Medicaid results have something to do with the ACA ### The data are restricted to before 2010 summary(Medicaid_directional_vote_before_2008 <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Year < 2009), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Medicaid_directional_vote_before_2008)) coeftest(Medicaid_directional_vote_before_2008, vcov. = vcovHC, type = "HC1") coefci(Medicaid_directional_vote_before_2008, vcov. = vcovHC(Medicaid_directional_vote_before_2008, type = 'HC1')) summary(Medicaid_directional_vote_after_2012 <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_Medicaid_complete, Year > 2011), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Medicaid_directional_vote_after_2012)) coeftest(Medicaid_directional_vote_after_2012, vcov. = vcovHC, type = "HC1") coefci(Medicaid_directional_vote_after_2012, vcov. = vcovHC(Medicaid_directional_vote_after_2012, type = 'HC1')) ### Safety net benefits, between 1999 and 2018 summary(Ave_cash_food_benefits_directional_vote_spline <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_complete, Year > 1998 & Year < 2019), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Ave_cash_food_benefits_directional_vote_spline)) coeftest(Ave_cash_food_benefits_directional_vote_spline, vcov. = vcovHC, type = "HC1") coefci(Ave_cash_food_benefits_directional_vote_spline, vcov. = vcovHC(Ave_cash_food_benefits_directional_vote_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_ave_cash_food_benefits_directional_vote_spline <- as.numeric(Ave_cash_food_benefits_directional_vote_spline$model[[1]] - Ave_cash_food_benefits_directional_vote_spline$residuals) residuals_ave_cash_food_benefits_directional_vote_spline<-Ave_cash_food_benefits_directional_vote_spline$residuals pRedistrictingR_ave_cash_food_benefits_directional_vote_spline <- pdata.frame(subset(RedistrictingR_complete,Year > 1998 & Year < 2019), index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_ave_cash_food_benefits_directional_vote_spline$fitted_ave_cash_food_benefits_directional_vote_spline<-fitted_ave_cash_food_benefits_directional_vote_spline pRedistrictingR_ave_cash_food_benefits_directional_vote_spline$residuals_ave_cash_food_benefits_directional_vote_spline<-residuals_ave_cash_food_benefits_directional_vote_spline write.csv(pRedistrictingR_ave_cash_food_benefits_directional_vote_spline,"Aim2a_safety_net_vote.csv") Aim2a_safety_net_vote<-read.csv(file="Aim2a_safety_net_vote.csv") ## Efficiency gap as the predictor ---- ## Same analyses as for vote-seat discrepancy summary(AFDC_TANF_directional_efficiency_gap_spline <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(AFDC_TANF_directional_efficiency_gap_spline)) coeftest(AFDC_TANF_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_directional_efficiency_gap_spline, vcov. = vcovHC(AFDC_TANF_directional_efficiency_gap_spline, type = 'HC1')) ### Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_AFDC_TANF_directional_efficiency_gap_spline <- as.numeric(AFDC_TANF_directional_efficiency_gap_spline$model[[1]] - AFDC_TANF_directional_efficiency_gap_spline$residuals) residuals_AFDC_TANF_directional_efficiency_gap_spline<-AFDC_TANF_directional_efficiency_gap_spline$residuals pRedistrictingR_AFDC_TANF_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_directional_efficiency_gap_spline$fitted_AFDC_TANF_directional_efficiency_gap_spline<-fitted_AFDC_TANF_directional_efficiency_gap_spline pRedistrictingR_AFDC_TANF_directional_efficiency_gap_spline$residuals_AFDC_TANF_directional_efficiency_gap_spline<-residuals_AFDC_TANF_directional_efficiency_gap_spline write.csv(pRedistrictingR_AFDC_TANF_directional_efficiency_gap_spline,"Aim2a_AFDC_TANF_efficiency_gap.csv") Aim2a_AFDC_TANF_efficiency_gap<-read.csv(file="Aim2a_AFDC_TANF_efficiency_gap.csv") summary(AFDC_TANF_recipients_directional_efficiency_gap_spline <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(AFDC_TANF_recipients_directional_efficiency_gap_spline)) coeftest(AFDC_TANF_recipients_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(AFDC_TANF_recipients_directional_efficiency_gap_spline, vcov. = vcovHC(AFDC_TANF_recipients_directional_efficiency_gap_spline, type = 'HC1')) round(2.499213e-02,3) ### Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_AFDC_TANF_recipients_directional_efficiency_gap_spline <- as.numeric(AFDC_TANF_recipients_directional_efficiency_gap_spline$model[[1]] - AFDC_TANF_recipients_directional_efficiency_gap_spline$residuals) residuals_AFDC_TANF_recipients_directional_efficiency_gap_spline<-AFDC_TANF_recipients_directional_efficiency_gap_spline$residuals pRedistrictingR_AFDC_TANF_recipients_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_AFDC_TANF_recipients_directional_efficiency_gap_spline$fitted_AFDC_TANF_recipients_directional_efficiency_gap_spline<-fitted_AFDC_TANF_recipients_directional_efficiency_gap_spline pRedistrictingR_AFDC_TANF_recipients_directional_efficiency_gap_spline$residuals_AFDC_TANF_recipients_directional_efficiency_gap_spline<-residuals_AFDC_TANF_recipients_directional_efficiency_gap_spline write.csv(pRedistrictingR_AFDC_TANF_recipients_directional_efficiency_gap_spline,"Aim2a_AFDC_TANF_recipients_efficiency_gap.csv") Aim2a_AFDC_TANF_recipients_efficiency_gap<-read.csv(file="Aim2a_AFDC_TANF_recipients_efficiency_gap.csv") summary(Unemployment_directional_efficiency_gap_spline <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Unemployment_directional_efficiency_gap_spline)) coeftest(Unemployment_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(Unemployment_directional_efficiency_gap_spline, vcov. = vcovHC(Unemployment_directional_efficiency_gap_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_unemployment_directional_efficiency_gap_spline <- as.numeric(Unemployment_directional_efficiency_gap_spline$model[[1]] - Unemployment_directional_efficiency_gap_spline$residuals) residuals_unemployment_directional_efficiency_gap_spline<-Unemployment_directional_efficiency_gap_spline$residuals pRedistrictingR_unemployment_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_unemployment_directional_efficiency_gap_spline$fitted_unemployment_directional_efficiency_gap_spline<-fitted_unemployment_directional_efficiency_gap_spline pRedistrictingR_unemployment_directional_efficiency_gap_spline$residuals_unemployment_directional_efficiency_gap_spline<-residuals_unemployment_directional_efficiency_gap_spline write.csv(pRedistrictingR_unemployment_directional_efficiency_gap_spline,"Aim2a_unemployment_efficiency_gap.csv") Aim2a_unemployment_efficiency_gap<-read.csv(file="Aim2a_unemployment_efficiency_gap.csv") summary(Minimum_wage_directional_efficiency_gap_spline <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Minimum_wage_directional_efficiency_gap_spline)) coeftest(Minimum_wage_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(Minimum_wage_directional_efficiency_gap_spline, vcov. = vcovHC(Minimum_wage_directional_efficiency_gap_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_minimum_wage_directional_efficiency_gap_spline <- as.numeric(Minimum_wage_directional_efficiency_gap_spline$model[[1]] - Minimum_wage_directional_efficiency_gap_spline$residuals) residuals_minimum_wage_directional_efficiency_gap_spline<-Minimum_wage_directional_efficiency_gap_spline$residuals pRedistrictingR_minimum_wage_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_minimum_wage_directional_efficiency_gap_spline$fitted_minimum_wage_directional_efficiency_gap_spline<-fitted_minimum_wage_directional_efficiency_gap_spline pRedistrictingR_minimum_wage_directional_efficiency_gap_spline$residuals_minimum_wage_directional_efficiency_gap_spline<-residuals_minimum_wage_directional_efficiency_gap_spline write.csv(pRedistrictingR_minimum_wage_directional_efficiency_gap_spline,"Aim2a_minimum_wage_efficiency_gap.csv") Aim2a_minimum_wage_efficiency_gap<-read.csv(file="Aim2a_minimum_wage_efficiency_gap.csv") summary(Education_directional_efficiency_gap_spline <- plm(Education_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = subset(RedistrictingR_complete), index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Education_directional_efficiency_gap_spline)) coeftest(Education_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(Education_directional_efficiency_gap_spline, vcov. = vcovHC(Education_directional_efficiency_gap_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_education_directional_efficiency_gap_spline <- as.numeric(Education_directional_efficiency_gap_spline$model[[1]] - Education_directional_efficiency_gap_spline$residuals) residuals_education_directional_efficiency_gap_spline<-Education_directional_efficiency_gap_spline$residuals pRedistrictingR_education_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_education_directional_efficiency_gap_spline$fitted_education_directional_efficiency_gap_spline<-fitted_education_directional_efficiency_gap_spline pRedistrictingR_education_directional_efficiency_gap_spline$residuals_education_directional_efficiency_gap_spline<-residuals_education_directional_efficiency_gap_spline write.csv(pRedistrictingR_education_directional_efficiency_gap_spline,"Aim2a_education_efficiency_gap.csv") Aim2a_education_efficiency_gap<-read.csv(file="Aim2a_education_efficiency_gap.csv") summary(Medicaid_directional_efficiency_gap_spline <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_Medicaid_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Medicaid_directional_efficiency_gap_spline)) coeftest(Medicaid_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(Medicaid_directional_efficiency_gap_spline, vcov. = vcovHC(Medicaid_directional_efficiency_gap_spline, type = 'HC1')) ###Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_Medicaid_directional_efficiency_gap_spline <- as.numeric(Medicaid_directional_efficiency_gap_spline$model[[1]] - Medicaid_directional_efficiency_gap_spline$residuals) residuals_Medicaid_directional_efficiency_gap_spline<-Medicaid_directional_efficiency_gap_spline$residuals pRedistrictingR_Medicaid_directional_efficiency_gap_spline <- pdata.frame(RedistrictingR_Medicaid_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_Medicaid_directional_efficiency_gap_spline$fitted_Medicaid_directional_efficiency_gap_spline<-fitted_Medicaid_directional_efficiency_gap_spline pRedistrictingR_Medicaid_directional_efficiency_gap_spline$residuals_Medicaid_directional_efficiency_gap_spline<-residuals_Medicaid_directional_efficiency_gap_spline write.csv(pRedistrictingR_Medicaid_directional_efficiency_gap_spline,"Aim2a_Medicaid_efficiency_gap.csv") Aim2a_Medicaid_efficiency_gap<-read.csv(file="Aim2a_Medicaid_efficiency_gap.csv") summary(Safety_net_directional_efficiency_gap_spline <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_per_capita + Poverty_rate, data = RedistrictingR_complete, index = c("State_factor", "Year"), effect = "twoways", model = "within")) coefficients(summary(Safety_net_directional_efficiency_gap_spline)) coeftest(Safety_net_directional_efficiency_gap_spline, vcov. = vcovHC, type = "HC1") coefci(Safety_net_directional_efficiency_gap_spline, vcov. = vcovHC(Safety_net_directional_efficiency_gap_spline, type = 'HC1')) ### Extracting fitted & residual values, creating a pdataframe, adding fitted values & residuals to it & then converting it to a regular data frame fitted_safety_net_directional_efficiency_gap_spline <- as.numeric(Safety_net_directional_efficiency_gap_spline$model[[1]] - Safety_net_directional_efficiency_gap_spline$residuals) residuals_safety_net_directional_efficiency_gap_spline<-Safety_net_directional_efficiency_gap_spline$residuals pRedistrictingR_safety_net_directional_efficiency_gap_spline <- pdata.frame(subset(RedistrictingR_complete,Year > 1998 & Year < 2019), index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_safety_net_directional_efficiency_gap_spline$fitted_safety_net_directional_efficiency_gap_spline<-fitted_safety_net_directional_efficiency_gap_spline pRedistrictingR_safety_net_directional_efficiency_gap_spline$residuals_safety_net_directional_efficiency_gap_spline<-residuals_safety_net_directional_efficiency_gap_spline write.csv(pRedistrictingR_safety_net_directional_efficiency_gap_spline,"Aim2a_safety_net_efficiency_gap.csv") Aim2a_safety_net_efficiency_gap<-read.csv(file="Aim2a_safety_net_efficiency_gap.csv") ## Tile plots of Aim 2a results ---- ## These plot the fitted values of each outcome against directional vote-seat discrepancy within each state ##(suppress facet_wrap for the aggregate results,) ### Tile plot of Aim2a-fitted AFDC-TANF benefits vs. directional vote-seat percent for all states (AFDC_TANF_vote_2a_plot<-ggplot(data=Aim2a_AFDC_TANF_vote, aes(x=Directional_vote_seat_percent, y=fitted_AFDC_TANF_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted AFDC/TANF")+ ggtitle("AFDC-TANF")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted AFDC-TANF recipients vs. directional vote-seat percent for all states (AFDC_TANF_recipients_vote_2a_plot<-ggplot(data=Aim2a_AFDC_TANF_recipients_vote, aes(x=Directional_vote_seat_percent, y=fitted_AFDC_TANF_recipients_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted AFDC/TANF recipients")+ ggtitle("AFDC-TANF")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted unemployment benefits vs. directional vote-seat percent for all states (Unemployment_vote_2a_plot<-ggplot(data=Aim2a_unemployment_vote, aes(x=Directional_vote_seat_percent, y=fitted_unemployment_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted unemployment benefits")+ ggtitle("Unemployment")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted minimum wage vs. directional vote-seat percent for all states (Minimum_wage_vote_2a_plot<-ggplot(data=Aim2a_minimum_wage_vote, aes(x=Directional_vote_seat_percent, y=fitted_minimum_wage_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted minimum wage")+ ggtitle("Minimum wage")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted education expenditures vs. directional vote-seat percent for all states (Education_vote_2a_plot<-ggplot(data=Aim2a_education_vote, aes(x=Directional_vote_seat_percent, y=fitted_education_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted education expenditures per child")+ ggtitle("Education")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted Medicaid benefits vs. directional vote-seat percent for all states (Medicaid_vote_2a_plot<-ggplot(data=Aim2a_Medicaid_vote, aes(x=Directional_vote_seat_percent, y=fitted_Medicaid_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted Medicaid benefits")+ ggtitle("Medicaid")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Tile plot of Aim2a-fitted safety net bundle benefits vs. directional vote-seat percent for all states (Safety_net_vote_2a_plot<-ggplot(data=Aim2a_safety_net_vote, aes(x=Directional_vote_seat_percent, y=fitted_ave_cash_food_benefits_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted Safety Net Benefits")+ ggtitle("Bundle of Safety Net Benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ## Aim 2a plots of fitted values for one state at a time ---- ### Aim 2a AFDC-TANF plot (AFDC_TANF_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_AFDC_TANF_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_AFDC_TANF_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted AFDC/TANF benefits")+ ggtitle("AFDC-TANF")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) AFDC_TANF_recipients_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_AFDC_TANF_recipients_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_AFDC_TANF_recipients_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted AFDC/TANF recipients")+ ggtitle("AFDC-TANF")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm")) (Unemployment_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_unemployment_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_unemployment_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted unemployment")+ theme(text = element_text(family = "Arial"))+ ggtitle("Unemployment")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Minimum_wage_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_minimum_wage_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_minimum_wage_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted minimum wage")+ ggtitle("Minimum_wage")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Education_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_education_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_education_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted education expenditures per child")+ ggtitle("Education")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Medicaid_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_Medicaid_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_Medicaid_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted Medicaid benefits")+ ggtitle("Education")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Safety_net_vote_2a_plot_one_state<-ggplot(data=subset(Aim2a_safety_net_vote, State=="MN"), aes(x=Directional_vote_seat_percent, y=fitted_ave_cash_food_benefits_directional_vote_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted bundle of safety net benefits")+ ggtitle("Bundle of Safety Net Benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ### Showing fitted values for each outcome for one state only grid.arrange(AFDC_TANF_vote_2a_plot_one_state, Unemployment_vote_2a_plot_one_state, Minimum_wage_vote_2a_plot_one_state, Education_vote_2a_plot_one_state, Medicaid_vote_2a_plot_one_state, Safety_net_vote_2a_plot_one_state, ncol=2, nrow = 3) ## Aim 2a plots of fitted values for several states at a time ---- (Medicaid_vote_2a_several_states_plot<-ggplot(data=subset(Aim2a_Medicaid_vote, State=="AZ"|State=="CO"|State=="WY"), aes(x=Directional_vote_seat_percent, y=fitted_Medicaid_directional_vote_spline, color=State)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE) + geom_vline(xintercept =0) + theme(text = element_text(family = "Arial"))+ facet_wrap(~State)+ labs(x="Directional vote_seat_percent (- = pro-R, + = pro-D)", y="Fitted Medicaid benefits")+ ggtitle("Medicaid")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ggplotly(Medicaid_vote_2a_several_states_plot, tooltip = c("State")) #by state ## Efficiency gap spline plots ---- ## These are plots of the directional efficiency gap against fitted values based on Aim 2a (AFDC_TANF_efficiency_gap_2a_plot<-ggplot(data=Aim2a_AFDC_TANF_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_AFDC_TANF_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted AFDC/TANF")+ ggtitle("AFDC-TANF")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Unemployment_efficiency_gap_2a_plot<-ggplot(data=Aim2a_unemployment_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_unemployment_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted unemployment")+ ggtitle("Unemployment")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Minimum_wage_efficiency_gap_2a_plot<-ggplot(data=Aim2a_minimum_wage_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_minimum_wage_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted minimum wage")+ ggtitle("Minimum wage")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Education_efficiency_gap_2a_plot<-ggplot(data=Aim2a_education_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_education_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted education")+ ggtitle("Education")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Medicaid_efficiency_gap_2a_plot<-ggplot(data=Aim2a_Medicaid_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_Medicaid_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted Medicaid")+ ggtitle("Medicaid")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) (Safety_net_efficiency_gap_2a_plot<-ggplot(data=Aim2a_safety_net_efficiency_gap, aes(x=Directional_efficiency_gap, y=fitted_safety_net_directional_efficiency_gap_spline)) + geom_point()+ scale_x_continuous(limits=c(-40,40),breaks=seq(-40, 40, 10))+ geom_smooth(method = "lm",formula = y ~lspline(x, knots = 0), size=1.5, linetype="solid", se=TRUE, color="red") + geom_vline(xintercept =0) + #facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(x="Directional efficiency_gap (- = pro-R, + = pro-D)", y="Fitted safety net benefits")+ ggtitle("Bundle of safety net benefits")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) grid.arrange(AFDC_TANF_efficiency_gap_2a_plot, Unemployment_efficiency_gap_2a_plot, Minimum_wage_efficiency_gap_2a_plot, Education_efficiency_gap_2a_plot, Medicaid_efficiency_gap_2a_plot, Safety_net_efficiency_gap_2a_plot,ncol=2, nrow = 3) ## Aim 2 under trifecta vs. divided government ---- ## Does bias favoring Democrats have more impact when there's a Democratic trifecta & ditto for Republicans? ## What happens to effect of bias under divided government? ## The analyses below are the same as for Aim 2, but with the data frame limited to state-years with trifectas by either party or divided government ### Vote-seat discrepancy as the predictor ---- #### Histogram of state-years with trifectas vs. divided government ggplot(data=subset(RedistrictingR_complete, Unified_control == 1), aes(x=Directional_vote_seat_percent, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") ggplot(data=subset(RedistrictingR_complete, Unified_control == 2), aes(x=Directional_vote_seat_percent, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") ggplot(data=subset(RedistrictingR_complete, Unified_control == 0), aes(x=Directional_vote_seat_percent, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") #### D trifecta (used only to estimate the values for the Democrats) summary(AFDC_TANF_directional_vote_D_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_vote_D_trifecta, vcov. = vcovHC(AFDC_TANF_directional_vote_D_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_directional_vote_D_trifecta <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_vote_D_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_directional_vote_D_trifecta, type = 'HC1')) round(2.930410e-02,3) summary(Unemployment_directional_vote_D_trifecta <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_vote_D_trifecta, vcov. = vcovHC(Unemployment_directional_vote_D_trifecta, type = 'HC1')) summary(Minimum_wage_directional_vote_D_trifecta <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_vote_D_trifecta, vcov. = vcovHC(Minimum_wage_directional_vote_D_trifecta, type = 'HC1')) summary(Education_directional_vote_D_trifecta <- plm(Education_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_vote_D_trifecta, vcov. = vcovHC(Education_directional_vote_D_trifecta, type = 'HC1')) summary(Medicaid_directional_vote_D_trifecta <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_vote_D_trifecta, vcov. = vcovHC(Medicaid_directional_vote_D_trifecta, type = 'HC1')) summary(Safety_net_directional_vote_D_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_vote_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_vote_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_vote_D_trifecta, vcov. = vcovHC(Safety_net_directional_vote_D_trifecta, type = 'HC1')) #### R trifecta (used only to calculate the values for R trifectas) summary(AFDC_TANF_directional_vote_R_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_vote_R_trifecta, vcov. = vcovHC(AFDC_TANF_directional_vote_R_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_directional_vote_R_trifecta <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_vote_R_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_directional_vote_R_trifecta, type = 'HC1')) round(8.334975e-03,3) summary(Unemployment_directional_vote_R_trifecta <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_vote_R_trifecta, vcov. = vcovHC(Unemployment_directional_vote_R_trifecta, type = 'HC1')) summary(Minimum_wage_directional_vote_R_trifecta <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_vote_R_trifecta, vcov. = vcovHC(Minimum_wage_directional_vote_R_trifecta, type = 'HC1')) summary(Education_directional_vote_R_trifecta <- plm(Education_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_vote_R_trifecta, vcov. = vcovHC(Education_directional_vote_R_trifecta, type = 'HC1')) summary(Medicaid_directional_vote_R_trifecta <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_vote_R_trifecta, vcov. = vcovHC(Medicaid_directional_vote_R_trifecta, type = 'HC1')) summary(Safety_net_directional_vote_R_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_vote_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_vote_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_vote_R_trifecta, vcov. = vcovHC(Safety_net_directional_vote_R_trifecta, type = 'HC1')) #### Divided government summary(AFDC_TANF_directional_vote_divided_gov <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_vote_divided_gov, vcov. = vcovHC(AFDC_TANF_directional_vote_divided_gov, type = 'HC1')) summary(AFDC_TANF_recipients_directional_vote_divided_gov <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_vote_divided_gov, vcov. = vcovHC(AFDC_TANF_recipients_directional_vote_divided_gov, type = 'HC1')) round(2.163179e-02,3) summary(Unemployment_directional_vote_divided_gov <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_vote_divided_gov, vcov. = vcovHC(Unemployment_directional_vote_divided_gov, type = 'HC1')) summary(Minimum_wage_directional_vote_divided_gov <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_vote_divided_gov, vcov. = vcovHC(Minimum_wage_directional_vote_divided_gov, type = 'HC1')) summary(Education_directional_vote_divided_gov <- plm(Education_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_vote_divided_gov, vcov. = vcovHC(Education_directional_vote_divided_gov, type = 'HC1')) summary(Medicaid_directional_vote_divided_gov <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_vote_divided_gov, vcov. = vcovHC(Medicaid_directional_vote_divided_gov, type = 'HC1')) summary(Safety_net_directional_vote_divided_gov <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_vote_seat_percent, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_vote_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_vote_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_vote_divided_gov, vcov. = vcovHC(Safety_net_directional_vote_divided_gov, type = 'HC1')) ### Efficiency gap as the predictor ---- #### Histogram of state-years with trifectas vs. divided government ggplot(data=subset(RedistrictingR_complete, Unified_control == 1), aes(x=Directional_efficiency_gap, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") ggplot(data=subset(RedistrictingR_complete, Unified_control == 2), aes(x=Directional_efficiency_gap, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") ggplot(data=subset(RedistrictingR_complete, Unified_control == 0), aes(x=Directional_efficiency_gap, y=after_stat(count))) + geom_histogram(color="gray", fill = "black") #### D trifecta summary(AFDC_TANF_directional_efficiency_gap_D_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(AFDC_TANF_directional_efficiency_gap_D_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_directional_efficiency_gap_D_trifecta <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_directional_efficiency_gap_D_trifecta, type = 'HC1')) round(3.239230e-02,2) summary(Unemployment_directional_efficiency_gap_D_trifecta <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(Unemployment_directional_efficiency_gap_D_trifecta, type = 'HC1')) summary(Minimum_wage_directional_efficiency_gap_D_trifecta <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(Minimum_wage_directional_efficiency_gap_D_trifecta, type = 'HC1')) summary(Education_directional_efficiency_gap_D_trifecta <- plm(Education_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(Education_directional_efficiency_gap_D_trifecta, type = 'HC1')) summary(Medicaid_directional_efficiency_gap_D_trifecta <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(Medicaid_directional_efficiency_gap_D_trifecta, type = 'HC1')) summary(Safety_net_directional_efficiency_gap_D_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==1), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_efficiency_gap_D_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_efficiency_gap_D_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_efficiency_gap_D_trifecta, vcov. = vcovHC(Safety_net_directional_efficiency_gap_D_trifecta, type = 'HC1')) #### R trifecta summary(AFDC_TANF_directional_efficiency_gap_R_trifecta <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(AFDC_TANF_directional_efficiency_gap_R_trifecta, type = 'HC1')) summary(AFDC_TANF_recipients_directional_efficiency_gap_R_trifecta <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(AFDC_TANF_recipients_directional_efficiency_gap_R_trifecta, type = 'HC1')) round(5.022872e-04,3) summary(Unemployment_directional_efficiency_gap_R_trifecta <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(Unemployment_directional_efficiency_gap_R_trifecta, type = 'HC1')) summary(Minimum_wage_directional_efficiency_gap_R_trifecta <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(Minimum_wage_directional_efficiency_gap_R_trifecta, type = 'HC1')) summary(Education_directional_efficiency_gap_R_trifecta <- plm(Education_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(Education_directional_efficiency_gap_R_trifecta, type = 'HC1')) summary(Medicaid_directional_efficiency_gap_R_trifecta <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(Medicaid_directional_efficiency_gap_R_trifecta, type = 'HC1')) summary(Safety_net_directional_efficiency_gap_R_trifecta <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==2), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_efficiency_gap_R_trifecta))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_efficiency_gap_R_trifecta, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_efficiency_gap_R_trifecta, vcov. = vcovHC(Safety_net_directional_efficiency_gap_R_trifecta, type = 'HC1')) #### Divided government summary(AFDC_TANF_directional_efficiency_gap_divided_gov <- plm(AFDC_TANF_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_directional_efficiency_gap_divided_gov, vcov. = vcovHC(AFDC_TANF_directional_efficiency_gap_divided_gov, type = 'HC1')) summary(AFDC_TANF_recipients_directional_efficiency_gap_divided_gov <- plm(AFDC_TANF_recipients_percentage ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(AFDC_TANF_recipients_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(AFDC_TANF_recipients_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(AFDC_TANF_recipients_directional_efficiency_gap_divided_gov, vcov. = vcovHC(AFDC_TANF_recipients_directional_efficiency_gap_divided_gov, type = 'HC1')) round(2.996236e-02,2) summary(Unemployment_directional_efficiency_gap_divided_gov <- plm(Unemployment_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Unemployment_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Unemployment_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Unemployment_directional_efficiency_gap_divided_gov, vcov. = vcovHC(Unemployment_directional_efficiency_gap_divided_gov, type = 'HC1')) summary(Minimum_wage_directional_efficiency_gap_divided_gov <- plm(Minimum_wage_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Minimum_wage_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Minimum_wage_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Minimum_wage_directional_efficiency_gap_divided_gov, vcov. = vcovHC(Minimum_wage_directional_efficiency_gap_divided_gov, type = 'HC1')) summary(Education_directional_efficiency_gap_divided_gov <- plm(Education_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Education_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Education_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Education_directional_efficiency_gap_divided_gov, vcov. = vcovHC(Education_directional_efficiency_gap_divided_gov, type = 'HC1')) summary(Medicaid_directional_efficiency_gap_divided_gov <- plm(Medicaid_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_Medicaid_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Medicaid_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Medicaid_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Medicaid_directional_efficiency_gap_divided_gov, vcov. = vcovHC(Medicaid_directional_efficiency_gap_divided_gov, type = 'HC1')) summary(Safety_net_directional_efficiency_gap_divided_gov <- plm(Ave_cash_food_benefits_inflation_adjusted ~ lspline(Directional_efficiency_gap, knots = 0) + Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset( RedistrictingR_complete,Unified_control==0), index = c("State_factor", "Year"), model = "within", effect = "twoways")) coefficients(summary(Safety_net_directional_efficiency_gap_divided_gov))# coefficients & their significance w/o the robust SEs coeftest(Safety_net_directional_efficiency_gap_divided_gov, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Safety_net_directional_efficiency_gap_divided_gov, vcov. = vcovHC(Safety_net_directional_efficiency_gap_divided_gov, type = 'HC1')) ## Effect of proportion of Democrats in the lower chamber ---- summary(Lower_chamber_Ds_AFDC_TANF <- plm(AFDC_TANF_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_AFDC_TANF))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_AFDC_TANF, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_AFDC_TANF, vcov. = vcovHC(Lower_chamber_Ds_AFDC_TANF, type = 'HC1')) fitted_lower_chamber_Ds_AFDC_TANF <- as.numeric(Lower_chamber_Ds_AFDC_TANF$model[[1]] - Lower_chamber_Ds_AFDC_TANF$residuals) residuals_lower_chamber_Ds_AFDC_TANF<-Lower_chamber_Ds_AFDC_TANF$residuals pRedistrictingR_lower_chamber_Ds_AFDC_TANF <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_AFDC_TANF$fitted_lower_chamber_Ds_AFDC_TANF<-fitted_lower_chamber_Ds_AFDC_TANF pRedistrictingR_lower_chamber_Ds_AFDC_TANF$residuals_lower_chamber_Ds_AFDC_TANF<-residuals_lower_chamber_Ds_AFDC_TANF write.csv(pRedistrictingR_lower_chamber_Ds_AFDC_TANF,"Lower_chamber_Ds_AFDC_TANF_data.csv") Lower_chamber_Ds_AFDC_TANF_data<-read.csv(file="Lower_chamber_Ds_AFDC_TANF_data.csv") summary(Lower_chamber_Ds_AFDC_TANF_recipients <- plm(AFDC_TANF_recipients_percentage ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_AFDC_TANF_recipients))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_AFDC_TANF_recipients, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_AFDC_TANF_recipients, vcov. = vcovHC(Lower_chamber_Ds_AFDC_TANF_recipients, type = 'HC1')) summary(Lower_chamber_Ds_minimum_wage <- plm(Minimum_wage_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_minimum_wage))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_minimum_wage, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_minimum_wage, vcov. = vcovHC(Lower_chamber_Ds_minimum_wage, type = 'HC1')) fitted_lower_chamber_Ds_minimum_wage <- as.numeric(Lower_chamber_Ds_minimum_wage$model[[1]] - Lower_chamber_Ds_minimum_wage$residuals) residuals_lower_chamber_Ds_minimum_wage<-Lower_chamber_Ds_minimum_wage$residuals pRedistrictingR_lower_chamber_Ds_minimum_wage <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_minimum_wage$fitted_lower_chamber_Ds_minimum_wage<-fitted_lower_chamber_Ds_minimum_wage pRedistrictingR_lower_chamber_Ds_minimum_wage$residuals_lower_chamber_Ds_minimum_wage<-residuals_lower_chamber_Ds_minimum_wage write.csv(pRedistrictingR_lower_chamber_Ds_minimum_wage,"Lower_chamber_Ds_minimum_wage_data.csv") Lower_chamber_Ds_minimum_wage_data<-read.csv(file="Lower_chamber_Ds_minimum_wage_data.csv") summary(Lower_chamber_Ds_unemployment <- plm(Unemployment_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_unemployment))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_unemployment, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_unemployment, vcov. = vcovHC(Lower_chamber_Ds_unemployment, type = 'HC1')) fitted_lower_chamber_Ds_unemployment <- as.numeric(Lower_chamber_Ds_unemployment$model[[1]] - Lower_chamber_Ds_unemployment$residuals) residuals_lower_chamber_Ds_unemployment<-Lower_chamber_Ds_unemployment$residuals pRedistrictingR_lower_chamber_Ds_unemployment <- pdata.frame(RedistrictingR_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_unemployment$fitted_lower_chamber_Ds_unemployment<-fitted_lower_chamber_Ds_unemployment pRedistrictingR_lower_chamber_Ds_unemployment$residuals_lower_chamber_Ds_unemployment<-residuals_lower_chamber_Ds_unemployment write.csv(pRedistrictingR_lower_chamber_Ds_unemployment,"Lower_chamber_Ds_unemployment_data.csv") Lower_chamber_Ds_unemployment_data<-read.csv(file="Lower_chamber_Ds_unemployment_data.csv") summary(Lower_chamber_Ds_education <- plm(Education_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_education))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_education, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_education, vcov. = vcovHC(Lower_chamber_Ds_education, type = 'HC1')) fitted_lower_chamber_Ds_education <- as.numeric(Lower_chamber_Ds_education$model[[1]] - Lower_chamber_Ds_education$residuals) residuals_lower_chamber_Ds_education<-Lower_chamber_Ds_education$residuals pRedistrictingR_lower_chamber_Ds_education <- pdata.frame(subset(RedistrictingR_complete), index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_education$fitted_lower_chamber_Ds_education<-fitted_lower_chamber_Ds_education pRedistrictingR_lower_chamber_Ds_education$residuals_lower_chamber_Ds_education<-residuals_lower_chamber_Ds_education write.csv(pRedistrictingR_lower_chamber_Ds_education,"Lower_chamber_Ds_education_data.csv") Lower_chamber_Ds_education_data<-read.csv(file="Lower_chamber_Ds_education_data.csv") summary(Lower_chamber_Ds_Medicaid <- plm(Medicaid_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = RedistrictingR_Medicaid_complete, index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_Medicaid))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_Medicaid, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_Medicaid, vcov. = vcovHC(Lower_chamber_Ds_Medicaid, type = 'HC1')) fitted_lower_chamber_Ds_Medicaid <- as.numeric(Lower_chamber_Ds_Medicaid$model[[1]] - Lower_chamber_Ds_Medicaid$residuals) residuals_lower_chamber_Ds_Medicaid<-Lower_chamber_Ds_Medicaid$residuals pRedistrictingR_lower_chamber_Ds_Medicaid <- pdata.frame(RedistrictingR_Medicaid_complete,index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_Medicaid$fitted_lower_chamber_Ds_Medicaid<-fitted_lower_chamber_Ds_Medicaid pRedistrictingR_lower_chamber_Ds_Medicaid$residuals_lower_chamber_Ds_Medicaid<-residuals_lower_chamber_Ds_Medicaid write.csv(pRedistrictingR_lower_chamber_Ds_Medicaid,"Lower_chamber_Ds_Medicaid_data.csv") Lower_chamber_Ds_Medicaid_data<-read.csv(file="Lower_chamber_Ds_Medicaid_data.csv") summary(Lower_chamber_Ds_safety_net <- plm(Ave_cash_food_benefits_inflation_adjusted ~ Lower_chamber_Democrats_percent+ Policy_conservatism_cultural_100 + Policy_conservatism_economic_100 + Under18_percent + Whites_percent + Foreign_born_percent + State_GDP_inflation_adjusted + Poverty_rate, data = subset(RedistrictingR_complete, Year >1998 & Year < 2019), index = c("State", "Year"), model = "within", effect = "twoways")) coefficients(summary(Lower_chamber_Ds_safety_net))# coefficients & their significance w/o the robust SEs coeftest(Lower_chamber_Ds_safety_net, vcov. = vcovHC, type = "HC1")#coefficients w/robust SEs coefci(Lower_chamber_Ds_safety_net, vcov. = vcovHC(Lower_chamber_Ds_safety_net, type = 'HC1')) fitted_lower_chamber_Ds_safety_net <- as.numeric(Lower_chamber_Ds_safety_net$model[[1]] - Lower_chamber_Ds_safety_net$residuals) residuals_lower_chamber_Ds_safety_net<-Lower_chamber_Ds_safety_net$residuals pRedistrictingR_lower_chamber_Ds_safety_net <- pdata.frame(subset(RedistrictingR_complete,Year >1998 & Year < 2019),index = c("State_factor", "Year"), row.names=TRUE) pRedistrictingR_lower_chamber_Ds_safety_net$fitted_lower_chamber_Ds_safety_net<-fitted_lower_chamber_Ds_safety_net pRedistrictingR_lower_chamber_Ds_safety_net$residuals_lower_chamber_Ds_safety_net<-residuals_lower_chamber_Ds_safety_net write.csv(pRedistrictingR_lower_chamber_Ds_safety_net,"Lower_chamber_Ds_safety_net_data.csv") Lower_chamber_Ds_safety_net_data<-read.csv(file="Lower_chamber_Ds_safety_net_data.csv") ggplotly(ggplot(data=Lower_chamber_Ds_AFDC_TANF_data, aes(x=Lower_chamber_proportion_Democrats, y=AFDC_TANF_inflation_adjusted)) + geom_point()+ scale_x_continuous(limits=c(0,1),breaks=seq(0, 1, 0.1))+ geom_smooth(method='gam', formula= y~x, se=TRUE, color="red")+ facet_wrap(~State)+ theme(text = element_text(family = "Arial"))+ labs(title = "Proportion of Democrats in the lower chamber vs. AFDC-TANF benefits", x="Proportion of Democrats in the Lower Chamber", y="Fitted Values of Inflation-Adjusted \n AFDC/TANF Benefits (in 2021 U.S. Dollars)")+ theme(axis.text=element_text(color="black",size=10))+ theme(axis.title.x = element_text (color = "black", size = 12,vjust=-2))+ theme(axis.title.y = element_text(color = "black", size=12, vjust=2)) + theme(panel.grid.major = element_line(colour="lightgray",linetype="dashed", linewidth=0.1),panel.background = element_rect(fill="white") ,panel.border = element_rect(color = "black", fill = NA))+ theme(plot.background=element_rect(fill="white"),plot.margin = unit(c(1, 1, 1, 1), "cm"))) ## Median value of each outcome across all state-years ---- ## these medians were used to standardize changes across policies by calculating percentage change relative to the median RedistrictingR_complete %>% summarize(median = median(AFDC_TANF_inflation_adjusted, na.rm =TRUE)) (2.11/657.1095)*100 RedistrictingR_complete %>% summarize(median = median(AFDC_TANF_recipients_percentage, na.rm =TRUE)) (-1.0272e-02/1.849478)*100 RedistrictingR_complete %>% summarize(median = median(Unemployment_inflation_adjusted, na.rm =TRUE)) (4.96/12904.84)*100 RedistrictingR_complete %>% summarize(median = median(Minimum_wage_inflation_adjusted, na.rm =TRUE)) (1.9290e-02/8.694676)*100 RedistrictingR_complete %>% summarize(median = median(Education_inflation_adjusted, na.rm =TRUE)) (10.96/4126.019)*100 RedistrictingR_complete %>% summarize(median = median(Medicaid_inflation_adjusted, na.rm =TRUE)) (2.33/432.2806)*100 RedistrictingR_complete %>% summarize(median = median(Ave_cash_food_benefits_inflation_adjusted, na.rm =TRUE)) round((2.33/7775.883)*100,3) ## Calculating effect of shift in vote-seat discrepancy ---- ## The average vote-seat shift in Republicans' favor was 7.2% between 1980 & 2019 & 5.31% between 1999 and 2018 (for the composite measure) ## These analyses calculate what that would correspond to for each outcome ### For each policy outcome, the formulas multiply 7.4% by the corresponding beta value from the Aim 2 analyses ### and divide by the median value across all state-years; for the safety net benefits, the multiplier is 5.31% ### AFDC-TANF benefits: $657.1095 #Ds ((7.4*-2.63)/657.1095)*100 #Rs ((7.4*-1.67)/657.1095)*100 ### AFDC-TANF recipients: 1.849478% #Ds ((7.4*0.02)/1.849478)*100 #Rs ((7.4*-0.01)/1.849478)*100 ### Unemployment benefits: $12904.84 #Ds ((7.4*50.46)/12904.84)*100 #Rs ((7.4*-19.10)/12904.84)*100 ### Minimum wage: $8.694676 #Ds ((7.4*9.4014e-03)/8.694676)*100 #Rs ((7.4*-2.8513e-02/8.694676))*100 ### Education: $4125.819 #Ds ((7.4*2.20)/4126.019)*100 #Rs ((7.4*-32.39)/4126.019)*100 ### Medicaid: $432.2806 #Ds ((7.4*0.76)/432.2806)*100 #Rs ((7.4*3.47)/432.2806)*100 ### Composite measure of safety net benefits: $7775.883 #Ds ((5.311991*1.68)/7775.883)*100 #Rs ((5.311991*0.53)/7775.883)*100 ## Confidence interval plots ---- ### Vote-seat discrepancy ---- #### Point estimates & lower & upper bounds for vote-seat discrepancy #### manually entered from the betas & CIs from the main Aim 1 and Aim 2 analyses above #### for each category in the CI figures in the manuscript (total effect, trifecta, divided, etc.) AFDC_TANF_point_estimates_vote<-formattable::digits(c((-2.61/657.1095)*100, (-0.72/657.1095)*100,(-3.13/657.1095)*100, (-2.63/657.1095)*100, (-0.41/657.1095)*100, (-3.08/657.1095)*100, (-1.67/657.1095)*100, (-1.62/657.1095)*100, (0.02/657.1095)*100, NA), digits = 2) AFDC_TANF_CI_lower<-c((-4.65/657.1095)*100,(-2.65/657.1095)*100, (-5.25/657.1095)*100,(-4.91/657.1095)*100,(-2.91/657.1095)*100, (-6.72/657.1095)*100, (-4.10/657.1095)*100,(-4.02/657.1095)*100,(-2.74/657.1095)*100, NA) AFDC_TANF_CI_upper<-c((-0.57/657.1095)*100, (1.22/657.1095)*100, (-1.01/657.1095)*100, (-0.34/657.1095)*100, (2.09/657.1095)*100, (0.57/657.1095)*100, (0.75/657.1095)*100, (0.79/657.1095)*100, (2.79/657.1095)*100,NA) AFDC_TANF_recipients_point_estimates_vote<-formattable::digits(c((8.9453e-03/1.849478)*100, (9.2274e-03/1.849478)*100,(4.2537e-03/1.849478)*100, (1.7360e-02/1.849478)*100, (1.2032e-02/1.849478)*100, (3.2190e-03/1.849478)*100, (-1.3685e-02/1.849478)*100, (9.6213e-04/1.849478)*100, (-1.3490e-02/1.849478)*100, NA), digits = 2) AFDC_TANF_recipients_CI_lower<-c((-8.982183e-03/1.849478)*100,(-1.199803e-02/1.849478)*100, (-1.893629e-02/1.849478)*100,(-6.088663e-03/1.849478)*100,(-1.218066e-02/1.849478)*100, (-2.286614e-02/1.849478)*100, (-3.665278e-02/1.849478)*100,(-1.970754e-02/1.849478)*100,(-3.531432e-02/1.849478)*100, NA) AFDC_TANF_recipients_CI_upper<-c((2.687276e-02/1.849478)*100, (3.045287e-02/1.849478)*100, (2.744362e-02/1.849478)*100, (4.080793e-02/1.849478)*100, (3.624423e-02/1.849478)*100, (2.930410e-02/1.849478)*100, (9.283661e-03/1.849478)*100, (2.163179e-02/1.849478)*100, (8.334975e-03/1.849478)*100,NA) Minimum_wage_point_estimates_vote<-formattable::digits(c((8.1090e-04/8.694676)*100, (-9.2475e-03/8.694676)*100, (4.0236e-03/8.694676)*100,(9.4014e-03/8.694676)*100,(3.3760e-03/8.694676)*100, (5.3361e-03/8.694676)*100,(-2.8513e-02/8.694676)*100,(-4.6453e-02/8.694676)*100,(2.2736e-02/8.694676)*100, NA),digits=2) Minimum_wage_CI_lower <- c((-1.852693e-02/8.694676)*100,(-3.411538e-02/8.694676)*100, (-1.775033e-02/8.694676)*100,(-9.709399e-03/8.694676)*100, (-2.443756e-02/8.694676)*100,(-1.124839e-02/8.694676)*100, (-6.004749e-02/8.694676)*100,(-9.268783e-02/8.694676)*100, (-1.890705e-02/8.694676)*100, NA) Minimum_wage_CI_upper <- c((2.014872e-02/8.694676)*100,(1.562040e-02 /8.694676)*100,(2.579745e-02/8.694676)*100,(2.851230e-02/8.694676)*100,(3.118956e-02/8.694676)*100,(0.0219205601/8.694676)*100,(3.020747e-03/8.694676)*100,(-2.173446e-04/8.694676)*100, (6.437918e-02/8.694676)*100, NA) Unemployment_point_estimates_vote<-formattable::digits(c((35.51/12904.84)*100,(2.54/12904.84)*100, (35.61/12904.84)*100, (50.46/12904.84)*100, (14.43/12904.84)*100, (67.74/12904.84)*100,(-19.10/12904.84)*100, (-32.51/12904.84)*100, (-0.94/12904.84)*100, NA), digits=2) Unemployment_CI_lower <- c((-0.7/12904.84)*100, (-45.18/12904.84)*100, (-8.12/12904.84)*100, (16.31/12904.84)*100, (-37.14/12904.84)*100, (19.81/12904.84)*100, (-84.63/12904.84)*100, (-111.78/12904.84)*100, (-60.90/12904.84)*100, NA) Unemployment_CI_upper <- c((71.73/12904.84)*100, (50.26/12904.84)*100, (79.34/12904.84)*100, (84.60/12904.84)*100, (66.00/12904.84)*100, (115.67/12904.84)*100,(46.43/12904.84)*100, (46.77/12904.84)*100, (62.77/12904.84)*100, NA) Education_point_estimates_vote<-formattable::digits(c((-4.55/4126.019)*100,(-7.19/4126.019)*100,(-11.86/4126.019)*100, (2.20/4126.019)*100, (8.73/4126.019)*100,(-0.05/4126.019)*100,(-32.39/4126.019)*100,(-54.13/4126.019)*100,(-13.60/4126.019)*100, NA), digits=2) Education_CI_lower <- c((-27.11/4126.019)*100,(-29.19/4126.019)*100, (-45.41/4126.019)*100,(-28.99/4126.019)*100,(-23.85/4126.019)*100, (-32.62/4126.019)*100,(-57.16/4126.019)*100,(-89.88/4126.019)*100,(-36.70/4126.019)*100, NA) Education_CI_upper <- c((18.01/4126.019)*100, (14.80/4126.019)*100,(21.69/4126.019)*100,(33.39/4126.019)*100,(41.32/4126.019)*100, (32.72/4126.019)*100, (-7.62/4126.019)*100,(-18.39/4126.019)*100, (9.51/4126.019)*100,NA) Medicaid_point_estimates_vote<-formattable::digits(c((2.26/432.2806)*100, (2.16/432.2806)*100, (2.92/432.2806)*100, (0.76/432.2806)*100, (1.93/432.2806)*100, (2.81/432.2806)*100, (3.47/432.2806)*100, (2.78/432.2806)*100, (3.28/432.2806)*100, NA), digits=2) Medicaid_CI_lower <- c((-1.03/432.2806)*100, (-1.93/432.2806)*100, (-0.67/432.2806)*100, (-2.87/432.2806)*100, (-3.39/432.2806)*100, (-2.11/432.2806)*100, (-0.38/432.2806)*100, (-0.36/432.2806)*100, (-0.77/432.2806)*100, NA) Medicaid_CI_upper <- c((5.56/432.2806)*100, (6.25/432.2806)*100, (6.51/432.2806)*100, (4.39/432.2806)*100, (7.24/432.2806)*100, (7.73/432.2806)*100,(7.32/432.2806)*100, (5.91/432.2806)*100, (7.73/432.2806)*100, NA) Safety_net_point_estimates_vote<-formattable::digits(c((-0.70/7775.883)*100, (-1.67/7775.883)*100, (-0.12/7775.883)*100, (-1.68/7775.883)*100, (-2.64/7775.883)*100, (2.70/7775.883)*100,(0.53/7775.883)*100, (0.38/7775.883)*100, (3.59/7775.883)*100, NA), digits=2) Safety_net_CI_lower <- c((-7.92/7775.883)*100, (-8.25/7775.883)*100, (-8.42/7775.883)*100, (-10.12/7775.883)*100, (-10.94/7775.883)*100, (-8.57/7775.883)*100, (-8.75/7775.883)*100, (-8.75/7775.883)*100, (-9.58/7775.883)*100, NA) Safety_net_CI_upper <- c((6.53/7775.883)*100, (4.91/7775.883)*100, (8.18/7775.883)*100, (6.77/7775.883)*100, (5.67/7775.883)*100, (13.98/7775.883)*100, (9.82/7775.883)*100, (9.52/7775.883)*100, (16.77/7775.883)*100, NA) #### Confidence interval plots par(mar = c(7, 5, 2, 0.5)) plotCI(1:10,AFDC_TANF_point_estimates_vote, ui=AFDC_TANF_CI_upper, li=AFDC_TANF_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="AFDC/TANF Benefits", col.main = "black", family = "Arial", font.main = 1,cex.main=3) title(ylab = "% Change in AFDC/TANF Benefits",family = "Arial", cex.lab = 1.8) axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(AFDC_TANF_point_estimates_vote, labels=AFDC_TANF_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,AFDC_TANF_recipients_point_estimates_vote, ui=AFDC_TANF_recipients_CI_upper, li=AFDC_TANF_recipients_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="AFDC/TANF Recipients", col.main = "black", family = "Arial", font.main = 1,cex.main=3) title(ylab = "% Change in AFDC/TANF Recipients",family = "Arial", cex.lab = 1.8) axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(AFDC_TANF_recipients_point_estimates_vote, labels=AFDC_TANF_recipients_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Minimum_wage_point_estimates_vote, ui=Minimum_wage_CI_upper, li=Minimum_wage_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Minimum Wage", col.main = "black", font.main = 1,cex.main=3,family = "Arial") title(ylab = "% Change in Minimum Wage",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Minimum_wage_point_estimates_vote, labels=Minimum_wage_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Unemployment_point_estimates_vote, ui=Unemployment_CI_upper, li=Unemployment_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Maximum Unemployment Benefits", col.main = "black", font.main = 1,cex.main=3,family = "Arial") title(ylab = "% Change in Maximum Unemployment Benefits",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta", "Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Unemployment_point_estimates_vote, labels=Unemployment_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Education_point_estimates_vote, ui=Education_CI_upper, li=Education_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Education Expenditures per Child", col.main = "black", font.main = 1,cex.main=3,family = "Arial") title(ylab = "% Change in Education Expenditures",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Education_point_estimates_vote, labels=Education_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10, Medicaid_point_estimates_vote, ui=Medicaid_CI_upper, li=Medicaid_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Medicaid Expenditures per Capita", col.main = "black", font.main = 1,cex.main=3,family = "Arial") title(ylab = "% Change in Medicaid Expenditures per Capita",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Medicaid_point_estimates_vote, labels=Medicaid_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Safety_net_point_estimates_vote, ui=Safety_net_CI_upper, li=Safety_net_CI_lower, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-1,1)) title(main="Composite Measure of Safety Net Benefits", col.main = "black", family = "Arial", font.main = 1,cex.main=3) title(ylab = "% Change in Bundle of Safety Net Benefits",family = "Arial", cex.lab = 1.8) axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta", "Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.0, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Safety_net_point_estimates_vote, labels=Safety_net_point_estimates_vote, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() ### Efficiency gap ---- ### Same analyses as for vote-seat discrepancy #### Point estimates & lower & upper bounds for efficiency gap AFDC_TANF_point_estimates_efficiency_gap<-round(c((-1.36/657.1095)*100, (-0.22/657.1095)*100, (-1.43/657.1095)*100, (-0.80/657.1095)*100, (0.23/657.1095)*100, (-0.32/657.1095)*100, (-2.36/657.1095)*100, (-2.39/657.1095)*100, (0.10/657.1095)*100, NA), digits=2) AFDC_TANF_CI_lower_efficiency_gap<-round(c((-3.25/657.1095)*100, (-2.47/657.1095)*100, (-2.55/657.1095*100), (-2.75/657.1095)*100, (-1.96/657.1095)*100, (-2.43/657.1095)*100, (-4.49/657.1095)*100, (-5.28/657.1095)*100,(-1.54/657.1095)*100, NA), digits = 2) AFDC_TANF_CI_upper_efficiency_gap<-round(c((0.52/657.1095)*100, (2.02/657.1095)*100, (-0.30/657.1095*100), (1.15/657.1095)*100, (2.42/657.1095)*100, (1.79/657.1095)*100, (-0.23/657.1095)*100, (-0.51/657.1095)*100, (1.74/657.1095)*100, NA), digits = 2) AFDC_TANF_recipients_point_estimates_efficiency_gap<-round(c((1.8144e-02/1.849478)*100, (2.2826e-02/1.849478)*100, (0.00027529/1.849478)*100, (2.4222e-02/1.849478)*100, (2.5585e-02/1.849478)*100, (1.3565e-02/1.849478)*100, (2.7335e-03/1.849478)*100, (9.5890e-03/1.849478)*100, (-1.0272e-02/1.849478)*100, NA), digits=2) AFDC_TANF_recipients_CI_lower_efficiency_gap<-round(c((1.215772e-03/1.849478)*100, (7.071384e-03/1.849478)*100, (-1.362115e-02/1.849478*100), (6.839256e-03/1.849478)*100, (9.357253e-03/1.849478)*100, (-5.261664e-03/1.849478)*100, (-1.952508e-02/1.849478)*100, (-1.078443e-02/1.849478)*100,(-2.104720e-02/1.849478)*100, NA), digits = 2) AFDC_TANF_recipients_CI_upper_efficiency_gap<-round(c((3.507173e-02/1.849478)*100, (3.857976e-02/1.849478)*100, (1.417174e-02/1.849478*100), (4.160444e-02/1.849478)*100, (4.181186e-02/1.849478)*100, (3.239230e-02/1.849478)*100, (2.499213e-02/1.849478)*100, (2.996236e-02/1.849478)*100, (5.022872e-04/1.849478)*100, NA), digits = 2) Minimum_wage_point_estimates_efficiency_gap<-round(c((2.0919e-02/8.694676)*100, (2.0169e-02/8.694676)*100, (1.1959e-02 /8.694676)*100, (2.0264e-02/8.694676)*100, (2.2381e-02/8.694676)*100, (1.5063e-02/8.694676)*100, (1.0105e-02/8.694676)*100, (9.5593e-03/8.694676)*100, (2.3321e-02/8.694676)*100, NA),digits=2) Minimum_wage_CI_lower_efficiency_gap<-round(c((9.692027e-03/8.694676)*100, (1.417008e-03/8.694676)*100, (-2.032820e-03/8.694676)*100, (9.965213e-03/8.694676)*100, (3.597806e-03/8.694676)*100, (3.647447e-03/8.694676)*100, (-1.341342e-02/8.694676)*100,(-2.945426e-02/8.694676)*100, (3.417736e-04/8.694676)*100, NA),digits=2) Minimum_wage_CI_upper_efficiency_gap<-round(c((3.214630e-02/8.694676)*100, (0.0389215027/8.694676)*100, (2.595147e-02/8.694676)*100, (3.056185e-02/8.694676)*100, (4.116390e-02/8.694676)*100, (2.647786e-02/8.694676)*100,(3.362310e-02/8.694676)*100,(4.857278e-02/8.694676)*100,(4.630022e-02/8.694676)*100, NA),digits=2) Unemployment_point_estimates_efficiency_gap<-round(c((26.31/12904.84)*100, (25.26/12904.84)*100, (-0.57/12904.84)*100, (28.29/12904.84)*100, (33.45/12904.84)*100, (33.23/12904.84)*100, (-26.47/12904.84)*100, (-14.07/12904.84)*100, (-14.98/12904.84)*100, NA), digits=2) Unemployment_CI_lower_efficiency_gap<-round(c((5.19/12904.84)*100,(-5.75/12904.84)*100, (-19.44/12904.84)*100, (9.45/12904.84)*100, (0.58/12904.84)*100, (5.59/12904.84)*100, (-65.61/12904.84)*100, (-69.84/12904.84)*100, (-56.45/12904.84)*100, NA), digits=2) Unemployment_CI_upper_efficiency_gap<-round(c((47.42/12904.84)*100,(56.26/12904.84)*100, (18.30/12904.84)*100, (47.12/12904.84)*100, (69.84/12904.84)*100, (60.87/12904.84)*100, (12.67/12904.84)*100, (41.70/12904.84)*100, (26.48/12904.84)*100, NA), digits=2) Education_point_estimates_efficiency_gap<-round(c((15.64/4126.019)*100,(18.95/4126.019)*100, (-3.48/4126.019)*100, (11.19/4126.019)*100, (22.81/4126.019)*100,(-9.66/4126.019)*100,(3.04/4126.019)*100,(-0.41/4126.019)*100, (10.96/4126.019)*100, NA), digits=2) Education_CI_lower_efficiency_gap<-round(c((-11.70/4126.019)*100, (-16.08/4126.019)*100, (-15.54/4126.019)*100, (-17.08/4126.019)*100,(-13.52/4126.019)*100,(-18.87/4126.019)*100,(-26.12/4126.019)*100,(-36.50/4126.019)*100, (1.18/4126.019)*100, NA), digits=2) Education_CI_upper_efficiency_gap<-round(c((42.97/4126.019)*100, (53.98/4126.019)*100, (8.59/4126.019)*100,(39.46/4126.019)*100, (59.15/4126.019)*100,(38.18/4126.019)*100,(32.21/4126.019)*100, (37.32/4126.019)*100,(23.11/4126.019)*100, NA), digits=2) Medicaid_point_estimates_efficiency_gap<-round(c((1.88/432.2806)*100, (1.09/432.2806)*100,(0.92/432.2806)*100, (0.97/432.2806)*100, (0.88/432.2806)*100, (3.36/432.2806)*100, (1.51/432.2806)*100, (2.05/432.2806)*100, (-2.33/432.2806)*100, NA), digits=2) Medicaid_CI_lower_efficiency_gap<-round(c((-0.15/432.2806)*100, (-1.63/432.2806)*100, (-0.45/432.2806)*100, (-0.98/432.2806)*100, (-1.82/432.2806)*100, (-0.92/432.2806)*100, (-0.70/432.2806)*100, (-1.54/432.2806)*100, (-4.86/432.2806)*100, NA),digits=2) Medicaid_CI_upper_efficiency_gap<-round(c((3.60/432.2806)*100, (3.80/432.2806)*100, (2.28/432.2806)*100, (2.93/432.2806)*100, (3.57/432.2806)*100, (7.64/432.2806)*100, (3.72/432.2806)*100, (5.63/432.2806)*100, (0.18/432.2806)*100, NA),digits=2) Safety_net_point_estimates_efficiency_gap<-formattable::digits(c((-1.13/7775.883)*100, (2.34/7775.883)*100,(-0.07/7775.883)*100, (-2.01/7775.883)*100, (2.08/7775.883)*100, (2.26/7775.883)*100, (0.98/7775.883)*100, (3.71/7775.883)*100, (-2.26/7775.883)*100, NA), digits=2) Safety_net_CI_lower_efficiency_gap<-c((-4.94/7775.883)*100, (-3.33/7775.883)*100, (-3.59/7775.883)*100, (-6.38/7775.883)*100, (-4.15/7775.883)*100, (-5.84/7775.883)*100, (-4.92/7775.883)*100, (-3.99/7775.883)*100, (-13.25/7775.883)*100, NA) Safety_net_CI_upper_efficiency_gap<-c((2.67/7775.883)*100, (8.01/7775.883)*100, (3.45/7775.883)*100, (2.36/7775.883)*100, (8.31/7775.883)*100, (10.35/7775.883)*100, (6.88/7775.883)*100, (11.41/7775.883)*100, (8.74/7775.883)*100, NA) #### Confidence interval plots plotCI(1:10,AFDC_TANF_point_estimates_efficiency_gap, li = AFDC_TANF_CI_lower_efficiency_gap, ui= AFDC_TANF_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="AFDC/TANF Benefits", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.50, cex=1.2,family = "Arial") title(ylab = "% Change in AFDC/TANF Benefits",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(AFDC_TANF_point_estimates_efficiency_gap, labels=AFDC_TANF_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,AFDC_TANF_recipients_point_estimates_efficiency_gap, li = AFDC_TANF_recipients_CI_lower_efficiency_gap, ui= AFDC_TANF_recipients_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="AFDC/TANF Recipients", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.50, cex=1.2,family = "Arial") title(ylab = "% Change in AFDC/TANF Benefits",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(AFDC_TANF_recipients_point_estimates_efficiency_gap, labels=AFDC_TANF_recipients_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Minimum_wage_point_estimates_efficiency_gap, li = Minimum_wage_CI_lower_efficiency_gap, ui = Minimum_wage_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Minimum Wage", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.75, cex=1.2,family = "Arial") title(ylab = "% Change in Minimum Wage",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Minimum_wage_point_estimates_efficiency_gap, labels=Minimum_wage_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Unemployment_point_estimates_efficiency_gap, li = Unemployment_CI_lower_efficiency_gap, ui = Unemployment_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Maximum Unemployment Benefits", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.75, cex=1.2,family = "Arial") title(ylab = "% Change in Maximum Unemployment Benefits",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Unemployment_point_estimates_efficiency_gap, labels=Unemployment_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10,Education_point_estimates_efficiency_gap, li = Education_CI_lower_efficiency_gap, ui = Education_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Education Expenditures per Child", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.75, cex=1.2,family = "Arial") title(ylab = "% Change in Education Expenditures",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Education_point_estimates_efficiency_gap, labels=Education_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10, Medicaid_point_estimates_efficiency_gap, li = Medicaid_CI_lower_efficiency_gap, ui = Medicaid_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-2,2)) title(main="Medicaid Expenditures per Capita", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.75, cex=1.2,family = "Arial") title(ylab = "% Change in Medicaid Expenditures per Capita",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Medicaid_point_estimates_efficiency_gap, labels=Medicaid_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid() plotCI(1:10, Safety_net_point_estimates_efficiency_gap, li = Safety_net_CI_lower_efficiency_gap, ui = Safety_net_CI_upper_efficiency_gap, pch=1, lwd = 3,lty=1, col = "black", xlab = "", ylab = "",bty = "L",xaxt = "n", ylim=c(-1,1)) title(main="Bundle of Safety Net Benefits", col.main = "black", font.main = 1,cex.main=3,family = "Arial") #mtext("Efficiency Gap",3,-0.75, cex=1.2,family = "Arial") title(ylab = "% Change in Safety Net Benefits",cex.lab = 1.8,family = "Arial") axis(1, at=1:10, lab=c("Total Partisan Bias","Divided", "Trifecta","Pro-D","Pro-D/Divided","Pro-D/D Trifecta","Pro-R","Pro-R/Divided","Pro-R/R Trifecta",""),cex.axis=1.2, col="black",family = "Arial") abline(h=0) abline (v = 3.5, col = "black", lwd=3, lty=3) abline (v = 6.5, col = "black", lwd=3, lty=3) text(Medicaid_point_estimates_efficiency_gap, labels=Medicaid_point_estimates_efficiency_gap, cex=1.5, pos=4, col="black",family = "Arial") mtext ("Non-Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=2, cex=1.8,family = "Arial") mtext ("Directional \n Vote-Seat Discrepancy", side=1, line = 4.5, at=6.5, cex=1.8,family = "Arial") grid()