From 87c2246833d251137e7e4c4e6bf7298440626c8d Mon Sep 17 00:00:00 2001 From: Ian D Buller Date: Fri, 30 May 2025 12:40:59 -0400 Subject: [PATCH 1/4] :hammer: Prepare for PR (#32) * `Hmisc` now Imports --- DESCRIPTION | 3 ++- NAMESPACE | 1 + NEWS.md | 4 ++-- R/ndi-package.R | 1 + cran-comments.md | 2 +- inst/CITATION | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index beb4e11..992cc63 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ndi Title: Neighborhood Deprivation Indices -Version: 0.1.6.9015 +Version: 0.1.6.9016 Date: 2025-05-30 Authors@R: c(person(given = "Ian D.", @@ -38,6 +38,7 @@ Depends: Imports: car, dplyr, + Hmisc, MASS, Matrix, psych, diff --git a/NAMESPACE b/NAMESPACE index fca523d..7c9c88f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -26,6 +26,7 @@ export(theil) export(white) export(white_blau) import(dplyr) +importFrom(Hmisc,wtd.quantile) importFrom(MASS,ginv) importFrom(Matrix,sparseMatrix) importFrom(car,logit) diff --git a/NEWS.md b/NEWS.md index 4f1df9e..01563f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # ndi (development version) -## ndi v0.1.6.9015 +## ndi v0.1.6.9016 ### New Features @@ -40,7 +40,7 @@ * Output of racial or ethnic residential segregation indices is now rounded to four significant digits #### New Dependencies -* `tigris` and `units` are now Imports +* `Hmisc`, `tigris`, and `units` are now Imports #### Updated Documentation * Split up vignette into three separate vignettes: 'ndi1', 'ndi2', and 'ndi3' for the *NDI*, racial or ethnic residential segregation, and additional socioeconomic disparity indices, respectively diff --git a/R/ndi-package.R b/R/ndi-package.R index 5a55dea..8511dd9 100644 --- a/R/ndi-package.R +++ b/R/ndi-package.R @@ -94,6 +94,7 @@ #' @import dplyr #' @importFrom car logit +#' @importFrom Hmisc wtd.quantile #' @importFrom MASS ginv #' @importFrom Matrix sparseMatrix #' @importFrom psych alpha principal diff --git a/cran-comments.md b/cran-comments.md index ca6f1d1..a632574 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -26,7 +26,7 @@ * Fixed bug in `atkinson()` function to properly compute the income Atkinson Index * Renamed *AI* as *A*, *DI* as *D*, *Gini* as *G*, and *II* as _xPy\*_ to align with the definitions from [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281). The output for `atkinson()` now produces `a` instead of `ai`. The output for `duncan()` now produces `d` instead of `ai`. The output for `gini()` now produces `g` instead of `gini`. The output for `bell()` now produces `xPy_star` instead of `II`. The internal functions `ai_fun()`, `di_fun()` and `ii_fun()` were renamed `a_fun()`, `ddd_fun()` and `xpy_star_fun()`, respectively. * Output of racial or ethnic residential segregation indices is now rounded to four significant digits - * `tigris` and `units` are now Imports + * `Hmisc`, `tigris`, and `units` are now Imports * Reformatted functions for consistent internal structure * 'package.R' deprecated. Replaced with 'ndi-package.R' and reordered the contents * Consolidated DESCRIPTION diff --git a/inst/CITATION b/inst/CITATION index 2c6d77a..76d5dc1 100755 --- a/inst/CITATION +++ b/inst/CITATION @@ -3,7 +3,7 @@ bibentry(bibtype = 'manual', author = as.person('Ian D. Buller'), publisher = 'The Comprehensive R Archive Network', year = '2025', - number = '0.1.6.9015.', + number = '0.1.6.9016.', doi = '10.32614/CRAN.package.ndi', url = 'https://cran.r-project.org/package=ndi', From b7bedd7346d52064d5e756c6e10b054f8dac1215 Mon Sep 17 00:00:00 2001 From: Hunter Mills Date: Fri, 30 May 2025 13:10:55 -0700 Subject: [PATCH 2/4] :bug: Fix to `powell_wiley()` categorical outcome (PR #32) * Updated population-weighted quantile method from `stats::quantile` to `Hmisc::wtd.quantile` * Updated import statement in `powell_wiley()` --- R/powell_wiley.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/powell_wiley.R b/R/powell_wiley.R index d0af3f1..861f8c4 100644 --- a/R/powell_wiley.R +++ b/R/powell_wiley.R @@ -55,10 +55,11 @@ #' @import dplyr #' @importFrom MASS ginv #' @importFrom psych alpha principal -#' @importFrom stats complete.cases cor cov2cor loadings median promax quantile sd +#' @importFrom stats complete.cases cor cov2cor loadings median promax sd #' @importFrom stringr str_trim #' @importFrom tidycensus get_acs #' @importFrom tidyr pivot_longer separate +#' @importFrom Hmisc wtd.quantile #' @export #' #' @examples @@ -350,9 +351,10 @@ powell_wiley <- function(geo = 'tract', NDIQuint <- ndi_data_NDI %>% dplyr::mutate( NDIQuint = cut( - NDI * log(TotalPop), - breaks = stats::quantile( - NDI * log(TotalPop), + NDI, + breaks = Hmisc::wtd.quantile( + NDI, + weights = TotalPop, probs = c(0, 0.2, 0.4, 0.6, 0.8, 1), na.rm = TRUE ), From 072eddd60caa70431efc7bdbf80d0696273d39de Mon Sep 17 00:00:00 2001 From: Ian D Buller Date: Fri, 30 May 2025 16:24:27 -0400 Subject: [PATCH 3/4] :memo: Additional documentation for PR #32 --- NEWS.md | 1 + R/powell_wiley.R | 4 ++-- README.md | 2 ++ cran-comments.md | 1 + man/powell_wiley.Rd | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 01563f1..d828c91 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,6 +32,7 @@ #### Bug Fixes * Fixed NOTE in CRAN checks to provide package anchors for Rd \link{} targets not in the package itself and the base packages within 'ndi-package.Rd' +* Updated population-weighted quantile method from `stats::quantile` to `Hmisc::wtd.quantile` in `powell_wiley()` thanks to a contribution (#32) by [Hunter Miller](https://github.com/huntermills707) * `bell()` function computes the Interaction Index (Bell) not the Isolation Index as previously documented. Updated documentation throughout. * Fixed bug in `bell()`, `bemanian_beyer()`, `duncan()`, `sudano()`, and `white()` functions when a smaller geography contains n=0 total population, will assign a value of zero (0) in the internal calculation instead of NA * Fixed bug in `atkinson()` function to properly compute the income Atkinson Index diff --git a/R/powell_wiley.R b/R/powell_wiley.R index 861f8c4..a694a26 100644 --- a/R/powell_wiley.R +++ b/R/powell_wiley.R @@ -31,7 +31,7 @@ #' #' Use the internal \code{state} and \code{county} arguments within the \code{\link[tidycensus]{get_acs}} function to specify the referent for standardizing the \emph{NDI} (Powell-Wiley) values. For example, if all U.S. states are specified for the \code{state} argument, then the output would be a U.S.-standardized index. Please note: the \emph{NDI} (Powell-Wiley) values will not exactly match (but will highly correlate with) those found in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} and Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} because the two studies used a different statistical platform (i.e., SPSS and SAS, respectively) that intrinsically calculate the principal component analysis differently from R. #' -#' The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. +#' The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.1.6, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. #' #' Check if the proportion of variance explained by the first principal component is high (more than 0.5). #' @@ -53,13 +53,13 @@ #' @references Slotman, BA, Stinchcomb, DG, Powell-Wiley, TM, Ostendorf, DM, Saelens, BE, Gorin, AA, Zenk, SN, & Berrigan, D (2022) Environmental Data and Methods from the Accumulating Data to Optimally Predict Obesity Treatment (ADOPT) Core Measures Environmental Working Group. \emph{Data in Brief}, 41:108002. \doi{10.1016/j.dib.2022.108002} #' #' @import dplyr +#' @importFrom Hmisc wtd.quantile #' @importFrom MASS ginv #' @importFrom psych alpha principal #' @importFrom stats complete.cases cor cov2cor loadings median promax sd #' @importFrom stringr str_trim #' @importFrom tidycensus get_acs #' @importFrom tidyr pivot_longer separate -#' @importFrom Hmisc wtd.quantile #' @export #' #' @examples diff --git a/README.md b/README.md index 5ce71cf..0aec613 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,8 @@ See also the list of [contributors](https://github.com/idblr/ndi/graphs/contribu * **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) +* **Hunter Mills** - [GitHub](https://github.com/huntermills707) + * **Chris Prener** - *Real World Evidence Center of Excellence, Pfizer, Inc.* - [GitHub](https://github.com/chris-prener) - [ORCID](https://orcid.org/0000-0002-4310-9888) * **Davis Vaughan** - *Posit* - [GitHub](https://github.com/DavisVaughan) - [ORCID](https://orcid.org/0000-0003-4777-038X) diff --git a/cran-comments.md b/cran-comments.md index a632574..edb2f0d 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -21,6 +21,7 @@ * The `gini()` function now computes the aspatial racial or ethnic Gini Index (*G*) based on [Gini (1921)](https://doi.org/10.2307/2223319) as the main outcome. Arguments `geo_large`, `geo_small`, `subgroup`, and `omit_NAs` were added and argument `geo` was deprecated. The `gini()` function still retrieves the original output of the aspatial income Gini Index (*G*) at each smaller geography and is moved from the `g` output to `g_data` output. * Specifying census block groups in `geo` or `geo_small` arguments is now `'block group'` or `'cbg'` to match internal `get_acs()` function from the [tidycensus](https://CRAN.R-project.org/package=tidycensus) package * Fixed NOTE in CRAN checks to provide package anchors for Rd \link{} targets not in the package itself and the base packages within 'ndi-package.Rd' + * Updated population-weighted quantile method from `stats::quantile` to `Hmisc::wtd.quantile` in `powell_wiley()` * `bell()` function computes the Interaction Index (Bell) not the Isolation Index as previously documented. Updated documentation throughout. * Fixed bug in `bell()`, `bemanian_beyer()`, `duncan()`, `sudano()`, and `white()` functions when a smaller geography contains n=0 total population, will assign a value of zero (0) in the internal calculation instead of NA * Fixed bug in `atkinson()` function to properly compute the income Atkinson Index diff --git a/man/powell_wiley.Rd b/man/powell_wiley.Rd index 7393a21..01ac87d 100644 --- a/man/powell_wiley.Rd +++ b/man/powell_wiley.Rd @@ -64,7 +64,7 @@ The function uses the \code{\link[tidycensus]{get_acs}} function to obtain U.S. Use the internal \code{state} and \code{county} arguments within the \code{\link[tidycensus]{get_acs}} function to specify the referent for standardizing the \emph{NDI} (Powell-Wiley) values. For example, if all U.S. states are specified for the \code{state} argument, then the output would be a U.S.-standardized index. Please note: the \emph{NDI} (Powell-Wiley) values will not exactly match (but will highly correlate with) those found in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} and Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} because the two studies used a different statistical platform (i.e., SPSS and SAS, respectively) that intrinsically calculate the principal component analysis differently from R. -The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. +The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.1.6, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. Check if the proportion of variance explained by the first principal component is high (more than 0.5). From 5ef9887ddf6c75ce50412b54b3177ee98e4c8a24 Mon Sep 17 00:00:00 2001 From: Ian D Buller Date: Fri, 29 Aug 2025 01:30:22 -0400 Subject: [PATCH 4/4] Prepare for CRAN v0.2.0 release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 Fixed NOTE in CRAN checks to provide package anchors for Rd `\link{}` targets not in the package itself and the base packages within 'ndi-package.Rd' * 📝 In 'cran-comments.md': added valid URLs, updated test environments, and OK'd author formatting * 📛 Updated DOI badge * 📝 Updated vignettes with latest package version --- DESCRIPTION | 4 +- NEWS.md | 4 +- R/ndi-package.R | 4 +- R/powell_wiley.R | 2 +- README.md | 4 +- cran-comments.md | 34 +++++++++++----- inst/CITATION | 4 +- man/ndi-package.Rd | 2 +- man/powell_wiley.Rd | 2 +- vignettes/ndi1.Rmd | 24 +++++------ vignettes/ndi1.html | 96 ++++++++++++++++++++++--------------------- vignettes/ndi2.html | 99 +++++++++++++++++++++++---------------------- vignettes/ndi3.html | 61 +++++++++++++++------------- 13 files changed, 182 insertions(+), 158 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 992cc63..6f63a86 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ndi Title: Neighborhood Deprivation Indices -Version: 0.1.6.9016 -Date: 2025-05-30 +Version: 0.2.0 +Date: 2025-08-29 Authors@R: c(person(given = "Ian D.", family = "Buller", diff --git a/NEWS.md b/NEWS.md index d828c91..d71bc70 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # ndi (development version) -## ndi v0.1.6.9016 +## ndi v0.2.0 ### New Features @@ -31,7 +31,7 @@ ### Updates #### Bug Fixes -* Fixed NOTE in CRAN checks to provide package anchors for Rd \link{} targets not in the package itself and the base packages within 'ndi-package.Rd' +* Fixed NOTE in CRAN checks to provide package anchors for Rd `\link{}` targets not in the package itself and the base packages within 'ndi-package.Rd' * Updated population-weighted quantile method from `stats::quantile` to `Hmisc::wtd.quantile` in `powell_wiley()` thanks to a contribution (#32) by [Hunter Miller](https://github.com/huntermills707) * `bell()` function computes the Interaction Index (Bell) not the Isolation Index as previously documented. Updated documentation throughout. * Fixed bug in `bell()`, `bemanian_beyer()`, `duncan()`, `sudano()`, and `white()` functions when a smaller geography contains n=0 total population, will assign a value of zero (0) in the internal calculation instead of NA diff --git a/R/ndi-package.R b/R/ndi-package.R index 8511dd9..9c24c76 100644 --- a/R/ndi-package.R +++ b/R/ndi-package.R @@ -83,14 +83,14 @@ #' @name ndi-package #' @aliases ndi-package ndi #' -#' @section Dependencies: The 'ndi' package relies heavily upon \code{\link[tidycensus]{tidycensus}} to retrieve data from the U.S. Census Bureau American Community Survey five-year estimates and the \code{\link[psych]{psych}} for computing the neighborhood deprivation indices. The \code{\link{messer}} function builds upon code developed by Hruska et al. (2022) \doi{10.17605/OSF.IO/M2SAV} by fictionalizing, adding the percent of households earning <$30,000 per year to the \emph{NDI} computation, and providing the option for computing the ACS-5 2006-2010 \emph{NDI} values. There is no code companion to compute \emph{NDI} included in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} or Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002}, but the package author worked directly with the Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} authors to replicate their SAS code in \strong{R}. The indices of racial or ethnic residential segregation rely heavily on the \code{\link[sf]{sf}} and \code{\link[tigris]{tigris}} packages to assign the smaller geographical units within larger geographical units and, occasionally, perform geospatial projection for distance-based metrics. The computation of \emph{RI} and \emph{EI} also relies on the \code{\link[Matrix]{Matrix}} package to compute the geospatial adjacency matrix between census geographies. Internal function to calculate \emph{AI} using the Hölder mean is based on \code{\link[DescTools]{Atkinson}} function. +#' @section Dependencies: The 'ndi' package relies heavily upon \code{\link[tidycensus]{tidycensus-package}} to retrieve data from the U.S. Census Bureau American Community Survey five-year estimates and the \code{\link[psych]{psych-package}} for computing the neighborhood deprivation indices. The \code{\link{messer}} function builds upon code developed by Hruska et al. (2022) \doi{10.17605/OSF.IO/M2SAV} by fictionalizing, adding the percent of households earning <$30,000 per year to the \emph{NDI} computation, and providing the option for computing the ACS-5 2006-2010 \emph{NDI} values. There is no code companion to compute \emph{NDI} included in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} or Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002}, but the package author worked directly with the Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} authors to replicate their SAS code in \strong{R}. The indices of racial or ethnic residential segregation rely heavily on the \code{\link[sf]{sf-package}} and \code{\link[tigris]{tigris-package}} packages to assign the smaller geographical units within larger geographical units and, occasionally, perform geospatial projection for distance-based metrics. The computation of \emph{RI} and \emph{EI} also relies on the \code{\link[Matrix]{sparseMatrix}} function to compute the geospatial adjacency matrix between census geographies. Internal function to calculate \emph{AI} using the Hölder mean is based on \code{\link[DescTools]{Atkinson}} function. #' #' @author Ian D. Buller\cr \emph{DLH, LLC (formerly DLH Corporation and Social & Scientific Systems, Inc.), Bethesda, Maryland, USA (current); Occupational and Environmental Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland, USA (original).} \cr #' #' Maintainer: I.D.B. \email{ian.buller@@alumni.emory.edu} #' #' @keywords internal -'_PACKAGE' +"_PACKAGE" #' @import dplyr #' @importFrom car logit diff --git a/R/powell_wiley.R b/R/powell_wiley.R index a694a26..5dc5769 100644 --- a/R/powell_wiley.R +++ b/R/powell_wiley.R @@ -31,7 +31,7 @@ #' #' Use the internal \code{state} and \code{county} arguments within the \code{\link[tidycensus]{get_acs}} function to specify the referent for standardizing the \emph{NDI} (Powell-Wiley) values. For example, if all U.S. states are specified for the \code{state} argument, then the output would be a U.S.-standardized index. Please note: the \emph{NDI} (Powell-Wiley) values will not exactly match (but will highly correlate with) those found in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} and Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} because the two studies used a different statistical platform (i.e., SPSS and SAS, respectively) that intrinsically calculate the principal component analysis differently from R. #' -#' The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.1.6, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. +#' The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.2.0, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. #' #' Check if the proportion of variance explained by the first principal component is high (more than 0.5). #' diff --git a/README.md b/README.md index 0aec613..6884493 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ [![CRAN RStudio mirror downloads monthly](https://cranlogs.r-pkg.org/badges/ndi)](https://r-pkg.org:443/pkg/ndi) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/license/apache-2-0) ![GitHub last commit](https://img.shields.io/github/last-commit/idblr/ndi) -[![DOI](https://zenodo.org/badge/521439746.svg)](https://zenodo.org/badge/latestdoi/521439746) +[![](https://img.shields.io/badge/DOI-10.32614/CRAN.package.ndi-1f57b6?style=flat&link=https://doi.org/10.32614/CRAN.package.ndi)](https://doi.org/10.32614/CRAN.package.ndi) -**Date repository last updated**: 2025-05-30 +**Date repository last updated**: 2025-08-29 ### Overview diff --git a/cran-comments.md b/cran-comments.md index edb2f0d..388ba35 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,8 @@ ## This is the seventh resubmission * Actions taken since previous submission: + +#### New Functions * Added `denton()` function to compute the aspatial racial or ethnic Relative Clustering (*RCL*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) * Added `denton_cuzzort()` function to compute the aspatial racial or ethnic Relative Concentration (*RCO*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) and Duncan, Cuzzort, & Duncan (1961; LC:60007089) * Added `duncan_cuzzort()` function to compute the aspatial racial or ethnic Absolute Centralization (*ACE*) based on Duncan, Cuzzort, & Duncan (1961; LC:60007089) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) @@ -14,20 +16,28 @@ * Added `morgan_massey()` function to compute the aspatial racial or ethnic Distance-Decay Isolation Index (_DPxx\*_) based on [Morgan (1983)](https://www.jstor.org/stable/20001935) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) * Added `theil()` function the aspatial racial or ethnic Entropy (*H*) based on Theil (1972; ISBN:978-0-444-10378-9) and [Theil & Finizza (1971)](https://doi.org/110.1080/0022250X.1971.9989795) * Added `white_blau()` function to compute an index of spatial proximity (*SP*) based on [White (1986)](https://doi.org/10.2307/3644339) and Blau (1977; ISBN-13:978-0-029-03660-0) + +#### New Function Capabilities * Added `geo_large = 'place'` for census-designated places, `geo_large = 'cbsa'` for core-based statistical areas, `geo_large = 'csa'` for combined statistical areas, and `geo_large = 'metro'` for metropolitan divisions as the larger geographical unit in `atkinson()`, `bell()`, `bemanian_beyer()`, `denton()`, `denton_cuzzort()`, `duncan()`, `duncan_cuzzort()`, `duncan_duncan()`, `hoover()`, `james_taeuber()`, `lieberson()`, `massey()`, `massey_duncan()`, `morgan_denton()`, `morgan_massey()`, `sudano()`, `theil()`, and `white()`, `white_blau()` functions. * Added census block group computation for `anthopolos()` by specifying `geo == 'cbg'` or `geo == 'block group'` * Added `holder` argument to `atkinson()` function to toggle the computation with or without the Hölder mean. The function can now compute *A* without the Hölder mean. The default is `holder = FALSE`. * Added `crs` argument to `anthopolos()`, `bravo()`, and `white_blau()` functions to provide spatial projection of the distance-based metrics * The `gini()` function now computes the aspatial racial or ethnic Gini Index (*G*) based on [Gini (1921)](https://doi.org/10.2307/2223319) as the main outcome. Arguments `geo_large`, `geo_small`, `subgroup`, and `omit_NAs` were added and argument `geo` was deprecated. The `gini()` function still retrieves the original output of the aspatial income Gini Index (*G*) at each smaller geography and is moved from the `g` output to `g_data` output. * Specifying census block groups in `geo` or `geo_small` arguments is now `'block group'` or `'cbg'` to match internal `get_acs()` function from the [tidycensus](https://CRAN.R-project.org/package=tidycensus) package - * Fixed NOTE in CRAN checks to provide package anchors for Rd \link{} targets not in the package itself and the base packages within 'ndi-package.Rd' + +#### Bug Fixes + * Fixed NOTE in CRAN checks to provide package anchors for Rd `\link{}` targets not in the package itself and the base packages within 'ndi-package.Rd' * Updated population-weighted quantile method from `stats::quantile` to `Hmisc::wtd.quantile` in `powell_wiley()` * `bell()` function computes the Interaction Index (Bell) not the Isolation Index as previously documented. Updated documentation throughout. * Fixed bug in `bell()`, `bemanian_beyer()`, `duncan()`, `sudano()`, and `white()` functions when a smaller geography contains n=0 total population, will assign a value of zero (0) in the internal calculation instead of NA * Fixed bug in `atkinson()` function to properly compute the income Atkinson Index * Renamed *AI* as *A*, *DI* as *D*, *Gini* as *G*, and *II* as _xPy\*_ to align with the definitions from [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281). The output for `atkinson()` now produces `a` instead of `ai`. The output for `duncan()` now produces `d` instead of `ai`. The output for `gini()` now produces `g` instead of `gini`. The output for `bell()` now produces `xPy_star` instead of `II`. The internal functions `ai_fun()`, `di_fun()` and `ii_fun()` were renamed `a_fun()`, `ddd_fun()` and `xpy_star_fun()`, respectively. * Output of racial or ethnic residential segregation indices is now rounded to four significant digits + +#### New Dependencies * `Hmisc`, `tigris`, and `units` are now Imports + +#### Updated Documentation * Reformatted functions for consistent internal structure * 'package.R' deprecated. Replaced with 'ndi-package.R' and reordered the contents * Consolidated DESCRIPTION @@ -53,19 +63,25 @@ * * * +* The win-builder oldrelease throws a NOTE that "Author field differs from that derived from Authors@R". The behavior is OK because ORCID has different formatting but same information * Some tests and examples for `anthopolos()`, `atkinson()`, `bell()`, `bemanian_beyer()`, `bravo()`, `denton()`, `denton_cuzzort()`, `duncan()`, `duncan_cuzzort()`, `duncan_duncan()`, `gini()`, `hoover()`, `james_taeuber()`, `krieger()`, `lieberson()`, `massey()`, `massey_duncan()`, `messer()`, `powell_wiley()`, `sudano()`, `theil()`, `white()`, and `white_blau()` functions require a Census API key so they are skipped if NULL or not run ## Test environments -* local Windows install, R 4.4.1 +* local Windows install, R 4.5.1 * win-builder, (devel, release, oldrelease) -* Rhub - * Fedora Linux, R-devel, clang, gfortran - * Ubuntu Linux 20.04.1 LTS, R-release, GCC - * Windows Server 2022, R-devel, 64 bit - * Windows Server 2008 R2 SP1, R-release, 32⁄64 bit - * Oracle Solaris 10, x86, 32 bit, R-release - * macOS 10.13.6 High Sierra, R-release, CRAN's setup +* R-CMD-check on GitHub + * macos-latest (release) + * windows-latest (release) + * ubuntu-latest (devel) + * ubuntu-latest (release) + * ubuntu-latest (oldrel-1) +* Rhub v2 + * macos-15 on GitHub, ASAN + UBSAN on macOS (`m1-san`) + * macos-13 on GitHub(`macos`) + * Fedora Linux 40 (Container Image) (`gcc-asan`) + * Ubuntu 22.04.5 LTS (`ubuntu-clang`) + * Ubuntu 22.04.5 LTS (`ubuntu-gcc12`) ## R CMD check results 0 errors | 0 warnings | 0 notes diff --git a/inst/CITATION b/inst/CITATION index 76d5dc1..e2c9789 100755 --- a/inst/CITATION +++ b/inst/CITATION @@ -3,7 +3,7 @@ bibentry(bibtype = 'manual', author = as.person('Ian D. Buller'), publisher = 'The Comprehensive R Archive Network', year = '2025', - number = '0.1.6.9016.', + number = '0.2.0.', doi = '10.32614/CRAN.package.ndi', url = 'https://cran.r-project.org/package=ndi', @@ -11,7 +11,7 @@ bibentry(bibtype = 'manual', paste('Ian D. Buller (2025)', 'ndi: Neighborhood Deprivation Indices.', 'The Comprehensive R Archive Network.', - 'v0.1.6.9015.', + 'v0.2.0.', 'DOI:10.32614/CRAN.package.ndi', 'Accessed by: https://cran.r-project.org/package=ndi'), diff --git a/man/ndi-package.Rd b/man/ndi-package.Rd index db3d027..1620169 100644 --- a/man/ndi-package.Rd +++ b/man/ndi-package.Rd @@ -88,7 +88,7 @@ Key content of the 'ndi' package include:\cr \code{\link{DCtracts2020}} A sample dataset 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 \code{\link[tidycensus]{get_acs}} function and formatted for the \code{\link{messer}} and \code{\link{powell_wiley}} functions input. } \section{Dependencies}{ - The 'ndi' package relies heavily upon \code{\link[tidycensus]{tidycensus}} to retrieve data from the U.S. Census Bureau American Community Survey five-year estimates and the \code{\link[psych]{psych}} for computing the neighborhood deprivation indices. The \code{\link{messer}} function builds upon code developed by Hruska et al. (2022) \doi{10.17605/OSF.IO/M2SAV} by fictionalizing, adding the percent of households earning <$30,000 per year to the \emph{NDI} computation, and providing the option for computing the ACS-5 2006-2010 \emph{NDI} values. There is no code companion to compute \emph{NDI} included in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} or Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002}, but the package author worked directly with the Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} authors to replicate their SAS code in \strong{R}. The indices of racial or ethnic residential segregation rely heavily on the \code{\link[sf]{sf}} and \code{\link[tigris]{tigris}} packages to assign the smaller geographical units within larger geographical units and, occasionally, perform geospatial projection for distance-based metrics. The computation of \emph{RI} and \emph{EI} also relies on the \code{\link[Matrix]{Matrix}} package to compute the geospatial adjacency matrix between census geographies. Internal function to calculate \emph{AI} using the Hölder mean is based on \code{\link[DescTools]{Atkinson}} function. + The 'ndi' package relies heavily upon \code{\link[tidycensus]{tidycensus-package}} to retrieve data from the U.S. Census Bureau American Community Survey five-year estimates and the \code{\link[psych]{psych-package}} for computing the neighborhood deprivation indices. The \code{\link{messer}} function builds upon code developed by Hruska et al. (2022) \doi{10.17605/OSF.IO/M2SAV} by fictionalizing, adding the percent of households earning <$30,000 per year to the \emph{NDI} computation, and providing the option for computing the ACS-5 2006-2010 \emph{NDI} values. There is no code companion to compute \emph{NDI} included in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} or Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002}, but the package author worked directly with the Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} authors to replicate their SAS code in \strong{R}. The indices of racial or ethnic residential segregation rely heavily on the \code{\link[sf]{sf-package}} and \code{\link[tigris]{tigris-package}} packages to assign the smaller geographical units within larger geographical units and, occasionally, perform geospatial projection for distance-based metrics. The computation of \emph{RI} and \emph{EI} also relies on the \code{\link[Matrix]{sparseMatrix}} function to compute the geospatial adjacency matrix between census geographies. Internal function to calculate \emph{AI} using the Hölder mean is based on \code{\link[DescTools]{Atkinson}} function. } \seealso{ diff --git a/man/powell_wiley.Rd b/man/powell_wiley.Rd index 01ac87d..55eaee7 100644 --- a/man/powell_wiley.Rd +++ b/man/powell_wiley.Rd @@ -64,7 +64,7 @@ The function uses the \code{\link[tidycensus]{get_acs}} function to obtain U.S. Use the internal \code{state} and \code{county} arguments within the \code{\link[tidycensus]{get_acs}} function to specify the referent for standardizing the \emph{NDI} (Powell-Wiley) values. For example, if all U.S. states are specified for the \code{state} argument, then the output would be a U.S.-standardized index. Please note: the \emph{NDI} (Powell-Wiley) values will not exactly match (but will highly correlate with) those found in Andrews et al. (2020) \doi{10.1080/17445647.2020.1750066} and Slotman et al. (2022) \doi{10.1016/j.dib.2022.108002} because the two studies used a different statistical platform (i.e., SPSS and SAS, respectively) that intrinsically calculate the principal component analysis differently from R. -The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.1.6, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. +The categorical \emph{NDI} (Powell-Wiley) values are population-weighted quintiles of the continuous \emph{NDI} (Powell-Wiley) values. NOTE: As of version 0.2.0, population-weighted quintiles are computed using a weighted quantile function \code{\link[Hmisc]{wtd.quantile}} where values are calculated NDI and weights are Total Population instead of previously using \code{\link[stats]{quantile}} of the product of the calculated NDI and natural logarithm transformed total population. Check if the proportion of variance explained by the first principal component is high (more than 0.5). diff --git a/vignettes/ndi1.Rmd b/vignettes/ndi1.Rmd index 7a04c8d..ee6264a 100644 --- a/vignettes/ndi1.Rmd +++ b/vignettes/ndi1.Rmd @@ -70,7 +70,7 @@ A third output from the `messer()` function is a tibble containing a breakdown o messer2010GA$missing ``` -We can visualize the *NDI* (Messer) values geographically by linking them to spatial information from the [*tigris*]([*tidycensus*](https://CRAN.R-project.org/package=tigris) package and plotting with the [*ggplot2*]([*tidycensus*](https://CRAN.R-project.org/package=ggplot2) package suite. +We can visualize the *NDI* (Messer) values geographically by linking them to spatial information from the [*tigris*](https://CRAN.R-project.org/package=tigris) package and plotting with the [*ggplot2*](https://CRAN.R-project.org/package=ggplot2) package suite. ```{r messer_prep, results = 'hide'} # Obtain the 2010 counties from the 'tigris' package @@ -102,7 +102,7 @@ ggplot() + data = county2010GA, fill = 'transparent', color = 'white', - size = 0.2 + size = 0.10 ) + theme_minimal() + scale_fill_viridis_c() + @@ -135,7 +135,7 @@ ggplot() + data = county2010GA, fill = 'transparent', color = 'white', - size = 0.2 + size = 0.10 ) + theme_minimal() + scale_fill_viridis_d(guide = guide_legend(reverse = TRUE), na.value = 'grey80') + @@ -163,7 +163,7 @@ ggplot() + geom_sf( data = GA2010messer_county, aes(fill = NDI), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -190,7 +190,7 @@ ggplot() + geom_sf( data = GA2010messer_county, aes(fill = NDIQuartNA), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -256,7 +256,7 @@ A fourth output from the `powell_wiley()` function is a character string or nume powell_wiley2020DMVW$cronbach ``` -We can visualize the *NDI* (Powell-Wiley) values geographically by linking them to spatial information from the [*tigris*]([*tidycensus*](https://CRAN.R-project.org/package=tigris) package and plotting with the [*ggplot2*]([*tidycensus*](https://CRAN.R-project.org/package=ggplot2) package suite. +We can visualize the *NDI* (Powell-Wiley) values geographically by linking them to spatial information from the [*tigris*](https://CRAN.R-project.org/package=tigris) package and plotting with the [*ggplot2*](https://CRAN.R-project.org/package=ggplot2) package suite. ```{r powell_wiley_prep, results = 'hide'} # Obtain the 2020 counties from the 'tigris' package @@ -346,7 +346,7 @@ ggplot() + geom_sf( data = DMVW2020pw_county, aes(fill = NDI), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -373,7 +373,7 @@ ggplot() + geom_sf( data = DMVW2020pw_county, aes(fill = NDIQuint), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -416,7 +416,7 @@ ggplot() + geom_sf( data = DC2020pw, aes(fill = NDI_nonimp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -431,7 +431,7 @@ ggplot() + geom_sf( data = DC2020pw, aes(fill = NDI_imp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -458,7 +458,7 @@ ggplot() + geom_sf( data = DC2020pw, aes(fill = NDIQuintNA_nonimp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -484,7 +484,7 @@ ggplot() + geom_sf( data = DC2020pw, aes(fill = NDIQuintNA_imp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + diff --git a/vignettes/ndi1.html b/vignettes/ndi1.html index 231e72f..874413d 100644 --- a/vignettes/ndi1.html +++ b/vignettes/ndi1.html @@ -12,7 +12,7 @@ - + 1. Neighborhood Deprivation Indices @@ -340,7 +340,7 @@

1. Neighborhood Deprivation Indices

Ian D. Buller (GitHub: @idblr)

-

2024-08-29

+

2025-08-29

@@ -495,8 +495,8 @@

Compute NDI (Messer)

## 7 PUB 1969 14 0.71 % ## 8 U30 1969 14 0.71 %

We can visualize the NDI (Messer) values geographically by -linking them to spatial information from the [tigris](tidycensus -package and plotting with the [ggplot2](tidycensus +linking them to spatial information from the tigris +package and plotting with the ggplot2 package suite.

# Obtain the 2010 counties from the 'tigris' package
 county2010GA <- counties(state = 'GA', year = 2010, cb = TRUE)
@@ -524,7 +524,7 @@ 

Compute NDI (Messer)

data = county2010GA, fill = 'transparent', color = 'white', - size = 0.2 + size = 0.10 ) + theme_minimal() + scale_fill_viridis_c() + @@ -557,7 +557,7 @@

Compute NDI (Messer)

data = county2010GA, fill = 'transparent', color = 'white', - size = 0.2 + size = 0.10 ) + theme_minimal() + scale_fill_viridis_d(guide = guide_legend(reverse = TRUE), na.value = 'grey80') + @@ -566,7 +566,7 @@

Compute NDI (Messer)

'Neighborhood Deprivation Index (Messer) Quartiles', subtitle = 'GA census tracts as the referent' )
-

+

The results above are at the tract level. The NDI (Messer) values can also be calculated at the county level.

messer2010GA_county <- messer(geo = 'county', state = 'GA', year = 2010)
@@ -580,7 +580,7 @@ 

Compute NDI (Messer)

geom_sf( data = GA2010messer_county, aes(fill = NDI), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -607,7 +607,7 @@

Compute NDI (Messer)

geom_sf( data = GA2010messer_county, aes(fill = NDIQuartNA), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -617,7 +617,7 @@

Compute NDI (Messer)

'Neighborhood Deprivation Index (Messer) Quartiles', subtitle = 'GA counties as the referent' )
-

+

Compute NDI (Powell-Wiley)

@@ -863,9 +863,8 @@

Compute NDI (Powell-Wiley)

powell_wiley2020DMVW$cronbach
## [1] 0.9321693

We can visualize the NDI (Powell-Wiley) values -geographically by linking them to spatial information from the -[tigris](tidycensus -package and plotting with the [ggplot2](tidycensus +geographically by linking them to spatial information from the tigris +package and plotting with the ggplot2 package suite.

# Obtain the 2020 counties from the 'tigris' package
 county2020 <- counties(cb = TRUE)
@@ -923,7 +922,7 @@ 

Compute NDI (Powell-Wiley)

'Neighborhood Deprivation Index (Powell-Wiley) Population-weighted Quintiles', subtitle = 'DC, MD, VA, and WV tracts as the referent' )
-

+

Like the NDI (Messer), we also compute county-level NDI (Powell-Wiley).

# Obtain the 2020 counties from the 'tigris' package
@@ -946,7 +945,7 @@ 

Compute NDI (Powell-Wiley)

geom_sf( data = DMVW2020pw_county, aes(fill = NDI), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -973,7 +972,7 @@

Compute NDI (Powell-Wiley)

geom_sf( data = DMVW2020pw_county, aes(fill = NDIQuint), - size = 0.20, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -983,7 +982,7 @@

Compute NDI (Powell-Wiley)

'Neighborhood Deprivation Index (Powell-Wiley) Population-weighted Quintiles', subtitle = 'DC, MD, VA, and WV counties as the referent' )
-

+

Advanced Features

@@ -1018,7 +1017,7 @@

Imputing missing census variables

geom_sf( data = DC2020pw, aes(fill = NDI_nonimp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -1033,7 +1032,7 @@

Imputing missing census variables

geom_sf( data = DC2020pw, aes(fill = NDI_imp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -1060,7 +1059,7 @@

Imputing missing census variables

geom_sf( data = DC2020pw, aes(fill = NDIQuintNA_nonimp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -1086,7 +1085,7 @@

Imputing missing census variables

geom_sf( data = DC2020pw, aes(fill = NDIQuintNA_imp), - size = 0.2, + size = 0.10, color = 'white' ) + theme_minimal() + @@ -1096,7 +1095,7 @@

Imputing missing census variables

'Neighborhood Deprivation Index (Powell-Wiley) Quintiles, Imputed', subtitle = 'DC census tracts as the referent' )
-

+

Assign the referent (U.S.-Standardized Metric)

@@ -1130,17 +1129,17 @@

Assign the referent (U.S.-Standardized Metric)

'Histogram of US-standardized NDI (Powell-Wiley) values (2013-2017)', subtitle = 'U.S. census tracts as the referent (including AK, HI, and DC)' )
-

+

The process to compute a US-standardized NDI (Powell-Wiley) -took about 4.5 minutes to run on a machine with the features listed at +took about 12.7 minutes to run on a machine with the features listed at the end of the vignette.

sessionInfo()
-
## R version 4.4.1 (2024-06-14 ucrt)
+
## R version 4.5.1 (2025-06-13 ucrt)
 ## Platform: x86_64-w64-mingw32/x64
-## Running under: Windows 10 x64 (build 19045)
+## Running under: Windows 11 x64 (build 26100)
 ## 
 ## Matrix products: default
-## 
+##   LAPACK version 3.12.1
 ## 
 ## locale:
 ## [1] LC_COLLATE=English_United States.utf8 
@@ -1156,28 +1155,31 @@ 

Assign the referent (U.S.-Standardized Metric)

## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: -## [1] tigris_2.1 tidycensus_1.6.5 sf_1.0-16 ndi_0.1.6.9007 -## [5] ggplot2_3.5.1 dplyr_1.1.4 knitr_1.48 +## [1] tigris_2.2.1 tidycensus_1.7.3 sf_1.0-21 ndi_0.2.0 +## [5] ggplot2_3.5.2 dplyr_1.1.4 knitr_1.50 ## ## loaded via a namespace (and not attached): -## [1] gtable_0.3.5 xfun_0.47 bslib_0.8.0 psych_2.4.6.26 -## [5] lattice_0.22-6 tzdb_0.4.0 Cairo_1.6-2 vctrs_0.6.5 -## [9] tools_4.4.1 generics_0.1.3 curl_5.2.2 parallel_4.4.1 -## [13] tibble_3.2.1 proxy_0.4-27 fansi_1.0.6 highr_0.11 -## [17] pkgconfig_2.0.3 Matrix_1.7-0 KernSmooth_2.23-24 uuid_1.2-1 -## [21] lifecycle_1.0.4 farver_2.1.2 compiler_4.4.1 stringr_1.5.1 -## [25] munsell_0.5.1 mnormt_2.1.1 carData_3.0-5 htmltools_0.5.8.1 -## [29] class_7.3-22 sass_0.4.9 yaml_2.3.10 pillar_1.9.0 -## [33] car_3.1-2 crayon_1.5.3 jquerylib_0.1.4 tidyr_1.3.1 -## [37] MASS_7.3-61 classInt_0.4-10 cachem_1.1.0 abind_1.4-5 -## [41] nlme_3.1-166 tidyselect_1.2.1 rvest_1.0.4 digest_0.6.36 -## [45] stringi_1.8.4 purrr_1.0.2 labeling_0.4.3 fastmap_1.2.0 -## [49] grid_4.4.1 colorspace_2.1-1 cli_3.6.3 magrittr_2.0.3 -## [53] utf8_1.2.4 e1071_1.7-14 readr_2.1.5 withr_3.0.1 -## [57] scales_1.3.0 rappdirs_0.3.3 rmarkdown_2.28 httr_1.4.7 -## [61] hms_1.1.3 evaluate_0.24.0 viridisLite_0.4.2 rlang_1.1.4 -## [65] Rcpp_1.0.13 glue_1.7.0 DBI_1.2.3 xml2_1.3.6 -## [69] rstudioapi_0.16.0 jsonlite_1.8.8 R6_2.5.1 units_0.8-5
+## [1] tidyselect_1.2.1 psych_2.5.6 viridisLite_0.4.2 farver_2.1.2 +## [5] fastmap_1.2.0 digest_0.6.37 rpart_4.1.24 lifecycle_1.0.4 +## [9] cluster_2.1.8.1 Cairo_1.6-2 magrittr_2.0.3 compiler_4.5.1 +## [13] rlang_1.1.6 Hmisc_5.2-3 sass_0.4.10 tools_4.5.1 +## [17] utf8_1.2.6 yaml_2.3.10 data.table_1.17.8 labeling_0.4.3 +## [21] htmlwidgets_1.6.4 classInt_0.4-11 mnormt_2.1.1 curl_6.4.0 +## [25] xml2_1.3.8 RColorBrewer_1.1-3 abind_1.4-8 KernSmooth_2.23-26 +## [29] withr_3.0.2 foreign_0.8-90 purrr_1.1.0 nnet_7.3-20 +## [33] grid_4.5.1 e1071_1.7-16 colorspace_2.1-1 scales_1.4.0 +## [37] MASS_7.3-65 cli_3.6.5 rmarkdown_2.29 crayon_1.5.3 +## [41] generics_0.1.4 rstudioapi_0.17.1 httr_1.4.7 tzdb_0.5.0 +## [45] DBI_1.2.3 cachem_1.1.0 proxy_0.4-27 stringr_1.5.1 +## [49] rvest_1.0.4 parallel_4.5.1 base64enc_0.1-3 vctrs_0.6.5 +## [53] Matrix_1.7-3 jsonlite_2.0.0 carData_3.0-5 car_3.1-3 +## [57] hms_1.1.3 Formula_1.2-5 htmlTable_2.4.3 jquerylib_0.1.4 +## [61] tidyr_1.3.1 units_0.8-7 glue_1.8.0 stringi_1.8.7 +## [65] gtable_0.3.6 tibble_3.3.0 pillar_1.11.0 rappdirs_0.3.3 +## [69] htmltools_0.5.8.1 R6_2.6.1 evaluate_1.0.5 lattice_0.22-7 +## [73] readr_2.1.5 backports_1.5.0 bslib_0.9.0 class_7.3-23 +## [77] Rcpp_1.1.0 uuid_1.2-1 gridExtra_2.3 nlme_3.1-168 +## [81] checkmate_2.3.2 xfun_0.52 pkgconfig_2.0.3
diff --git a/vignettes/ndi2.html b/vignettes/ndi2.html index 7e60f77..6c7905f 100644 --- a/vignettes/ndi2.html +++ b/vignettes/ndi2.html @@ -12,7 +12,7 @@ - + 2. Racial or Ethnic Residential Segregation Indices @@ -341,7 +341,7 @@

2. Racial or Ethnic Residential Segregation Indices

Ian D. Buller (GitHub: @idblr)

-

2025-05-30

+

2025-08-29

@@ -621,7 +621,7 @@

Compute Dissimilarity Index (D)

'Dissimilarity Index (James & Taeuber)\nCensus tracts within counties of Pennsylvania', subtitle = 'Black population' ) -

+

The racial or ethnic Gini Index (G)

@@ -673,7 +673,7 @@

The racial or ethnic Gini Index (G)

'Gini Index (Gini)\nCensus tracts within counties of Massachusetts', subtitle = 'Black population' )
-

+

Compute Entropy (H)

@@ -731,7 +731,7 @@

Compute Entropy (H)

'Entropy (Theil)\nCensus tracts within Metro Divisions of Pennsylvania', subtitle = 'Black population' )
-

+

Compute Atkinson Index (A)

@@ -802,7 +802,7 @@

Compute Atkinson Index (A)

'Atkinson Index (Atkinson)\nCensus block groups within counties of Kentucky', subtitle = expression(paste('Black non-Hispanic (', epsilon, ' = 0.67)')) )
-

+

Compute Dissimilarity Index (D)

@@ -858,7 +858,7 @@

Compute Dissimilarity Index (D)

'Dissimilarity Index (Duncan & Duncan)\nCensus tracts within counties of Pennsylvania', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Location Quotient (LQ)

@@ -912,7 +912,7 @@

Compute Location Quotient (LQ)

'Location Quotient (Sudano)\nCounties within state of Tennessee', subtitle = 'Black non-Hispanic' )
-

+

Compute Interaction Index (xPy*)

@@ -962,7 +962,7 @@

Compute Interaction Index (xPy*)

'Interaction Index (Bell)\nCensus tracts within counties of Ohio', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Isolation Index (xPx*)

@@ -1012,7 +1012,7 @@

Compute Isolation Index (xPx*)

'Isolation Index (Lieberson)\nCensus block groups within census tracts of Delaware', subtitle = 'Black non-Hispanic' )
-

+

Compute Correlation Ratio (V)

@@ -1063,7 +1063,7 @@

Compute Correlation Ratio (V)

'Correlation Ratio (White)\nCensus tracts within counties of South Carolina', subtitle = 'Black non-Hispanic' )
-

+

Compute Local Exposure and Isolation (LEx/Is)

@@ -1131,7 +1131,7 @@

Compute Local Exposure and Isolation (LEx/Is)

'Local Exposure and Isolation (Bemanian & Beyer)\nCounties within state of Mississippi', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

# Visualize the exponentiated LEx/Is values (2017-2021 5-year ACS) for Counties within state of Mississippi
 ggplot() +
   geom_sf(
@@ -1153,7 +1153,7 @@ 

Compute Local Exposure and Isolation (LEx/Is)

'Odds ratio of Local Exposure and Isolation (Bemanian & Beyer)\nCounties within state of Mississippi', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Racial Isolation Index (RI)

@@ -1207,7 +1207,7 @@

Compute Racial Isolation Index (RI)

'Racial Isolation Index (Anthopolos)\nCensus tracts of North Carolina', subtitle = 'Black Non-Hispanic populations (not corrected for edge effects)' )
-

+

The current version of the ndi package does not correct for edge effects (e.g., census geographies along the specified spatial extent border, coastline, or U.S.-Mexico / U.S.-Canada @@ -1260,7 +1260,7 @@

Compute Racial Isolation Index (RI)

'Racial Isolation Index (Anthopolos)\nCensus tracts of North Carolina', subtitle = 'Black Non-Hispanic populations (corrected for interstate edge effects)' ) -

+

Compute Delta (DEL)

@@ -1308,7 +1308,7 @@

Compute Delta (DEL)

'Delta (Hoover)\nCensus tracts within counties within Alabama', subtitle = 'Black Non-Hispanic population' )
-

+

Compute Relative Concentration (RCO)

@@ -1372,7 +1372,7 @@

Compute Relative Concentration (RCO)

'Relative Concentration (Massey & Duncan)\nCensus tracts within core-based statistical areas of Wisconsin', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Absolute Concentration (ACO)

@@ -1429,7 +1429,7 @@

Compute Absolute Concentration (ACO)

'Absolute Concentration (Massey & Duncan)\nCensus tracts within core-based statistical areas of Wisconsin', subtitle = 'Black population' )
-

+

Compute Absolute Centralization (ACE)

@@ -1501,7 +1501,7 @@

Compute Absolute Centralization (ACE)

'Absolute Centralization (Duncan & Cuzzort)\nCensus block groups within census-designated places of Connecticut', subtitle = 'Black population' )
-

+

Compute Relative Centralization (RCE)

@@ -1578,7 +1578,7 @@

Compute Relative Centralization (RCE)

'Relative Centralization (Duncan & Duncan)\nCensus block groups within census-designated places of Connecticut', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Absolute Clustering (ACL)

@@ -1639,7 +1639,7 @@

Compute Absolute Clustering (ACL)

'Absolute Clustering (Massey & Denton)\nCensus block groups within census tracts of Harris County, TX', subtitle = 'Black population' )
-

+

Compute an index of spatial proximity (SP)

@@ -1704,7 +1704,7 @@

Compute an index of spatial proximity (SP)

'An index of spatial proximity (White)\nCensus tracts within combined statistical areas of Georgia', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Relative Clustering (RCL)

@@ -1765,7 +1765,7 @@

Compute Relative Clustering (RCL)

'Relative Clustering (Massey & Denton)\nCensus block groups within census tracts of Harris County, TX', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Distance-Decay Isolation Index (DPxy*)

@@ -1819,7 +1819,7 @@

Compute Distance-Decay Isolation Index (DPxy*)

'Distance-Decay Interaction Index (Morgan)\nCensus tracts within core-based statistical areas of Louisiana', subtitle = 'Black non-Hispanic vs. white non-Hispanic' )
-

+

Compute Distance-Decay Isolation Index (DPxx*)

@@ -1872,14 +1872,14 @@

Compute Distance-Decay Isolation Index (DPxx*)

'Distance-Decay Isolation Index (Morgan)\nCensus tracts within core-based statistical areas of Louisiana', subtitle = 'Black population' )
-

+

sessionInfo()
-
## R version 4.4.1 (2024-06-14 ucrt)
+
## R version 4.5.1 (2025-06-13 ucrt)
 ## Platform: x86_64-w64-mingw32/x64
-## Running under: Windows 10 x64 (build 19045)
+## Running under: Windows 11 x64 (build 26100)
 ## 
 ## Matrix products: default
-## 
+##   LAPACK version 3.12.1
 ## 
 ## locale:
 ## [1] LC_COLLATE=English_United States.utf8 
@@ -1895,28 +1895,31 @@ 

Compute Distance-Decay Isolation Index (DPxx*)

## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: -## [1] tigris_2.2.1 tidycensus_1.7.1 sf_1.0-21 ndi_0.1.6.9015 -## [5] ggplot2_3.5.2 dplyr_1.1.4 knitr_1.48 +## [1] tigris_2.2.1 tidycensus_1.7.3 sf_1.0-21 ndi_0.2.0 +## [5] ggplot2_3.5.2 dplyr_1.1.4 knitr_1.50 ## ## loaded via a namespace (and not attached): -## [1] gtable_0.3.6 xfun_0.47 bslib_0.8.0 psych_2.5.3 -## [5] lattice_0.22-6 tzdb_0.5.0 Cairo_1.6-2 vctrs_0.6.5 -## [9] tools_4.4.1 generics_0.1.4 curl_6.2.3 parallel_4.4.1 -## [13] tibble_3.2.1 proxy_0.4-27 highr_0.11 pkgconfig_2.0.3 -## [17] Matrix_1.7-0 KernSmooth_2.23-24 RColorBrewer_1.1-3 uuid_1.2-1 -## [21] lifecycle_1.0.4 compiler_4.4.1 farver_2.1.2 stringr_1.5.1 -## [25] mnormt_2.1.1 carData_3.0-5 htmltools_0.5.8.1 class_7.3-22 -## [29] sass_0.4.9 yaml_2.3.10 Formula_1.2-5 pillar_1.10.2 -## [33] car_3.1-3 crayon_1.5.3 jquerylib_0.1.4 tidyr_1.3.1 -## [37] MASS_7.3-61 classInt_0.4-11 cachem_1.1.0 wk_0.9.4 -## [41] abind_1.4-8 nlme_3.1-166 tidyselect_1.2.1 rvest_1.0.4 -## [45] digest_0.6.36 stringi_1.8.7 purrr_1.0.4 labeling_0.4.3 -## [49] fastmap_1.2.0 grid_4.4.1 cli_3.6.5 magrittr_2.0.3 -## [53] e1071_1.7-16 readr_2.1.5 withr_3.0.2 scales_1.4.0 -## [57] rappdirs_0.3.3 rmarkdown_2.28 httr_1.4.7 hms_1.1.3 -## [61] evaluate_0.24.0 viridisLite_0.4.2 s2_1.1.9 rlang_1.1.6 -## [65] Rcpp_1.0.14 glue_1.8.0 DBI_1.2.3 xml2_1.3.8 -## [69] rstudioapi_0.16.0 jsonlite_2.0.0 R6_2.6.1 units_0.8-7
+## [1] tidyselect_1.2.1 psych_2.5.6 viridisLite_0.4.2 farver_2.1.2 +## [5] fastmap_1.2.0 digest_0.6.37 rpart_4.1.24 lifecycle_1.0.4 +## [9] cluster_2.1.8.1 Cairo_1.6-2 magrittr_2.0.3 compiler_4.5.1 +## [13] rlang_1.1.6 Hmisc_5.2-3 sass_0.4.10 tools_4.5.1 +## [17] yaml_2.3.10 data.table_1.17.8 labeling_0.4.3 htmlwidgets_1.6.4 +## [21] classInt_0.4-11 mnormt_2.1.1 curl_6.4.0 xml2_1.3.8 +## [25] RColorBrewer_1.1-3 abind_1.4-8 KernSmooth_2.23-26 withr_3.0.2 +## [29] foreign_0.8-90 purrr_1.1.0 nnet_7.3-20 grid_4.5.1 +## [33] e1071_1.7-16 colorspace_2.1-1 scales_1.4.0 MASS_7.3-65 +## [37] cli_3.6.5 rmarkdown_2.29 crayon_1.5.3 generics_0.1.4 +## [41] rstudioapi_0.17.1 httr_1.4.7 tzdb_0.5.0 DBI_1.2.3 +## [45] cachem_1.1.0 proxy_0.4-27 stringr_1.5.1 rvest_1.0.4 +## [49] parallel_4.5.1 s2_1.1.9 base64enc_0.1-3 vctrs_0.6.5 +## [53] Matrix_1.7-3 jsonlite_2.0.0 carData_3.0-5 car_3.1-3 +## [57] hms_1.1.3 Formula_1.2-5 htmlTable_2.4.3 jquerylib_0.1.4 +## [61] tidyr_1.3.1 units_0.8-7 glue_1.8.0 stringi_1.8.7 +## [65] gtable_0.3.6 tibble_3.3.0 pillar_1.11.0 rappdirs_0.3.3 +## [69] htmltools_0.5.8.1 R6_2.6.1 wk_0.9.4 evaluate_1.0.5 +## [73] lattice_0.22-7 readr_2.1.5 backports_1.5.0 bslib_0.9.0 +## [77] class_7.3-23 Rcpp_1.1.0 uuid_1.2-1 gridExtra_2.3 +## [81] nlme_3.1-168 checkmate_2.3.2 xfun_0.52 pkgconfig_2.0.3
diff --git a/vignettes/ndi3.html b/vignettes/ndi3.html index 805bf98..611a8c6 100644 --- a/vignettes/ndi3.html +++ b/vignettes/ndi3.html @@ -12,7 +12,7 @@ - + 3. Additional indices of socioeconomic disparity @@ -341,7 +341,7 @@

3. Additional indices of socioeconomic disparity

Ian D. Buller (GitHub: @idblr)

-

2024-08-30

+

2025-08-29

@@ -445,7 +445,7 @@

Compute income Atkinson Index (A)

'Atkinson Index (Atkinson)\nCensus block groups within counties of Kentucky', subtitle = expression(paste('Median Household Income (', epsilon, ' = 0.33)')) ) -

+

Compute Educational Isolation Index (EI)

@@ -537,7 +537,7 @@

Compute Educational Isolation Index (EI)

'Educational Isolation Index (Bravo)\nCensus tracts of Oklahoma', subtitle = 'Without a four-year college degree (not corrected for edge effects)' )
-

+

Can correct one source of edge effect in the same manner as shown for the RI metric in vignette 2. Racial or Ethnic Residential Segregation Indices

@@ -604,7 +604,7 @@

The income Gini Index (G)

'Gini Index (Gini)\nCensus tracts within counties of Massachusetts', subtitle = 'Median Household Income' ) -

+

Index of Concentration at the Extremes (ICE)

@@ -789,14 +789,14 @@

Index of Concentration at the Extremes (ICE)

'Index of Concentration at the Extremes (Krieger)\nIncome & race or ethnicity combined', subtitle = 'white non-Hispanic (WNH) in 80th inc pctl vs. WNH in 20th inc pctl' )
-

+

sessionInfo()
-
## R version 4.4.1 (2024-06-14 ucrt)
+
## R version 4.5.1 (2025-06-13 ucrt)
 ## Platform: x86_64-w64-mingw32/x64
-## Running under: Windows 10 x64 (build 19045)
+## Running under: Windows 11 x64 (build 26100)
 ## 
 ## Matrix products: default
-## 
+##   LAPACK version 3.12.1
 ## 
 ## locale:
 ## [1] LC_COLLATE=English_United States.utf8 
@@ -812,28 +812,31 @@ 

Index of Concentration at the Extremes (ICE)

## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: -## [1] tigris_2.1 tidycensus_1.6.5 sf_1.0-16 ndi_0.1.6.9008 -## [5] ggplot2_3.5.1 dplyr_1.1.4 knitr_1.48 +## [1] tigris_2.2.1 tidycensus_1.7.3 sf_1.0-21 ndi_0.2.0 +## [5] ggplot2_3.5.2 dplyr_1.1.4 knitr_1.50 ## ## loaded via a namespace (and not attached): -## [1] gtable_0.3.5 xfun_0.47 bslib_0.8.0 psych_2.4.6.26 -## [5] lattice_0.22-6 tzdb_0.4.0 Cairo_1.6-2 vctrs_0.6.5 -## [9] tools_4.4.1 generics_0.1.3 curl_5.2.2 parallel_4.4.1 -## [13] tibble_3.2.1 proxy_0.4-27 fansi_1.0.6 highr_0.11 -## [17] pkgconfig_2.0.3 Matrix_1.7-0 KernSmooth_2.23-24 uuid_1.2-1 -## [21] lifecycle_1.0.4 farver_2.1.2 compiler_4.4.1 stringr_1.5.1 -## [25] munsell_0.5.1 mnormt_2.1.1 carData_3.0-5 htmltools_0.5.8.1 -## [29] class_7.3-22 sass_0.4.9 yaml_2.3.10 pillar_1.9.0 -## [33] car_3.1-2 crayon_1.5.3 jquerylib_0.1.4 tidyr_1.3.1 -## [37] MASS_7.3-61 classInt_0.4-10 cachem_1.1.0 abind_1.4-5 -## [41] nlme_3.1-166 tidyselect_1.2.1 rvest_1.0.4 digest_0.6.36 -## [45] stringi_1.8.4 purrr_1.0.2 labeling_0.4.3 fastmap_1.2.0 -## [49] grid_4.4.1 colorspace_2.1-1 cli_3.6.3 magrittr_2.0.3 -## [53] utf8_1.2.4 e1071_1.7-14 readr_2.1.5 withr_3.0.1 -## [57] scales_1.3.0 rappdirs_0.3.3 rmarkdown_2.28 httr_1.4.7 -## [61] hms_1.1.3 evaluate_0.24.0 viridisLite_0.4.2 rlang_1.1.4 -## [65] Rcpp_1.0.13 glue_1.7.0 DBI_1.2.3 xml2_1.3.6 -## [69] rstudioapi_0.16.0 jsonlite_1.8.8 R6_2.5.1 units_0.8-5
+## [1] tidyselect_1.2.1 psych_2.5.6 viridisLite_0.4.2 farver_2.1.2 +## [5] fastmap_1.2.0 digest_0.6.37 rpart_4.1.24 lifecycle_1.0.4 +## [9] cluster_2.1.8.1 Cairo_1.6-2 magrittr_2.0.3 compiler_4.5.1 +## [13] rlang_1.1.6 Hmisc_5.2-3 sass_0.4.10 tools_4.5.1 +## [17] yaml_2.3.10 data.table_1.17.8 labeling_0.4.3 htmlwidgets_1.6.4 +## [21] classInt_0.4-11 mnormt_2.1.1 curl_6.4.0 xml2_1.3.8 +## [25] RColorBrewer_1.1-3 abind_1.4-8 KernSmooth_2.23-26 withr_3.0.2 +## [29] foreign_0.8-90 purrr_1.1.0 nnet_7.3-20 grid_4.5.1 +## [33] e1071_1.7-16 colorspace_2.1-1 scales_1.4.0 MASS_7.3-65 +## [37] cli_3.6.5 rmarkdown_2.29 crayon_1.5.3 generics_0.1.4 +## [41] rstudioapi_0.17.1 httr_1.4.7 tzdb_0.5.0 DBI_1.2.3 +## [45] cachem_1.1.0 proxy_0.4-27 stringr_1.5.1 rvest_1.0.4 +## [49] parallel_4.5.1 base64enc_0.1-3 vctrs_0.6.5 Matrix_1.7-3 +## [53] jsonlite_2.0.0 carData_3.0-5 car_3.1-3 hms_1.1.3 +## [57] Formula_1.2-5 htmlTable_2.4.3 jquerylib_0.1.4 tidyr_1.3.1 +## [61] units_0.8-7 glue_1.8.0 stringi_1.8.7 gtable_0.3.6 +## [65] tibble_3.3.0 pillar_1.11.0 rappdirs_0.3.3 htmltools_0.5.8.1 +## [69] R6_2.6.1 evaluate_1.0.5 lattice_0.22-7 readr_2.1.5 +## [73] backports_1.5.0 bslib_0.9.0 class_7.3-23 Rcpp_1.1.0 +## [77] uuid_1.2-1 gridExtra_2.3 nlme_3.1-168 checkmate_2.3.2 +## [81] xfun_0.52 pkgconfig_2.0.3