3.2 Category 1 Variable 2: Percentage of Population with Income Below Poverty Level
3.2.1 Percentage of Population below Poverty Level Map
colorBin("PuRd", metadataGIS$perc_below_pov, n = 7, reverse=FALSE)
pal <-
leaflet(metadataGIS, options = leafletOptions(crsClass = "L.CRS.EPSG3857"), width="100%") %>%
addPolygons(weight = 0.5, color = "gray", opacity = 0.7,
fillColor = ~pal(perc_below_pov), fillOpacity = 1, smoothFactor = 0.5,
label = popupPlus("Percent of People below Poverty Level", metadataGIS$perc_below_pov, "percentage"),
labelOptions = labelOptions(direction = "auto")) %>%
addPolygons(data = stateGIS,fill = FALSE,color="black",weight = 1) %>%
addLegend(pal = pal,values = ~metadataGIS$perc_below_pov, opacity = 1, title = "% Below Poverty",position = "bottomright")
3.2.2 Scatterplot of % of Population Under Poverty Level and % of GOP Votes in a county
ggplot(metadata,aes(x=perc_below_pov,y=pctGOP*100,size=totalVotes))+
geom_point(alpha=.2,color="Purple")+
geom_smooth(method="lm",color="Black",alpha=.8, show.legend = FALSE)+
geom_smooth(method="loess",color="red",alpha=.8, show.legend = FALSE)+
labs(title="Population below poverty level as an explaination for Voting Patterns",x="Population Below Poverty Level",y="Population who voted GOP (%)", size = "Total Votes")
3.2.3 Summary Table for Regression of % of Population Under Poverty Level
.2<-lm(pctGOP~perc_below_pov,data=metadata)
model4stargazer(model4.2,
type = "html",
report=('vc*p'),
keep.stat = c("n","rsq","adj.rsq"),
notes = "<em>*p<0.1;**p<0.05;***p<0.01</em>",
notes.append = FALSE)
Dependent variable: | |
pctGOP | |
perc_below_pov | -0.003*** |
p = 0.00000 | |
Constant | 0.698*** |
p = 0.000 | |
Observations | 3,108 |
R2 | 0.009 |
Adjusted R2 | 0.008 |
Note: | *p<0.1;**p<0.05;***p<0.01 |