# change target metro and peers here
# target_cbsa <- "19740"
target_cbsa <- "31140"
# peer_cbsa <- c("35620", "16980", "31080", "47900")
peer_cbsa <- c("13820","16740","17140","18140","24660","26900","28140","34980", "36540", "32820")
# peer_cbsa <- c("12420", "33460", "38060", "38900", "41740", "41620", "42660")

# get counties
target_co <- (county_cbsa_st %>%
  filter(cbsa_code == target_cbsa) )[["stco_code"]]

peer_co <- (county_cbsa_st %>%
  filter(cbsa_code %in% peer_cbsa) )[["stco_code"]]

# filter datasets
cbsa_output <- cbsa_all %>%
  filter(cbsa_code %in% c(target_cbsa, peer_cbsa)) %>%
  left_join(county_cbsa_st[c("cbsa_code", "cbsa_emp")], by = "cbsa_code") %>%
  unique()

# make it a shiny app!
# selectInput("target_cbsa", "", )

Dynamism

Shift share (job change by industry above/below national average)–for metro

It’s easier to get from EMSI directly: Industry - Inustry Table - Shiftshare. You can toggle between different industry levels

Tradable share of employment–metro and peers

emp <- read_csv("../../_metro_data_warehouse/data_raw/CBP EMP/efsy_cbp_2016.csv")

emp %>%
  mutate(stco_code = paste0(str_pad(fipstate, 2, "left", "0"), str_pad(fipscty,3,"left",0))) %>%
  filter(stco_code %in% c(target_co, peer_co)) %>%
  left_join(metro.data::naics6_traded, by = c("naics" = "code_naics6_2017")) %>%
  filter(!is.na(traded.naics6)) %>%
  left_join(county_cbsa_st[c("stco_code", "cbsa_code", "cbsa_name")]) %>%
  group_by(cbsa_code, cbsa_name,traded.naics6 ) %>%
  summarise(emp = sum(emp)) %>%
  pivot_wider(names_from = "traded.naics6", values_from = "emp") %>%
  mutate(pct_traded = Traded/(Traded+Local)) %>%
  knitr::kable()
cbsa_code cbsa_name Local Traded pct_traded
13820 Birmingham-Hoover, AL 312514 119670 0.2768960
16740 Charlotte-Concord-Gastonia, NC-SC 679092 348580 0.3391938
17140 Cincinnati, OH-KY-IN 591205 336021 0.3623939
18140 Columbus, OH 562781 295833 0.3445471
24660 Greensboro-High Point, NC 198770 117291 0.3711024
26900 Indianapolis-Carmel-Anderson, IN 575627 303785 0.3454410
28140 Kansas City, MO-KS 601578 326737 0.3519678
31140 Louisville/Jefferson County, KY-IN 367578 194084 0.3455530
32820 Memphis, TN-MS-AR 365153 168990 0.3163760
34980 Nashville-Davidson–Murfreesboro–Franklin, TN 535153 291923 0.3529579
36540 Omaha-Council Bluffs, NE-IA 266871 148215 0.3570706

Change in share of employment in Advanced Industries–metro and peers

emp06 <- read_csv("../../_metro_data_warehouse/data_raw/CBP EMP/efsy_cbp_2006.csv")

pct_ai <- function(df)df%>%
  mutate(stco_code = paste0(str_pad(fipstate, 2, "left", "0"), str_pad(fipscty,3,"left",0))) %>%
  filter(stco_code %in% c(target_co, peer_co)) %>%
  mutate(naics = gsub("\\/", "", naics))%>%
  filter(str_length(naics)== 4)%>%
  left_join(metro.data::naics4_ai, by = c("naics" = "naics4_code")) %>%
  mutate(is.ai = ifelse(is.na(naics4_aitype), NA, 1))%>%
  left_join(county_cbsa_st[c("stco_code", "cbsa_code", "cbsa_name")]) %>%
  group_by(cbsa_code, cbsa_name,is.ai) %>%
  summarise(emp = sum(emp)) %>%
  pivot_wider(names_from = "is.ai", values_from = "emp") %>%
  mutate(pct_ai = `1`/(`1`+`NA`)) %>%
  select(cbsa_code, cbsa_name, pct_ai)

pct_ai(emp06)%>%
  rename(pct_ai_06 = pct_ai)%>%
  left_join(pct_ai(emp), by = c("cbsa_code", "cbsa_name")) %>%
  knitr::kable()
cbsa_code cbsa_name pct_ai_06 pct_ai
13820 Birmingham-Hoover, AL 0.0881043 0.0873591
16740 Charlotte-Concord-Gastonia, NC-SC 0.0881569 0.0898580
17140 Cincinnati, OH-KY-IN 0.0968568 0.0914242
18140 Columbus, OH 0.0921319 0.0832840
24660 Greensboro-High Point, NC 0.0741018 0.0803745
26900 Indianapolis-Carmel-Anderson, IN 0.1042892 0.1035331
28140 Kansas City, MO-KS 0.1006752 0.1176457
31140 Louisville/Jefferson County, KY-IN 0.0864373 0.0957105
32820 Memphis, TN-MS-AR 0.0524400 0.0553771
34980 Nashville-Davidson–Murfreesboro–Franklin, TN 0.0954992 0.0777788
36540 Omaha-Council Bluffs, NE-IA 0.0702365 0.0735086

R&D per 1,000 workers–metro and peers

Annual average R&D expenditure at higher education institutions per 1000 workers, 2012 - 2016 (plots can be generated for other tables as well, if needed)

cbsa_output %>%
  select(cbsa_code, cbsa_name, rd_total, cbsa_emp) %>%
  mutate(rd_per_1000worker = rd_total/cbsa_emp * 1000/5) %>%
  knitr::kable()
cbsa_code cbsa_name rd_total cbsa_emp rd_per_1000worker
13820 Birmingham-Hoover, AL Metro Area 2195530.9 436077 1006.9464
16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 196464.6 1058398 37.1249
17140 Cincinnati, OH-KY-IN Metro Area 2104942.5 946308 444.8747
18140 Columbus, OH Metro Area 3708114.7 874951 847.6165
24660 Greensboro-High Point, NC Metro Area 265721.8 323805 164.1246
26900 Indianapolis-Carmel-Anderson, IN Metro Area 1020124.2 911388 223.8617
28140 Kansas City, MO-KS Metro Area 1512807.6 954263 317.0630
31140 Louisville/Jefferson County, KY-IN Metro Area 918709.5 577816 317.9938
32820 Memphis, TN-MS-AR Metro Area 559642.9 539734 207.3773
34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 3187781.5 855849 744.9402
36540 Omaha-Council Bluffs, NE-IA Metro Area 828706.9 419890 394.7257
quick_bar(cbsa_output, "rd_total",HL = target_cbsa, wt = T, scale = 200)

Do we have rankings for UofL by research focus similar to UAB stats?

Annual R&D expenditure at UofL, thousand US dollar

load("univ_rd_detail/univ_rd_18.rda")

univ_rd_18 %>%
  filter(stco_code %in% target_co) %>%
  select(year, univ_name, field_broad, field_detail, total_rd)%>%
  unique()%>%
  filter(field_detail == "Total") %>%
  pivot_wider(names_from = "year", values_from = "total_rd") %>%
  DT::datatable()

Startups launched at universities–metro and peers

Number of start-ups launched at universities, 2006 - 2017

cbsa_output %>%
  select(cbsa_code, cbsa_name, tot_st) %>%
  knitr::kable()
cbsa_code cbsa_name tot_st
1 13820 Birmingham-Hoover, AL Metro Area 6
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 4
18 17140 Cincinnati, OH-KY-IN Metro Area 5
34 18140 Columbus, OH Metro Area 9
44 24660 Greensboro-High Point, NC Metro Area 0
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area NA
58 28140 Kansas City, MO-KS Metro Area 0
72 31140 Louisville/Jefferson County, KY-IN Metro Area 5
82 32820 Memphis, TN-MS-AR Metro Area 0
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 12
103 36540 Omaha-Council Bluffs, NE-IA Metro Area 0

INC 5000 high growth companies–metro and peers

Number of Inc.5000 high growth companies per 1M workers, 2011 - 2017

cbsa_output %>%
  select(cbsa_code, cbsa_name, i5hgc_density) %>%
  knitr::kable()
cbsa_code cbsa_name i5hgc_density
1 13820 Birmingham-Hoover, AL Metro Area 78.0
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 114.4
18 17140 Cincinnati, OH-KY-IN Metro Area 104.9
34 18140 Columbus, OH Metro Area 117.2
44 24660 Greensboro-High Point, NC Metro Area 66.3
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area 111.4
58 28140 Kansas City, MO-KS Metro Area 99.3
72 31140 Louisville/Jefferson County, KY-IN Metro Area 88.3
82 32820 Memphis, TN-MS-AR Metro Area 46.7
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 152.5
103 36540 Omaha-Council Bluffs, NE-IA Metro Area 96.7

Startups per 1,000 workers–metro and peers

load("../crunchbase/cb-result/data/cb_cbsa_index.rda")

index %>%
  filter(cbsa_code %in% c(target_cbsa, peer_cbsa))%>%
  select(cbsa_code, cbsa_name, msa_total, SCI = div) %>%
  unique()%>%
  left_join(cbsa_output[c("cbsa_code", "cbsa_emp")], by = "cbsa_code") %>%
  mutate(startup_per_million = msa_total/cbsa_emp*1000000)%>%
  knitr::kable()
cbsa_code cbsa_name msa_total SCI cbsa_emp startup_per_million
31140 Louisville/Jefferson County, KY-IN 5 24.88571 577816 8.653274
34980 Nashville-Davidson–Murfreesboro–Franklin, TN 317 72.66204 855849 370.392441
28140 Kansas City, MO-KS 166 60.14050 954263 173.956236
18140 Columbus, OH 255 65.20317 874951 291.444892
32820 Memphis, TN-MS-AR 52 41.88420 539734 96.343755
13820 Birmingham-Hoover, AL 42 36.08807 436077 96.313266
16740 Charlotte-Concord-Gastonia, NC-SC 197 59.92288 1058398 186.130359
36540 Omaha-Council Bluffs, NE-IA 19 26.96706 419890 45.249946
17140 Cincinnati, OH-KY-IN 205 64.96580 946308 216.631372
26900 Indianapolis-Carmel-Anderson, IN 170 52.80212 911388 186.528679

Skills

% of population 25+ with AA/BA–metro and peers

cbsa_output %>%
  select(cbsa_code, cbsa_name, pct_edu_associate, pct_edu_baplus)%>%
  knitr::kable()
cbsa_code cbsa_name pct_edu_associate pct_edu_baplus
1 13820 Birmingham-Hoover, AL Metro Area 0.084 0.296
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 0.090 0.346
18 17140 Cincinnati, OH-KY-IN Metro Area 0.084 0.330
34 18140 Columbus, OH Metro Area 0.075 0.361
44 24660 Greensboro-High Point, NC Metro Area 0.088 0.289
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area 0.078 0.339
58 28140 Kansas City, MO-KS Metro Area 0.076 0.365
72 31140 Louisville/Jefferson County, KY-IN Metro Area 0.084 0.286
82 32820 Memphis, TN-MS-AR Metro Area 0.070 0.277
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 0.073 0.348
103 36540 Omaha-Council Bluffs, NE-IA Metro Area 0.089 0.358

Employment-to-population ratio 18-64–metro and peers

cbsa_output %>% 
  select(cbsa_code, cbsa_name, epratio_total)%>%
  knitr::kable()
cbsa_code cbsa_name epratio_total
1 13820 Birmingham-Hoover, AL Metro Area 0.569
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 0.630
18 17140 Cincinnati, OH-KY-IN Metro Area 0.625
34 18140 Columbus, OH Metro Area 0.642
44 24660 Greensboro-High Point, NC Metro Area 0.584
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area 0.636
58 28140 Kansas City, MO-KS Metro Area 0.648
72 31140 Louisville/Jefferson County, KY-IN Metro Area 0.615
82 32820 Memphis, TN-MS-AR Metro Area 0.591
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 0.650
103 36540 Omaha-Council Bluffs, NE-IA Metro Area 0.675

Prevalence of health problems–metro and peers

library(RSocrata)
token <- Sys.getenv("RSocrata_token")

cities <- paste0(gsub("\\,.+","",cbsa_output$cbsa_name_short), collapse = "','")

cityhealth <- read.socrata(paste0("https://chronicdata.cdc.gov/resource/csmm-fdhi.csv?category=Health Outcomes&$where=cityname in",
                                  "('",cities,"')"),token)

# peer comparison
cityhealth %>% 
  filter(measureid %in% c("MHLTH", "PHLTH")) %>%
  filter(geographiclevel == "City") %>%
  filter(datavaluetypeid == "AgeAdjPrv") %>%
  select(cityname, measure, data_value, year) %>%
  group_by(cityname, measure)%>%
  summarise(data_value = mean(data_value))%>%
  pivot_wider(names_from = "measure", values_from = "data_value") %>%
  knitr::kable()
cityname Mental health not good for >=14 days among adults aged >=18 Years Physical health not good for >=14 days among adults aged >=18 Years
Birmingham 16.80 17.10
Charlotte 12.50 12.10
Cincinnati 16.00 15.20
Columbus 14.65 13.40
Indianapolis 14.80 14.00
Kansas City 14.55 14.55
Louisville 14.90 15.10
Memphis 15.80 16.10
Nashville 13.80 13.00

Struggling families? (I think this may not be available?)–metro and peers

not available

Share of workers who are low-wage–metro and peers

cbsa_low_wage_worker %>%
  filter(cbsa_code %in% c(target_cbsa, peer_cbsa)) %>%
  filter(population %in% c("Low-wage workers","Workers"))%>%
  select(cbsa_code, cbsa_name, population, total)%>%
  pivot_wider(names_from = "population", values_from = "total") %>%
  mutate(pct_low_wage = `Low-wage workers`/`Workers`) %>%
  knitr::kable()
cbsa_code cbsa_name Workers Low-wage workers pct_low_wage
13820 Birmingham-Hoover, AL 427390 168857 0.3950888
16740 Charlotte-Concord-Gastonia, NC-SC 985032 410718 0.4169590
17140 Cincinnati, OH-KY-IN 862747 309114 0.3582904
18140 Columbus, OH 797816 299778 0.3757483
24660 Greensboro-High Point, NC 304540 134668 0.4422014
26900 Indianapolis-Carmel-Anderson, IN 811297 322005 0.3969015
28140 Kansas City, MO-KS 877608 338260 0.3854340
31140 Louisville/Jefferson County, KY-IN 508070 203787 0.4011002
32820 Memphis, TN-MS-AR 483660 212111 0.4385539
34980 Nashville-Davidson–Murfreesboro–Franklin, TN 784841 337988 0.4306452
36540 Omaha-Council Bluffs, NE-IA 413998 162415 0.3923087

Share of population out-of-work–metro and peers

Note: metro aggregates only include core counties, as listed

names <- co_oow %>%
  filter(cbsa_code %in% c(target_cbsa, peer_cbsa)) %>%
  select(cbsa_code, cbsa_name, pl_name) %>%
  unique()%>%
  group_by(cbsa_code) %>%
  summarise(cbsa_name = last(cbsa_name),
            core_counties = paste0(pl_name, collapse = ", "))


co_oow %>%
  filter(cbsa_code %in% c(target_cbsa, peer_cbsa))%>%
  filter(population %in% c("Out-of-work population","Universe population")) %>%
  select(stco_code, age, cbsa_code, cbsa_name, pl_name, population, total) %>%
  group_by(cbsa_code, population, age) %>%
  summarise(total = sum(total))%>%
  pivot_wider(names_from = "population", values_from = "total") %>%
  mutate(pct_oow = `Out-of-work population`/`Universe population`) %>%
  select(-contains("population")) %>%
  pivot_wider(names_from = "age", values_from = "pct_oow")%>%
  left_join(names, by = "cbsa_code")%>%
  knitr::kable()
cbsa_code 18-24 25-64 cbsa_name core_counties
13820 0.1733161 0.1283212 Birmingham-Hoover, AL Jefferson County, AL, NA
16740 0.1558372 0.1239217 Charlotte-Concord-Gastonia, NC-SC Mecklenburg County, NC, NA
17140 0.1478477 0.1300298 Cincinnati, OH-KY-IN Hamilton County, OH, NA
18140 0.1103143 0.1161686 Columbus, OH Franklin County, OH, NA
26900 0.1738600 0.1454038 Indianapolis-Carmel-Anderson, IN Indianapolis, IN, NA
28140 0.1639243 0.1059291 Kansas City, MO-KS Jackson County, MO, Johnson County, KS, NA
31140 0.1331677 0.1186111 Louisville/Jefferson County, KY-IN Louisville/Jefferson County, KY, NA
32820 0.2271379 0.1522109 Memphis, TN-MS-AR Shelby County, TN, NA
34980 0.1434097 0.1179778 Nashville-Davidson–Murfreesboro–Franklin, TN Nashville-Davidson, TN, NA
36540 NA 0.0994130 NA Douglas County, NE

Digital skills demand, 2002/2016–metro

cbsa_code cbsa_name cbsa_pct_high_02 cbsa_pct_medium_02 cbsa_pct_low_02 cbsa_pct_high_16 cbsa_pct_medium_16 cbsa_pct_low_16
1 13820 Birmingham-Hoover, AL Metro Area 0.0447100 0.4019414 0.5533486 0.2213629 0.5019834 0.2766537
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 0.0393641 0.3869759 0.5736600 0.2411426 0.4735609 0.2852965
18 17140 Cincinnati, OH-KY-IN Metro Area 0.0448693 0.3812387 0.5738921 0.2285413 0.4799647 0.2914940
34 18140 Columbus, OH Metro Area 0.0573894 0.3825038 0.5601068 0.2483362 0.4617268 0.2899370
44 24660 Greensboro-High Point, NC Metro Area 0.0419281 0.3782357 0.5798363 0.2043621 0.4620994 0.3335386
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area 0.0474312 0.3844814 0.5680874 0.2162944 0.4660410 0.3176646
58 28140 Kansas City, MO-KS Metro Area 0.0600598 0.3875261 0.5524141 0.2577715 0.4674781 0.2747504
72 31140 Louisville/Jefferson County, KY-IN Metro Area 0.0432075 0.3834751 0.5733174 0.2015948 0.4749915 0.3234137
82 32820 Memphis, TN-MS-AR Metro Area 0.0354234 0.3712143 0.5933623 0.1951220 0.4507223 0.3541557
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 0.0449740 0.3749311 0.5800949 0.2387505 0.4739482 0.2873012
103 36540 Omaha-Council Bluffs, NE-IA Metro Area 0.0640518 0.3803509 0.5555973 0.2418920 0.4655395 0.2925685

Access

Job density change by block group?–metro

we don’t have block group data in the warehouse yet - can ask Joanne

Geographic of prosperity trend (UVA data)–metro + MW/Southeastern trendlines

http://statchatva.org/changing-shape-of-american-cities/

Prevalence of health problems by census tract?–metro

Only available for core city

tract_health <- cityhealth %>%
  filter(measureid %in% c("MHLTH", "PHLTH")) %>%
  filter(geographiclevel == "Census Tract") %>%
  mutate(stcotr_code = str_pad(tractfips, 11, "left","0"))%>%
  select(year, stcotr_code, measureid, data_value) %>%
  pivot_wider(names_from = "measureid", values_from = "data_value")

map_health <- map %>%
  mutate(stco_code = str_sub(GEOID,1,5)) %>%
  left_join(tract_health, by = c("GEOID" = "stcotr_code"))

tm_shape(map_health %>%
  filter(stco_code %in% target_co) %>%
  filter(!is.na(year)))+
  tm_polygons(c("MHLTH", "PHLTH"), alpha = 0.7)+
  tm_facets(nrow = 1, sync = T)

Number of jobs reachable by travel time (including public transit)–metro

Number of jobs reachable by 30 minutes auto and 30 minutes transit

cbsa_output %>% 
  select(cbsa_code, cbsa_name,auto_30, transit_30, ratio_30)%>%
  knitr::kable()
cbsa_code cbsa_name auto_30 transit_30 ratio_30
1 13820 Birmingham-Hoover, AL Metro Area 268251 2713 98.87615
7 16740 Charlotte-Concord-Gastonia, NC-SC Metro Area 450125 7682 58.59477
18 17140 Cincinnati, OH-KY-IN Metro Area 494927 7080 69.90494
34 18140 Columbus, OH Metro Area 605435 10857 55.76448
44 24660 Greensboro-High Point, NC Metro Area NA NA NA
47 26900 Indianapolis-Carmel-Anderson, IN Metro Area 556698 7491 74.31558
58 28140 Kansas City, MO-KS Metro Area 615321 6864 89.64467
72 31140 Louisville/Jefferson County, KY-IN Metro Area 423448 7263 58.30208
82 32820 Memphis, TN-MS-AR Metro Area 402266 NA NA
90 34980 Nashville-Davidson–Murfreesboro–Franklin, TN Metro Area 307872 5380 57.22528
103 36540 Omaha-Council Bluffs, NE-IA Metro Area NA NA NA

map: http://access.umn.edu/research/america/transit/2018/maps/index.html

Are the NCES data behind the proficiency map downloaded and generally available, or did you do those special for BHM?

You can download school level data from NCES. we aggregated school level data to various geography.

tract_school <- final %>%
  mutate(stco_code = str_sub(fips,1,5)) %>%
  filter(stco_code %in% target_co) %>%
  mutate(stcotr_code = str_sub(fips, 1,11)) %>%
  group_by(stcotr_code) %>%
  summarise(pct_pass = sum(ALL_TOTAL_passed_H)/sum(ALL_TOTAL_total))

map_school <- map %>%
  mutate(stco_code = str_sub(GEOID,1,5)) %>%
  left_join(tract_school, by = c("GEOID" = "stcotr_code"))


tm_shape(map_school%>%
  filter(str_sub(GEOID,1,5) %in% target_co) %>%
    mutate(lab = scales::percent(pct_pass)))+
  tm_polygons(col = "pct_pass", id = "lab", alpha = 0.7)
# map_school %>%
#   filter(str_sub(GEOID,1,5) %in% target_co)%>%
#   ggplot(aes(fill = pct_pass))+
#   scale_fill_distiller(type = "div", palette = "PiYG")+
#   geom_sf()+
#   coord_sf(crs = 26911)