Border Lines—Part 1

With the midterm elections last week, it has been hard to avoid the analysis and interpretation of what the results might mean. Like many, my attention was captured by the drama surrounding control of the U.S. House of Representatives and which party would control it for the next two years. Some states like Vermont and Montana have a single federal congressional district, but for the 44 other states, every election is consequential because of its bearing on who controls how the new boundaries are drawn following the 2020 Decennial Census.

I downloaded the most recent congressional district boundaries from the Census Cartographic Boundary Files site and started poking around. The main things to know about congressional districts is that they are ideally contiguous and contain roughly the same number of people. The latter criterion ensures that everyone’s vote carries the same weight and the contiguity criterion is designed as a check on partisan gerrymandering.

The Polsby-Popper ratio has been widely used to measure the compactness of electoral geographies and part of its appeal is its simplicity. The PPR is (4π * A) / P2 where A is the area of a district and P its perimeter. Districts with a Polsby-Popper ratio closer to one are more compact or regular, while values closer to zero are irregular and perhaps, more sinister. Here is a quick map of current federal congressional districts shaded according to the Polsby-Popper ratio.

District_PPR_115th Congress

The red and orange areas really stand out, but are not necessarily where I expected them to be. One of the problems with relying on statistics like this in isolation is that they can give a biased perspective. Coastal districts with complex boundary lines (e.g., North Carolina’s Outer Banks, New Orleans, the Boundary Waters area of Minnesota) are potentially the victims of geography rather than the result of political maneuvering.

We can also consider how well the population criterion is met with a map like the one below.

District_TOTPOP_115th Congress

With a range of just under 25,000 people, the degree to which these districts contain a comparable number of voters is debatable. But what is most interesting to me in this one is the obvious regional pattern in the population size of congressional districts. Sunbelt migration aside, areas like east Texas are not population centers. Yes the states exert significant influence on how redistricting is done, but are the political parameters surrounding redistricting in the Deep South really similar to those in California and the Northeast? Who lives in the most irregular congressional districts in America? How have the boundaries of these individual districts changed over the years? Which party drew these districts and which party won these districts in subsequent elections? I have so many questions, but they will have to wait until a later blog post. Here’s the code for the map.


# Visit this site to request an API key --->
# Only need to load your API key once...
# census_api_key("YOURCENSUSAPIKEYHERE", overwrite=TRUE, install = TRUE)

# Download the population etsimate for all congressional districts using the tidycensus package
# This example uses the ACS 1-Year Estimates for 2017
cdists.2017 <- get_acs(geography = "congressional district", variables = "B00001_001E", geometry = FALSE,
survey= "acs1", year = 2017)
cdists.2017 <- subset(cdists.2017, select=-variable)
colnames(cdists.2017) <- c("GEOID", "NAME", "TOTPOP")

# Specify the map projection we want to use
North_America_Albers_Equal_Area_Conic <- "+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs"

# Congressional districts are not yet supported by the Census API, so
# download the shapefile directly
download.file("" , destfile="")
districts <- readOGR(".", "cb_2017_us_cd115_500k")

# Limit analysis to the contiguous states and Washington DC
noncontig <- c("02", "60", "66", "15", "72", "78", "69")
'%nin%' = Negate('%in%')
districts <- districts[districts$STATEFP %nin% noncontig, ]

# Project the polygons and calculate Polsby-Popper
districts <- spTransform(districts, CRS(North_America_Albers_Equal_Area_Conic))
districts$Area_SqM <- OasisR::area(districts)
districts$Perimeter_M <- OasisR::perimeter(districts)
districts$PPR <- (4 * pi * districts$Area_SqM) / (districts$Perimeter_M * districts$Perimeter_M )

# Join the population data
attributes <- districts@data
attributes.merged <- merge(attributes, cdists.2017, by="GEOID", all.x=TRUE)
base <- districts
base@data <- data.frame(base@data[,"GEOID"])
colnames(base@data) <- "GEOID"
districts.all <- merge(base, attributes.merged, by.x = "GEOID", by.y = "GEOID")

# Districts with a Polsby-Popper ratio closer to one are more compact

one.district.states <- c("50", "38", "46", "10", "30", "11", "56")

districts.mult <- districts.all[districts.all$STATEFP %nin% one.district.states, ]
districts.sf <- st_as_sf(districts.mult)

ggplot(data = districts.sf) +
geom_polygon(data = districts.all, aes(x=long, y=lat, group=group),
fill="white", color="grey50", size=0.25) +
geom_sf(aes(fill=PPR)) +
coord_sf(datum = NA) +
theme_map() +
theme(legend.position="bottom") +
theme(legend.key.width=unit(2, "cm")) +
ggtitle(label = "Polsby-Popper Ratio", subtitle = "115th Congress") +
theme(plot.title = element_text(lineheight=.8, face="bold")) +
labs(caption = "Note: Polygons in white are states with a single Congressional district.") +
scale_fill_gradientn(colours = c("red", "yellow", "green", "lightblue", "darkblue"),
limits=c(min(districts.sf$PPR), max(districts.sf$PPR)))

ggsave(paste0("District_PPR_115th Congress.png"), width = 11, height = 8)

# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s