sapply(c('devtools','here','tidyverse'), require, character.only=T)
knitr::opts_knit$set(root.dir = here())
load_all()

Is the by-county sum of divergence scores calculated wrt the bay area the same as the average of their within and between scores? if weighted by population?

First, original part 3 equation, but using bay instead of cbsa

div <- bay_race %>%
  mutate(div  = divergence(white,black,hispanic,asian)) %>% 
  group_by(county) %>% summarize(div = sum(div * (white+black+hispanic+asian)/
      sum(white+black+hispanic+asian)))

try with decomp

div2 <- bay_race %>% select(hispanic:asian, county) %>% group_by(county) %>% 
  decompose_divergence() %>% 
  mutate(sum = within + between)


arthurgailes/rsegregation documentation built on May 23, 2021, 6:33 a.m.