5.1 Category 3 Variable 1: Percentage of People without High School Diploma

5.1.1 Map of % of People without High School Diploma in the United States

pal <- colorNumeric(
  palette = "GnBu", 
  domain = metadataGIS$perc_hs, reverse=FALSE)

leaflet(metadataGIS, options = leafletOptions(crsClass = "L.CRS.EPSG3857"), width="100%") %>%
  addPolygons(weight = 0.5, color = "gray", opacity = 0.7,
    fillColor = ~pal(perc_hs), fillOpacity = 1, smoothFactor = 0.5,
    label = popupPlus("% without HS", metadataGIS$perc_hs, "percentage"),
    labelOptions = labelOptions(direction = "auto")) %>%
    addPolygons(data = stateGIS,fill = FALSE,color="black",weight = 1) %>%
    addLegend(pal = pal,values = ~metadataGIS$perc_hs, opacity = 0.7, title = "% without HS",position = "bottomright")

5.1.2 Scatterplot of % of People without High School Diploma and % of GOP Votes in a county

ggplot(metadata, aes(perc_hs, pctGOP*100), color = "#666666", alpha = 0.2) +
  geom_point(color = "coral", alpha = 0.2) +
    geom_histogram(aes(perc_hs, ..count../50), alpha = 0.2, color = "#33A02B", fill ="#B2DF8A" ) +
  geom_smooth(method = "lm", color="Black",alpha=.8, show.legend = FALSE) +
  geom_smooth(method = "loess", color = "red") +
  labs(title="Regression People without high school diploma on vote for GOP", x= "People without high school diploma(%)", y= "Vote for GOP(%)", caption = "Histogram of the variable at the bottom, not scaled to the y axis.")+
  theme_bw()

5.1.3 Summary Table for Regression of % of People without High School Diploma

model2.1 <- lm(pctGOP~perc_hs,data=metadata)
stargazer(model2.1, 
          type = "html", 
          report=('vc*p'),
          keep.stat = c("n","rsq","adj.rsq"), 
          notes = "<em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>", 
          notes.append = FALSE)
Dependent variable:
pctGOP
perc_hs 0.003***
p = 0.000
Constant 0.619***
p = 0.000
Observations 3,108
R2 0.015
Adjusted R2 0.015
Note: *p<0.1;**p<0.05;***p<0.01