Dissimilarity Index

Marcelino Guerra

Last update: 04/20/2021

Getting data for Champaign-IL

This exercise will use data from Champaign-IL neighborhoods that come from the American Community Survey 5-year estimates (2015-2019). The first step is to load the "acs5" variables and find the codes related to racial composition information.

library(tidyverse)
library(tidycensus)
var_2019<-load_variables(2019, "acs5")
#View(var_2019)

Use View(var_2019) to find the ones related to total, white, and black populations. You are looking concept RACE and labels “Estimate!!Total:”, “Estimate!!Total:!!White alone” and “Estimate!!Total:!!Black or African American alone”. There you have Blacks and Whites who declared a single race. It is important to note that people who identify their origin as Hispanic, Latino, or Spanish may be of any race.

The get_acs() with geometry=T allows you to get coordinates and make maps. I set geography="tract" to use data from census tracts (treated as neighborhoods here).

chambana <-get_acs(geography = "tract", 
                   variables = c(total="B02001_001",
                                 black="B02001_003", 
                                 white="B02001_002"), 
                   state = "IL",
                   county="Champaign County",
                   geometry = TRUE,
                   year=2019,
                   output="wide")
View(chambana)

The following code sets the shares of whites and blacks in each census tract in Champaign County.

chambana<-chambana%>%
          mutate(black_share=blackE/totalE,white_share=whiteE/totalE)

max(chambana$black_share)
## [1] 0.7498664

As one can see, there are no ghettos in Champaign when setting the threshold as 80% of minority share.

Mapping the share of blacks in Champaign-IL

And here is the map with the percentages of black population within the county:

library(tmap)
tmap_mode("view")
tm_shape(chambana)+tm_borders(lwd = 1.2, col = "white", alpha = .4)+
  tm_polygons("black_share", breaks=c(0,.2,.4,.6,.8,1), alpha=0.7,palette = "YlGnBu", 
              title="Share of Black Population",id="NAME",
              popup.vars=c("Share of Black Population"="black_share", "Share of White Population"="white_share", "Total Population"="totalE" ))+
  tm_legend(legend.title.size = 1.7,legend.text.size = 1, legend.position = c("left", "bottom"))+
  tm_basemap(server="OpenStreetMap",alpha=0.5)

Calculating the RDI for Champaign-IL

Here is the Racial Dissimilarity Index formula:

\[ RDI= \frac{1}{2}\sum_{i=1}^{n} |\underbrace{\frac{black_{i}}{black_{total}}}_\text{X}-\underbrace{\frac{white_{i}}{white_{total}}}_\text{Y}| \]

where \(\frac{black_{i}}{black_{total}}\) is the number of black people in a tract divided by the total of blacks in the area (in our case, the entire county). \(\frac{white_{i}}{white_{total}}\) is the number of whites in a neighborhood divided by the total of whites in the county. Take the absolute value of this difference for each census tract. Then, sum all those numbers and multiply by .5.

Note that this formula is different from White to Non-White Racial Dissimilarity Index calculated by FRED. If you replace blacks with nonwhites in the formula above, you get very similar numbers to FRED data. To get the nonwhites, you need to take the difference between the total population and the white population.

tot_white<-sum(chambana$whiteE)
tot_black<-sum(chambana$blackE)
#chambana$non_white<-chambana$totalE-chambana$whiteE
#tot_nonwhite<-sum(chambana$non_white)

chambana$X<-chambana$blackE/tot_black
#chambana$X<-chambana$non_white/tot_nonwhite
chambana$Y<-chambana$whiteE/tot_white
DI<-.5*sum(abs(chambana$X-chambana$Y))
DI*100
## [1] 47.57606

The RDI for Champaign-IL county in 2015-2019 is 47.57.