6.2 Category 4 Variable 2: Renting Percentage
6.2.1 Map of Renting Percentage in the United States
colorBin("Oranges", metadataGIS$perc_rent, 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_rent), fillOpacity = 1, smoothFactor = 0.5,
label = popupPlus("Percent of People who rent", metadataGIS$perc_rent, "percentage"),
labelOptions = labelOptions(direction = "auto")) %>%
addPolygons(data = stateGIS,fill = FALSE,color="black",weight = 1) %>%
addLegend(pal = pal,values = ~metadataGIS$perc_rent, opacity = 1, title = "People who Rent(%)",position = "bottomright")
6.2.2 Graph and Regression of Rent % and % of GOP Votes
ggplot(metadata,aes(x=perc_rent,y=pctGOP*100,size=totalVotes))+
geom_point(alpha=.2,color="Blue")+
geom_smooth(method="lm",color="Black",alpha=.8,show.legend = FALSE)+
geom_smooth(method="loess",color="red",alpha=.8,show.legend = FALSE)+
labs(title="Renters as an explainatory variable for Voting Patterns",x="People who rent (%)",y="People who voted GOP (%)", size = "Total Votes")
.2<-lm(pctGOP~perc_rent,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_rent | -0.023*** |
p = 0.000 | |
Constant | 0.913*** |
p = 0.000 | |
Observations | 3,108 |
R2 | 0.195 |
Adjusted R2 | 0.194 |
Note: | *p<0.1;**p<0.05;***p<0.01 |