{"id":32199437,"url":"https://github.com/idblr/ndi","last_synced_at":"2025-10-22T03:16:00.817Z","repository":{"id":57749259,"uuid":"521439746","full_name":"idblr/ndi","owner":"idblr","description":"Computes various geospatial indices of socioeconomic deprivation and disparity in the United States","archived":false,"fork":false,"pushed_at":"2025-09-10T12:32:26.000Z","size":45449,"stargazers_count":22,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-12T07:04:37.379Z","etag":null,"topics":["census","census-api","census-data","cran","cran-r","deprivation","deprivation-stats","disparity","geospatial","geospatial-data","metric-development","principal-component-analysis","r","r-package","rstats","rstats-package","segregation-measures","socio-economic-indicators"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idblr.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-04T23:07:13.000Z","updated_at":"2025-09-04T20:55:36.000Z","dependencies_parsed_at":"2024-01-29T09:19:11.445Z","dependency_job_id":"852d3518-eb50-49c1-a125-a18181146a8f","html_url":"https://github.com/idblr/ndi","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":0.3076923076923077,"last_synced_commit":"e95311c4bca015d9d0aa461e0cc642f3ed613a67"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/idblr/ndi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idblr%2Fndi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idblr%2Fndi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idblr%2Fndi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idblr%2Fndi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idblr","download_url":"https://codeload.github.com/idblr/ndi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idblr%2Fndi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280371890,"owners_count":26319523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["census","census-api","census-data","cran","cran-r","deprivation","deprivation-stats","disparity","geospatial","geospatial-data","metric-development","principal-component-analysis","r","r-package","rstats","rstats-package","segregation-measures","socio-economic-indicators"],"created_at":"2025-10-22T03:15:59.428Z","updated_at":"2025-10-22T03:16:00.810Z","avatar_url":"https://github.com/idblr.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ndi: Neighborhood Deprivation Indices \n\u003cimg src='man/figures/ndi.png' width='120' align='right' /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/idblr/ndi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/idblr/ndi/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://r-pkg.org/badges/version/ndi)](https://cran.r-project.org/package=ndi)\n[![CRAN version](https://r-pkg.org/badges/version-ago/ndi)](https://cran.r-project.org/package=ndi)\n[![CRAN RStudio mirror downloads total](https://cranlogs.r-pkg.org/badges/grand-total/ndi?color=blue)](https://r-pkg.org/pkg/ndi)\n[![CRAN RStudio mirror downloads monthly](https://cranlogs.r-pkg.org/badges/ndi)](https://r-pkg.org:443/pkg/ndi)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/license/apache-2-0)\n![GitHub last commit](https://img.shields.io/github/last-commit/idblr/ndi)\n[![](https://img.shields.io/badge/DOI-10.32614/CRAN.package.ndi-1f57b6?style=flat\u0026link=https://doi.org/10.32614/CRAN.package.ndi)](https://doi.org/10.32614/CRAN.package.ndi)\n\u003c!-- badges: end --\u003e\n\n**Date repository last updated**: 2025-09-04\n\n### Overview\n\nComputes various geospatial indices of socioeconomic deprivation and disparity in the United States. Some indices are considered \"spatial\" because they consider the values of neighboring (i.e., adjacent) census geographies in their computation, while other indices are \"aspatial\" because they only consider the value within each census geography. Two types of aspatial neighborhood deprivation indices (NDI) are available: including: (1) based on [Messer et al. (2006)](https://doi.org/10.1007/s11524-006-9094-x) and (2) based on [Andrews et al. (2020)](https://doi.org/10.1080/17445647.2020.1750066) and [Slotman et al. (2022)](https://doi.org/10.1016/j.dib.2022.108002) who use variables chosen by [Roux and Mair (2010)](https://doi.org/10.1111/j.1749-6632.2009.05333.x). Both are a decomposition of multiple demographic characteristics from the U.S. Census Bureau American Community  Survey 5-year estimates (ACS-5; 2006-2010 onward). Using data from the ACS-5 (2005-2009 onward), the package can also compute indices of racial or ethnic residential segregation, including but limited to those discussed in [Massey \u0026 Denton (1988)](https://doi.org/10.1093/sf/67.2.281), and selected metrics of socioeconomic deprivation and disparity.\n\n### Installation\n\nTo install the release version from CRAN:\n\n    install.packages('ndi')\n\nTo install the development version from GitHub:\n\n    devtools::install_github('idblr/ndi')\n\n### Available functions\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol width='30%'/\u003e\n\u003ccol width='70%'/\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr class='header'\u003e\n\u003cth\u003eFunction\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/anthopolos.R'\u003e\u003ccode\u003eanthopolos\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the spatial Racial Isolation Index (\u003ci\u003eRI\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1016/j.sste.2011.06.002'\u003eAnthopolos et al. (2011)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/atkinson.R'\u003e\u003ccode\u003eatkinson\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial Atkinson Index (\u003ci\u003eA\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1016/0022-0531(70)90039-6'\u003eAtkinson (1970)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/bell.R'\u003e\u003ccode\u003ebell\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Interaction Index (\u003ci\u003exPy*\u003c/i\u003e) based on Shevky \u0026 Williams (1949; ISBN-13:978-0-837-15637-8) and \u003ca href='https://doi.org/10.2307/2574118'\u003eBell (1954)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/bemanian_beyer.R'\u003e\u003ccode\u003ebemanian_beyer\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Local Exposure and Isolation (\u003ci\u003eLEx/Is\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1158/1055-9965.EPI-16-0926'\u003eBemanian \u0026 Beyer (2017)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/bravo.R'\u003e\u003ccode\u003ebravo\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the spatial Educational Isolation Index (\u003ci\u003eEI\u003c/i\u003e) based on \u003ca href='https://doi.org/10.3390/ijerph18179384'\u003eBravo et al. (2021)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/denton.R'\u003e\u003ccode\u003edenton\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Relative Clustering (\u003ci\u003eRCL\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/denton_cuzzort.R'\u003e\u003ccode\u003edenton_cuzzort\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Relative Concentration (\u003ci\u003eRCO\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e and Duncan, Cuzzort, \u0026 Duncan (1961; LC:60007089)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/duncan.R'\u003e\u003ccode\u003eduncan\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Dissimilarity Index (\u003ci\u003eD\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/2088328'\u003eDuncan \u0026 Duncan (1955a)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/duncan_cuzzort.R'\u003e\u003ccode\u003eduncan_cuzzort\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Absolute Centralization (\u003ci\u003eACE\u003c/i\u003e) based on Duncan, Cuzzort, \u0026 Duncan (1961; LC:60007089) and \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/duncan_duncan.R'\u003e\u003ccode\u003eduncan_duncan\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Relative Centralization (\u003ci\u003eRCE\u003c/i\u003e) based \u003ca href='https://doi.org/10.1086/221609'\u003eDuncan \u0026 Duncan (1955b)\u003c/a\u003e and \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/gini.R'\u003e\u003ccode\u003egini\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Gini Index (\u003ci\u003eG\u003c/i\u003e) and retrieve the aspatial income Gini Index (\u003ci\u003eG\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/2223319'\u003eGini (1921)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/hoover.R'\u003e\u003ccode\u003ehoover\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Delta (\u003ci\u003eDEL\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1017/S0022050700052980'\u003eHoover (1941)\u003c/a\u003e and Duncan et al. (1961; LC:60007089)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/james_taeuber.R'\u003e\u003ccode\u003ejames_taeuber\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Dissimilarity Index (\u003ci\u003eD\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/270845'\u003eJames \u0026 Taeuber (1985)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/krieger.R'\u003e\u003ccode\u003ekrieger\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial Index of Concentration at the Extremes (\u003ci\u003eICE\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1136/jech-2015-205728'\u003eFeldman et al. (2015)\u003c/a\u003e and \u003ca href='https://doi.org/10.2105/AJPH.2015.302955'\u003eKrieger et al. (2016)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/lieberson.R'\u003e\u003ccode\u003elieberson\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Isolation Index (\u003ci\u003exPx*\u003c/i\u003e) based on Lieberson (1981; ISBN-13:978-1-032-53884-6) and \u003ca href='https://doi.org/10.2307/2574118'\u003eBell (1954)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/massey.R'\u003e\u003ccode\u003emassey\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Absolute Clustering (\u003ci\u003eACL\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/massey_duncan.R'\u003e\u003ccode\u003emassey_duncan\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Absolute Concentration (\u003ci\u003eACO\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e and Duncan, Cuzzort, \u0026 Duncan (1961; LC:60007089)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/messer.R'\u003e\u003ccode\u003emesser\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial Neighborhood Deprivation Index (\u003ci\u003eNDI\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1007/s11524-006-9094-x'\u003eMesser et al. (2006)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/morgan_denton.R'\u003e\u003ccode\u003emorgan_denton\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Distance-Decay Interaction Index (\u003ci\u003eDPxy*\u003c/i\u003e) based on \u003ca href='https://www.jstor.org/stable/20001935'\u003eMorgan (1983)\u003c/a\u003e and \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/morgan_massey.R'\u003e\u003ccode\u003emorgan_massey\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Distance-Decay Isolation Index (\u003ci\u003eDPxx*\u003c/i\u003e) based on \u003ca href='https://www.jstor.org/stable/20001935'\u003eMorgan (1983)\u003c/a\u003e and \u003ca href='https://doi.org/10.1093/sf/67.2.281'\u003eMassey \u0026 Denton (1988)\u003c/a\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/powell_wiley.R'\u003e\u003ccode\u003epowell_wiley\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial Neighborhood Deprivation Index (\u003ci\u003eNDI\u003c/i\u003e) based on \u003ca href='https://doi.org/10.1080/17445647.2020.1750066'\u003eAndrews et al. (2020)\u003c/a\u003e and \u003ca href='https://doi.org/10.1016/j.dib.2022.108002'\u003eSlotman et al. (2022)\u003c/a\u003e with variables chosen by \u003ca href='https://doi.org/10.1111/j.1749-6632.2009.05333.x'\u003eRoux and Mair (2010)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/sudano.R'\u003e\u003ccode\u003esudano\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Location Quotient (\u003ci\u003eLQ\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/2084686'\u003eMerton (1938)\u003c/a\u003e and \u003ca href='https://doi.org/10.1016/j.healthplace.2012.09.015'\u003eSudano et al. (2013)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/theil.R'\u003e\u003ccode\u003etheil\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Entropy (\u003ci\u003eH\u003c/i\u003e) based on Theil (1972; ISBN-13:978-0-444-10378-9) and \u003ca href='https://doi.org/10.1080/0022250X.1971.9989795'\u003eTheil \u0026 Finizza (1971)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/white.R'\u003e\u003ccode\u003ewhite\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute the aspatial racial or ethnic Correlation Ratio (\u003ci\u003eV\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/2574118'\u003eBell (1954)\u003c/a\u003e and \u003ca href='https://doi.org/10.2307/3644339'\u003eWhite (1986)\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/white_blau.R'\u003e\u003ccode\u003ewhite_blau\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eCompute an index of spatial proximity (\u003ci\u003eSP\u003c/i\u003e) based on \u003ca href='https://doi.org/10.2307/3644339'\u003eWhite (1986)\u003c/a\u003e and Blau (1977; ISBN-13:978-0-029-03660-0)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nThe repository also includes the code to create the project hexagon sticker.\n\n\u003ch2 id='available-data'\u003e\n\n### Available sample dataset\n\n\u003c/h2\u003e\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol width='30%'/\u003e\n\u003ccol width='70%'/\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr class='header'\u003e\n\u003cth\u003eData\u003c/th\u003e\n\u003cth\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href='/R/DCtracts2020.R'\u003e\u003ccode\u003eDCtracts2020\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eA sample data set containing information about U.S. Census American Community Survey 5-year estimate data for the District of Columbia census tracts (2020). The data are obtained from the \u003ca href='https://cran.r-project.org/package=tidycensus'\u003e\u003ci\u003etidycensus\u003c/i\u003e\u003c/a\u003e package and formatted for the \u003ca href='/R/messer.R'\u003e\u003ccode\u003emesser()\u003c/code\u003e\u003c/a\u003e and \u003ca href='/R/powell_wiley.R'\u003e\u003ccode\u003epowell_wiley()\u003c/code\u003e\u003c/a\u003e functions input.\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n### Author\n\n* **Ian D. Buller** - *DLH, LLC (formerly  DLH Corporation and Social \u0026 Scientific Systems, Inc.), Bethesda, Maryland (current)* - *Occupational and Environmental Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland (original)* - [GitHub](https://github.com/idblr) - [ORCID](https://orcid.org/0000-0001-9477-8582)\n\nSee also the list of [contributors](https://github.com/idblr/ndi/graphs/contributors) who participated in this package, including:\n\n* **Jacob Englert** - *Biostatistics and Bioinformatics Doctoral Program, Laney Graduate School, Emory University, Atlanta, Georgia* - [GitHub](https://github.com/jacobenglert)\n\n* **Jessica Gleason** - *Epidemiology Branch, Division of Population Health Research, Eunice Kennedy Shriver National Institute of Child Health and Human Development, National Institutes of Health, Bethesda, Maryland* - [ORCID](https://orcid.org/0000-0001-9877-7931)\n\n* **Hunter Mills** - [GitHub](https://github.com/huntermills707)\n\n* **Chris Prener** - *Real World Evidence Center of Excellence, Pfizer, Inc.* - [GitHub](https://github.com/chris-prener) - [ORCID](https://orcid.org/0000-0002-4310-9888)\n\n* **Davis Vaughan** - *Posit* - [GitHub](https://github.com/DavisVaughan) - [ORCID](https://orcid.org/0000-0003-4777-038X)\n\nThank you to those who suggested additional indices, including:\n\n* **David Berrigan** - *Behavioral Research Program, Division of Cancer Control and Population Sciences, National Cancer Institute, National Institutes of Health, Rockville, Maryland* - [ORCID](https://orcid.org/0000-0002-5333-179X)\n\n* **Symielle Gaston** - *Social and Environmental Determinants of Health Equity Group, Epidemiology Branch, National Institute of Environmental Health Sciences, National Institutes of Health, Research Triangle Park, North Carolina* - [ORCID](https://orcid.org/0000-0001-9495-1592)\n\n* **Jessica Madrigal** - *Occupational and Environmental Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland* - [ORCID](https://orcid.org/0000-0001-5303-5109)\n\n### Getting Started\n\n* Step 1: Obtain a unique access key from the U.S. Census Bureau. Follow [this link](http://api.census.gov/data/key_signup.html) to obtain one.\n* Step 2: Specify your access key in each function using the internal `key` argument or by using the `census_api_key()` function from the [*tidycensus*](https://cran.r-project.org/package=tidycensus) package before running each function (see an example below).\n\n### Usage\n\n``` r\n# ------------------ #\n# Necessary packages #\n# ------------------ #\n\nlibrary(ndi)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(sf) # dependency fo the 'ndi' package\nlibrary(tidycensus) # a dependency for the 'ndi' package\nlibrary(tigris)\n\n# -------- #\n# Settings #\n# -------- #\n\n## Access Key for census data download\n### Obtain one at http://api.census.gov/data/key_signup.html\ncensus_api_key('...') # INSERT YOUR OWN KEY FROM U.S. CENSUS API\n\n# ---------------------- #\n# Calculate NDI (Messer) #\n# ---------------------- #\n\n# Compute the NDI (Messer) values (2016-2020 5-year ACS) for Washington, D.C. census tracts\nmesser_2020_DC \u003c- messer(state = 'DC', year = 2020)\n\n# ------------------------------ #\n# Outputs from messer() function #\n# ------------------------------ #\n\n# A tibble containing the identification, geographic name, NDI (Messer) values, NDI (Messer) \n# quartiles, and raw census characteristics for each tract\nmesser_2020_DC$ndi\n\n# The results from the principal component analysis used to compute the NDI (Messer) values\nmesser_2020_DC$pca\n\n# A tibble containing a breakdown of the missingingness of the census characteristics \n# used to compute the NDI (Messer) values\nmesser_2020_DC$missing\n\n# -------------------------------------- #\n# Visualize the messer() function output #\n# -------------------------------------- #\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the NDI (Messer) values to the census tract geometry\nDC_2020_messer \u003c- tract_2020_DC %\u003e%\n  left_join(messer_2020_DC$ndi, by = 'GEOID')\n\n# Visualize the NDI (Messer) values (2016-2020 5-year ACS) for Washington, D.C. census tracts\n\n## Continuous Index\nggplot() +\n  geom_sf(\n    data = DC_2020_messer,\n    aes(fill = NDI),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\nContinuous (Messer, non-imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'messer1.png'), height = 7, width = 7)\n\n## Categorical Index (Quartiles)\n### Rename '9-NDI not avail' level as NA for plotting\nDC_2020_messer$NDIQuartNA \u003c-\n  factor(\n    replace(\n      as.character(DC_2020_messer$NDIQuart),\n      DC_2020_messer$NDIQuart == '9-NDI not avail',\n      NA\n    ),\n    c(levels(DC_2020_messer$NDIQuart)[-5], NA)\n  )\n\nggplot() +\n  geom_sf(\n    data = DC_2020_messer,\n    aes(fill = NDIQuartNA),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_d(\n    guide = guide_legend(reverse = TRUE),\n    na.value = 'grey50'\n  ) +\n  labs(\n    fill = 'Index (Categorical)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\nQuartiles (Messer, non-imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'messer2.png'), height = 7, width = 7)\n```\n\n![](man/figures/messer1.png)\n![](man/figures/messer2.png)\n\n``` r\n# ---------------------------- #\n# Calculate NDI (Powell-Wiley) #\n# ---------------------------- #\n\n# Compute the NDI (Powell-Wiley) values (2016-2020 5-year ACS) for\n# Washington, D.C. census tracts\npowell_wiley_2020_DC \u003c- powell_wiley(state = 'DC', year = 2020)\n# impute missing values\npowell_wiley_2020_DCi \u003c- powell_wiley(state = 'DC', year = 2020, imp = TRUE)\n\n# ------------------------------------ #\n# Outputs from powell_wiley() function #\n# ------------------------------------ #\n\n# A tibble containing the identification, geographic name, NDI (Powell-Wiley) value, and \n# raw census characteristics for each tract\npowell_wiley_2020_DC$ndi\n\n# The results from the principal component analysis used to \n# compute the NDI (Powell-Wiley) values\npowell_wiley_2020_DC$pca\n\n# A tibble containing a breakdown of the missingingness of the census characteristics used to \n# compute the NDI (Powell-Wiley) values\npowell_wiley_2020_DC$missing\n\n# -------------------------------------------- #\n# Visualize the powell_wiley() function output #\n# -------------------------------------------- #\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the NDI (Powell-Wiley) values to the census tract geometry\nDC_2020_powell_wiley \u003c- tract_2020_DC %\u003e%\n  left_join(powell_wiley_2020_DC$ndi, by = 'GEOID')\nDC_2020_powell_wiley \u003c- DC_2020_powell_wiley %\u003e%\n  left_join(powell_wiley_2020_DCi$ndi, by = 'GEOID')\n\n# Visualize the NDI (Powell-Wiley) values (2016-2020 5-year ACS) for\n# Washington, D.C. census tracts\n\n## Non-imputed missing tracts (Continuous)\nggplot() +\n  geom_sf(\n    data = DC_2020_powell_wiley,\n    aes(fill = NDI.x),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\nContinuous (Powell-Wiley, non-imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'powell_wiley1.png'), height = 7, width = 7)\n\n## Non-imputed missing tracts (Categorical quintiles)\n### Rename '9-NDI not avail' level as NA for plotting\nDC_2020_powell_wiley$NDIQuintNA.x \u003c- factor(\n  replace(\n    as.character(DC_2020_powell_wiley$NDIQuint.x),\n    DC_2020_powell_wiley$NDIQuint.x == '9-NDI not avail',\n    NA\n  ),\n  c(levels(DC_2020_powell_wiley$NDIQuint.x)[-6], NA)\n)\n  \nggplot() +\n  geom_sf(\n    data = DC_2020_powell_wiley,\n    aes(fill = NDIQuintNA.x),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_d(\n    guide = guide_legend(reverse = TRUE),\n    na.value = 'grey50'\n  ) +\n  labs(\n    fill = 'Index (Categorical)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\n\n    Population-weighted Quintiles (Powell-Wiley, non-imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'powell_wiley2.png'), height = 7, width = 7)\n```\n\n![](man/figures/powell_wiley1.png)\n![](man/figures/powell_wiley2.png)\n\n``` r\n## Imputed missing tracts (Continuous)\nggplot() +\n  geom_sf(\n    data = DC_2020_powell_wiley,\n    aes(fill = NDI.y),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\nContinuous (Powell-Wiley, imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'powell_wiley3.png'), height = 7, width = 7)\n\n## Imputed missing tracts (Categorical quintiles)\n### Rename '9-NDI not avail' level as NA for plotting\nDC_2020_powell_wiley$NDIQuintNA.y \u003c- factor(\n  replace(\n    as.character(DC_2020_powell_wiley$NDIQuint.y),\n    DC_2020_powell_wiley$NDIQuint.y == '9-NDI not avail',\n    NA\n  ),\n  c(levels(DC_2020_powell_wiley$NDIQuint.y)[-6], NA)\n)\n  \nggplot() +\n  geom_sf(\n    data = DC_2020_powell_wiley,\n    aes(fill = NDIQuintNA.y),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_d(\n    guide = guide_legend(reverse = TRUE),\n    na.value = 'grey50'\n  ) +\n  labs(\n    fill = 'Index (Categorical)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Neighborhood Deprivation Index\\nPopulation-weighted Quintiles (Powell-Wiley, imputed)',\n    subtitle = 'Washington, D.C. tracts as the referent'\n  )\nggsave(file.path('man', 'figures', 'powell_wiley4.png'), height = 7, width = 7)\n```\n\n![](man/figures/powell_wiley3.png)\n![](man/figures/powell_wiley4.png)\n\n``` r\n# --------------------------- #\n# Compare the two NDI metrics #\n# --------------------------- #\n\n# Merge the two NDI metrics (Messer and Powell-Wiley, imputed)\nNDI_2020_DC \u003c- messer_2020_DC$ndi %\u003e%\n  left_join(\n    powell_wiley_2020_DCi$ndi,\n    by = 'GEOID',\n    suffix = c('.messer', '.powell_wiley')\n  )\n\n# Check the correlation of two NDI metrics (Messer \u0026 Powell-Wiley, imputed) as continuous values\ncor(NDI_2020_DC$NDI.messer, NDI_2020_DC$NDI.powell_wiley, use = 'complete.obs') # Pearson's r=0.975\n\n# Check the similarity of the two NDI metrics (Messer and Powell-Wiley, imputed) as quartiles\ntable(NDI_2020_DC$NDIQuart, NDI_2020_DC$NDIQuint)\n```\n\n#### Additional indices of racial or ethnic residential segregation or socioeconomic disparity\n\n``` r\n# ---------------------------------------------------- #\n# Compute spatial Racial Isoliation Index (Anthopolos) #\n# ---------------------------------------------------- #\n\n# Racial Isolation Index based on Anthopolos et al. (2011)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\nRI_2020_DC \u003c- anthopolos(\n  state = 'DC', \n  year = 2020, \n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the RI (Anthopolos) values to the census tract geometry\nRI_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(RI_2020_DC$ri, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = RI_2020_DC,\n    aes(fill = RI),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Racial Isolation Index\\nNot Hispanic or Latino, Black or African American alone (Anthopolos)',\n    subtitle = 'Washington, D.C. tracts (not corrected for edge effects)'\n  )\nggsave(file.path('man', 'figures', 'ri.png'), height = 7, width = 7)\n```\n\n![](man/figures/ri.png)\n\n```r\n# ----------------------------------------------------------- #\n# Compute aspatial racial or ethnic Atkinson Index (Atkinson) #\n# ----------------------------------------------------------- #\n\n# Atkinson Index based on Atkinson (1970)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\n## Default epsilon (0.5 or over- and under-representation contribute equally)\nA_2020_DC \u003c- atkinson(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the AI (Atkinson) values to the census tract geometry\nA_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(A_2020_DC$a, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = A_2020_DC,\n    aes(fill = A),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Atkinson Index (Atkinson)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = expression(paste('Black non-Hispanic (', epsilon, ' = 0.5)'))\n  )\nggsave(file.path('man', 'figures', 'a.png'), height = 7, width = 7)\n```\n\n![](man/figures/a.png)\n\n```r\n# -------------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Atkinson Index (Atkinson) with the Hölder mean #\n# -------------------------------------------------------------------------------- #\n\n# Atkinson Index based on Atkinson (1970)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\n## Default epsilon (0.5 or over- and under-representation contribute equally)\n## Using the Hölder mean based on the `Atkinson()` function from 'DescTools' package\nA_2020_DC \u003c- atkinson(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  holder = TRUE\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the AI (Atkinson) values to the census tract geometry\nA_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(A_2020_DC$a, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = A_2020_DC,\n    aes(fill = A),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Atkinson Index (Atkinson) with Hölder mean\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = expression(paste('Black non-Hispanic (', epsilon, ' = 0.5)'))\n  )\nggsave(file.path('man', 'figures', 'a_holder.png'), height = 7, width = 7)\n```\n\n![](man/figures/a_holder.png)\n\n```r\n# ---------------------------------------------------------- #\n# Compute aspatial racial or ethnic Interaction Index (Bell) #\n# ---------------------------------------------------------- #\n\n# Interaction Index based on Shevky \u0026 Williams (1949) and Bell (1954)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected interaction subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nxPy_star_2020_DC \u003c- bell(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ixn = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the xPy* (Bell) values to the census tract geometry\nxPy_star_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(xPy_star_2020_DC$xpy_star, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = xPy_star_2020_DC,\n    aes(fill = xPy_star),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Interaction Index (Bell)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'xpy_star.png'), height = 7, width = 7)\n```\n\n![](man/figures/xpy_star.png)\n\n```r\n# --------------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Local Exposure and Isolation (Bemanian \u0026 Beyer) #\n# --------------------------------------------------------------------------------- #\n\n# Local Exposure and Isolation based on Bemanian \u0026 Beyer (2017)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected interaction subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: state\n## Selected small geography: census tract\nLExIs_2020_DC \u003c- bemanian_beyer(\n  geo_large = 'state',\n  geo_small = 'tract',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ixn = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the LEx/Is (Bemanian \u0026 Beyer) values to the census tract geometry\nLExIs_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(LExIs_2020_DC$lexis, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = LExIs_2020_DC,\n    aes(fill = LExIs),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Local Exposure and Isolation (Bemanian \u0026 Beyer)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'lexis.png'), height = 7, width = 7)\n```\n\n![](man/figures/lexis.png)\n\n``` r\n# ---------------------------------------------------- #\n# Compute spatial Educational Isoliation Index (Bravo) #\n# ---------------------------------------------------- #\n\n# Educational Isolation Index based on Bravo et al. (2021)\n## Selected subgroup: without four-year college degree\nEI_2020_DC \u003c- bravo(\n  state = 'DC', \n  year = 2020, \n  subgroup = c('LtHS', 'HSGiE', 'SCoAD')\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the EI (Bravo) values to the census tract geometry\nEI_2020_DC \u003c- tract_2020_DC %\u003e% \n  left_join(EI_2020_DC$ei, by = 'GEOID')\n\nggplot() + \n  geom_sf(\n    data = EI_2020_DC, \n    aes(fill = EI),\n    color = 'white'\n  ) +\n  theme_bw() + \n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  )+\n  ggtitle(\n    'Educational Isolation Index\\nWithout a four-year college degree (Bravo)',\n    subtitle = 'Washington, D.C. tracts (not corrected for edge effects)'\n  )\nggsave(file.path('man', 'figures', 'ei.png'), height = 7, width = 7)\n```\n\n![](man/figures/ei.png)\n\n```r\n# ----------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Relative Clustering (Massey \u0026 Denton) #\n# ----------------------------------------------------------------------- #\n\n# Relative Clustering based on Massey \u0026 Denton (1988)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected subgroup reference: Not Hispanic or Latino, white alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nRCL_2020_DC \u003c- denton(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ref = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the RCL (Massey \u0026 Denton) values to the census tract geometry\nRCL_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(RCL_2020_DC$rcl, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = RCL_2020_DC,\n    aes(fill = RCL),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0\n  )  +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Relative Clustering (Massey \u0026 Denton)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'rcl.png'), height = 7, width = 7)\n```\n\n![](man/figures/rcl.png)\n\n```r\n# -------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Relative Concentration (Massey \u0026 Denton) #\n# -------------------------------------------------------------------------- #\n\n# Relative Concentration based on Massey \u0026 Denton (1988) and Duncan, Cuzzort, \u0026 Duncan (1961)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected subgroup reference: Not Hispanic or Latino, white alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nRCO_2020_DC \u003c- denton_cuzzort(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ref = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the RCO (Massey \u0026 Denton) values to the census tract geometry\nRCO_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(RCO_2020_DC$rco, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = RCO_2020_DC,\n    aes(fill = RCO),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Relative Concentration (Massey \u0026 Denton)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'rco.png'), height = 7, width = 7)\n```\n\n![](man/figures/rco.png)\n\n```r\n# ----------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Dissimilarity Index (Duncan \u0026 Duncan) #\n# ----------------------------------------------------------------------- #\n\n# Dissimilarity Index based on Duncan \u0026 Duncan (1955a)\n## Selected subgroup comparison: Not Hispanic or Latino, Black or African American alone\n## Selected subgroup reference: Not Hispanic or Latino, white alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nD_2020_DC \u003c- duncan(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ref = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the D (Duncan \u0026 Duncan) values to the census tract geometry\nD_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(D_2020_DC$d, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = D_2020_DC,\n    aes(fill = D),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Dissimilarity Index (Duncan \u0026 Duncan)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'ddd.png'), height = 7, width = 7)\n```\n\n![](man/figures/ddd.png)\n\n```r\n# ---------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Absolute Centralization (Duncan \u0026 Cuzzort) #\n# ---------------------------------------------------------------------------- #\n\n# Absolute Centralization based on Duncan, Cuzzort, \u0026 Duncan (1961) and Massey \u0026 Denton (1988)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nACE_2020_DC \u003c- duncan_cuzzort(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the ACE (Duncan \u0026 Cuzzort) values to the census tract geometry\nACE_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(ACE_2020_DC$ace, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = ACE_2020_DC,\n    aes(fill = ACE),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0,\n    limits = c(-1, 1)\n  )  +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Absolute Centralization (Duncan \u0026 Cuzzort)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'ace.png'), height = 7, width = 7)\n```\n\n![](man/figures/ace.png)\n\n```r\n# --------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Relative Centralization (Duncan \u0026 Duncan) #\n# --------------------------------------------------------------------------- #\n\n# Relative Centralization based on Duncan \u0026 Duncan (1955b) and Massey \u0026 Denton (1988)\n## Selected subgroup comparison: Not Hispanic or Latino, Black or African American alone\n## Selected subgroup reference: Not Hispanic or Latino, white alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nRCE_2020_DC \u003c- duncan_duncan(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ref = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the ACE (Duncan \u0026 Duncan) values to the census tract geometry\nRCE_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(RCE_2020_DC$rce, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = RCE_2020_DC,\n    aes(fill = RCE),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0,\n    limits = c(-1, 1)\n  )  +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Relative Centralization (Duncan \u0026 Duncan)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'rce.png'), height = 7, width = 7)\n```\n\n![](man/figures/rce.png)\n\n``` r\n# -------------------------------------------- #\n# Compute aspatial racial or ethnic Gini Index #\n# -------------------------------------------- #\n\n# Gini Index based on Gini (1921)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nG_2020_DC \u003c- gini(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the G (Gini) values to the census tract geometry\nG_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(G_2020_DC$g, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = G_2020_DC,\n    aes(fill = G_re),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Gini Index (Gini)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'g_re.png'), height = 7, width = 7)\n```\n\n![](man/figures/g_re.png)\n\n``` r\n# ------------------------------------ #\n# Retrieve aspatial income Gini Index  #\n# ------------------------------------ #\n\n# Gini Index based on Gini (1921)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: county (or district for DC)\n## Selected small geography: census tract\nG_2020_DC \u003c- gini(\n  geo_large = 'county',\n  geo_small = 'tract',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the G (Gini) values found in `g_data` to the census tract geometry\nG_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(G_2020_DC$g_data , by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = G_2020_DC,\n    aes(fill = G_inc),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Gini Index (Gini)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Income'\n  )\nggsave(file.path('man', 'figures', 'g_inc.png'), height = 7, width = 7)\n```\n\n![](man/figures/g_inc.png)\n\n```r\n# ------------------------------------------------ #\n# Compute aspatial racial or ethnic Delta (Hoover) #\n# ------------------------------------------------ #\n\n# Delta based on Hoover (1941) and Duncan, Cuzzort, \u0026 Duncan (1961)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nDEL_2020_DC \u003c- hoover(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the DEL (Hoover) values to the census tract geometry\nDEL_2020_DC \u003c- tract_2020_DC %\u003e% \n  left_join(DEL_2020_DC$del, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = DEL_2020_DC,\n    aes(fill = DEL),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Delta (Hoover)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'del.png'), height = 7, width = 7)\n```\n\n![](man/figures/del.png)\n\n```r\n# ----------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Dissimilarity Index (James \u0026 Taeuber) #\n# ----------------------------------------------------------------------- #\n\n# Dissimilarity Index based on James \u0026 Taeuber (1985)\n## Selected subgroup comparison: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nD_2020_DC \u003c- james_taeuber(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the D (James \u0026 Taeuber) values to the census tract geometry\nD_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(D_2020_DC$d, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = D_2020_DC,\n    aes(fill = D),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Dissimilarity Index (James \u0026 Taeuber)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'djt.png'), height = 7, width = 7)\n```\n\n![](man/figures/djt.png)\n\n``` r\n# ----------------------------------------------------------------- #\n# Compute aspatial Index of Concentration at the Extremes (Krieger) #\n# ----------------------------------------------------------------- #\n\n# Five Indices of Concentration at the Extremes based on Feldman et al. (2015) and \n# Krieger et al. (2016)\n\nICE_2020_DC \u003c- krieger(state = 'DC', year = 2020)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the ICEs (Krieger) values to the census tract geometry\nICE_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(ICE_2020_DC$ice, by = 'GEOID')\n\n# Plot ICE for Income\nggplot() +\n  geom_sf(\n    data = ICE_2020_DC,\n    aes(fill = ICE_inc),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3',\n    mid = '#f7f7f7',\n    high = '#f1a340',\n    limits = c(-1, 1)\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Index of Concentration at the Extremes\\nIncome (Krieger)',\n    subtitle = '80th income percentile vs. 20th income percentile'\n  )\n```\n\n![](man/figures/ice1.png)\n\n```r\n# Plot ICE for Education\nggplot() +\n  geom_sf(\n    data = ICE_2020_DC,\n    aes(fill = ICE_edu),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3',\n    mid = '#f7f7f7',\n    high = '#f1a340',\n    limits = c(-1, 1)\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Index of Concentration at the Extremes\\nEducation (Krieger)',\n    subtitle = 'less than high school vs. four-year college degree or more'\n  )\n```\n\n![](man/figures/ice2.png)\n\n```r\n# Plot ICE for Race or Ethnicity\nggplot() +\n  geom_sf(\n    data = ICE_2020_DC,\n    aes(fill = ICE_rewb),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3',\n    mid = '#f7f7f7',\n    high = '#f1a340',\n    limits = c(-1, 1)\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Index of Concentration at the Extremes\\nRace pr Ethnicity (Krieger)',\n    subtitle = 'white non-Hispanic vs. black non-Hispanic'\n  )\n```\n\n![](man/figures/ice3.png)\n\n```\n# Plot ICE for Income and Race or Ethnicity Combined\n## white non-Hispanic in 80th income percentile vs. \n## black (including Hispanic) in 20th income percentile\nggplot() +\n  geom_sf(\n    data = ICE_2020_DC,\n    aes(fill = ICE_wbinc),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3',\n    mid = '#f7f7f7',\n    high = '#f1a340',\n    limits = c(-1, 1)\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Index of Concentration at the Extremes\\nIncome and race or ethnicity combined (Krieger)',\n    subtitle = 'white non-Hispanic in 80th income percentile vs. \n    black (incl. Hispanic) in 20th inc. percentile'\n  )\n```\n\n![](man/figures/ice4.png)\n\n```r\n# Plot ICE for Income and Race or Ethnicity Combined\n## white non-Hispanic in 80th income percentile vs. white non-Hispanic in 20th income percentile\nggplot() +\n  geom_sf(\n    data = ICE_2020_DC,\n    aes(fill = ICE_wpcinc),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3',\n    mid = '#f7f7f7',\n    high = '#f1a340',\n    limits = c(-1, 1)\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Index of Concentration at the Extremes\\nIncome and race or ethnicity combined (Krieger)',\n    subtitle = 'white non-Hispanic in 80th income percentile vs. \n    white non-Hispanic in 20th income percentile'\n  )\n```\n\n![](man/figures/ice5.png)\n\n```r\n# ------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Isolation Index (Lieberson) #\n# ------------------------------------------------------------- #\n\n# Isolation Index based on Lieberson (1981) and Bell (1954)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nxPx_star_2020_DC \u003c- lieberson(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the xPx* (Lieberson) values to the census tract geometry\nxPx_star_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(xPx_star_2020_DC$xpx_star, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = xPx_star_2020_DC,\n    aes(fill = xPx_star),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Isolation Index (Lieberson)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'xpx_star.png'), height = 7, width = 7)\n```\n\n![](man/figures/xpx_star.png)\n\n```r\n# ----------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Absolute Clustering (Massey \u0026 Denton) #\n# ----------------------------------------------------------------------- #\n\n# Absolute Clustering based on Massey \u0026 Denton (1988)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nACL_2020_DC \u003c- massey(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the ACL (Massey \u0026 Denton) values to the census tract geometry\nACL_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(ACL_2020_DC$acl, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = ACL_2020_DC,\n    aes(fill = ACL),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 0,\n    limits = c(-1, 1)\n  )  +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Absolute Clustering (Massey \u0026 Denton)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'acl.png'), height = 7, width = 7)\n```\n\n![](man/figures/acl.png)\n\n```r\n# -------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Absolute Concentration (Massey \u0026 Denton) #\n# -------------------------------------------------------------------------- #\n\n# Absolute Concentration based on Massey \u0026 Denton (1988) and Duncan, Cuzzort, \u0026 Duncan (1961)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nACO_2020_DC \u003c- massey_duncan(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the ACO (Massey \u0026 Denton) values to the census tract geometry\nACO_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(ACO_2020_DC$aco, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = ACO_2020_DC,\n    aes(fill = ACO),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Absolute Concentration (Massey \u0026 Denton)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'aco.png'), height = 7, width = 7)\n```\n\n![](man/figures/aco.png)\n\n```r\n# --------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Distance-Decay Interaction Index (Morgan) #\n# --------------------------------------------------------------------------- #\n\n# Distance-Decay Interaction Index based on Morgan (1983) and Massey \u0026 Denton (1988)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected interaction subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nDPxy_star_2020_DC \u003c- morgan_denton(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ixn = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the DPxx* (Morgan) values to the census tract geometry\nDPxy_star_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(DPxy_star_2020_DC$dpxy_star, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = DPxy_star_2020_DC,\n    aes(fill = DPxy_star),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Distance-Decay Interaction Index (Morgan)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'dpxy_star.png'), height = 7, width = 7)\n```\n\n![](man/figures/dpxy_star.png)\n\n```r\n# ------------------------------------------------------------------------- #\n# Compute aspatial racial or ethnic Distance-Decay Isolation Index (Morgan) #\n# ------------------------------------------------------------------------- #\n\n# Distance-Decay Isolation Index based on Morgan (1983) and Massey \u0026 Denton (1988)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nDPxx_star_2020_DC \u003c- morgan_massey(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the DPxx* (Morgan) values to the census tract geometry\nDPxx_star_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(DPxx_star_2020_DC$dpxx_star, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = DPxx_star_2020_DC,\n    aes(fill = DPxx_star),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Distance-Decay Isolation Index (Morgan)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'dpxx_star.png'), height = 7, width = 7)\n```\n\n![](man/figures/dpxx_star.png)\n\n```r\n# ------------------------------------------------------------ #\n# Compute aspatial racial or ethnic Location Quotient (Sudano) #\n# ------------------------------------------------------------ #\n\n# Location Quotient based on Merton (1938) and Sudano (2013)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: state\n## Selected small geography: census tract\nLQ_2020_DC \u003c- sudano(\n  geo_large = 'state',\n  geo_small = 'tract',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the LQ (Sudano) values to the census tract geometry\nLQ_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(LQ_2020_DC$lq, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = LQ_2020_DC,\n    aes(fill = LQ),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Location Quotient (Sudano)\\nCensus tracts within \"state\"\" of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'lq.png'), height = 7, width = 7)\n```\n\n![](man/figures/lq.png)\n\n```r\n# ------------------------------------------------- #\n# Compute aspatial racial or ethnic Entropy (Theil) #\n# ------------------------------------------------- #\n\n# Entropy based on Theil (1972) and Theil \u0026 Finizza (1971)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nH_2020_DC \u003c- theil(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the H (Theil) values to the census tract geometry\nH_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(H_2020_DC$h, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = H_2020_DC,\n    aes(fill = H),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c(limits = c(0, 1)) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Entropy (Theil)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'h.png'), height = 7, width = 7)\n```\n\n![](man/figures/h.png)\n\n```r\n# ----------------------------------------------------------- #\n# Compute aspatial racial or ethnic Correlation Ratio (White) #\n# ----------------------------------------------------------- #\n\n# Correlation Ratio based on Bell (1954) and White (1986)\n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nV_2020_DC \u003c- white(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the V (White) values to the census tract geometry\nV_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(V_2020_DC$v, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = V_2020_DC,\n    aes(fill = V),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_viridis_c() +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'Correlation Ratio (White)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'v.png'), height = 7, width = 7)\n```\n\n![](man/figures/v.png)\n\n```r\n# ------------------------------------------------------------- #\n# Compute a racial or ethnic index of spatial proximity (White) #\n# ------------------------------------------------------------- #\n\n# An index of spatial proximity based on White (1986) \u0026 Blau (1977) \n## Selected subgroup: Not Hispanic or Latino, Black or African American alone\n## Selected large geography: census tract\n## Selected small geography: census block group\nSP_2020_DC \u003c- white_blau(\n  geo_large = 'tract',\n  geo_small = 'cbg',\n  state = 'DC',\n  year = 2020,\n  subgroup = 'NHoLB',\n  subgroup_ref = 'NHoLW'\n)\n\n# Obtain the 2020 census tracts from the 'tigris' package\ntract_2020_DC \u003c- tracts(state = 'DC', year = 2020, cb = TRUE)\n\n# Join the SP (White) values to the census tract geometry\nSP_2020_DC \u003c- tract_2020_DC %\u003e%\n  left_join(SP_2020_DC$sp, by = 'GEOID')\n\nggplot() +\n  geom_sf(\n    data = SP_2020_DC,\n    aes(fill = SP),\n    color = 'white'\n  ) +\n  theme_bw() +\n  scale_fill_gradient2(\n    low = '#998ec3', \n    mid = '#f7f7f7', \n    high = '#f1a340', \n    midpoint = 1\n  ) +\n  labs(\n    fill = 'Index (Continuous)',\n    caption = 'Source: U.S. Census ACS 2016-2020 estimates'\n  ) +\n  ggtitle(\n    'An index of spatial proximity (White)\\nCensus block groups within tracts of Washington, D.C.',\n    subtitle = 'Black non-Hispanic vs. white non-Hispanic'\n  )\nggsave(file.path('man', 'figures', 'sp.png'), height = 7, width = 7)\n```\n\n![](man/figures/sp.png)\n\n### Funding\n\nThis package was originally developed while the author was a postdoctoral fellow supported by the [Cancer Prevention Fellowship Program](https://cpfp.cancer.gov) at the [National Cancer Institute](https://www.cancer.gov). Any modifications since December 05, 2022 were made while the author was an employee of [DLH, LLC](https://www.dlhcorp.com) (formerly Social \u0026 Scientific Systems, Inc. and DLH Corporation).\n\n### Acknowledgments\n\nThe [`messer()`](R/messer.R) function functionalizes the code found in [Hruska et al. (2022)](https://doi.org/10.1016/j.janxdis.2022.102529) available on an [OSF repository](https://doi.org/10.17605/OSF.IO/M2SAV), but with percent with income less than $30K added to the computation based on [Messer et al. (2006)](https://doi.org/10.1007/s11524-006-9094-x). The [`messer()`](R/messer.R) function also allows for the computation of *NDI* (Messer) for each year between 2010-2020 (when the U.S. census characteristics are available to date). There was no code companion to compute *NDI* (Powell-Wiley) included in [Andrews et al. (2020)](https://doi.org/10.1080/17445647.2020.1750066) or [Slotman et al. (2022)](https://doi.org/10.1016/j.dib.2022.108002) only a [description](https://www.gis.cancer.gov/research/NeighDeprvIndex_Methods.pdf), but the package author worked directly with the latter manuscript authors to replicate their [*SAS*](https://www.sas.com) code in [**R**](https://cran.r-project.org/) for the [`powell_wiley()`](R/powell_wiley.R) function. See the Accumulating Data to Optimally Predict Obesity Treatment [(ADOPT)](https://gis.cancer.gov/research/adopt.html) Core Measures Project for more details. Please note: the *NDI* (Powell-Wiley) values will not exactly match (but will highly correlate with) those found in [Andrews et al. (2020)](https://doi.org/10.1080/17445647.2020.1750066) and [Slotman et al. (2022)](https://doi.org/10.1016/j.dib.2022.108002) because the two studies used a different statistical platform (i.e., [*SPSS*](https://www.ibm.com/products/spss) and [*SAS*](https://www.sas.com), respectively) that intrinsically calculate the principal component analysis differently from [**R**](https://cran.r-project.org/). The internal function to calculate the Atkinson Index with the Hölder mean is based on the `Atkinson()` function in the [*DescTools*](https://cran.r-project.org/package=DescTools) package.\n\nWhen citing this package for publication, please follow:\n\n    citation('ndi')\n\n### Questions? Feedback?\n\nFor questions about the package, please contact the maintainer [Dr. Ian D. Buller](mailto:ian.buller@alumni.emory.edu) or [submit a new issue](https://github.com/idblr/ndi/issues). Confirmation of the computation, feedback, and feature collaboration is welcomed, especially from the authors of the references cited above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidblr%2Fndi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidblr%2Fndi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidblr%2Fndi/lists"}