Skip to content

Commit f046b96

Browse files
authored
✨ Initial commit for branch "dev_morgan_denton" (ndi v0.1.6.9014) (#31)
* Added `morgan_denton()` function to compute the aspatial racial or ethnic Distance-Decay Interaction Index (_DPxy\*_) based on [Morgan (1983)](https://www.jstor.org/stable/20001935) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
1 parent d84f01e commit f046b96

18 files changed

+914
-44
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ndi
22
Title: Neighborhood Deprivation Indices
3-
Version: 0.1.6.9013
3+
Version: 0.1.6.9014
44
Date: 2024-09-02
55
Authors@R:
66
c(person(given = "Ian D.",

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export(lieberson)
1818
export(massey)
1919
export(massey_duncan)
2020
export(messer)
21+
export(morgan_denton)
2122
export(morgan_massey)
2223
export(powell_wiley)
2324
export(sudano)

NEWS.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ndi (development version)
22

3-
## ndi v0.1.6.9013
3+
## ndi v0.1.6.9014
44

55
### New Features
66

@@ -17,10 +17,11 @@
1717
* Added `duncan_duncan()` function to compute the aspatial racial or ethnic Relative Centralization (*RCE*) based on [Duncan & Duncan (1955b)](https://doi.org/10.1086/221609) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
1818
* Added `massey()` function to compute the aspatial racial or ethnic Absolute Clustering (*ACL*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
1919
* Added `massey_duncan()` function to compute the aspatial racial or ethnic Absolute Concentration (*ACO*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) and Duncan, Cuzzort, & Duncan (1961; LC:60007089)
20+
* Added `morgan_denton()` function to compute the aspatial racial or ethnic Distance-Decay Interaction Index (_DPxy\*_) based on [Morgan (1983)](https://www.jstor.org/stable/20001935) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
2021
* 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)
2122

2223
#### New Function Capabilities
23-
* 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_massey()`, `sudano()`, `theil()`, and `white()`, `white_blau()` functions.
24+
* 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_denton()`, `morgan_massey()`, `sudano()`, `theil()`, and `white()`, `white_blau()` functions.
2425
* Added census block group computation for `anthopolos()` by specifying `geo == 'cbg'` or `geo == 'block group'`
2526
* 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`.
2627
* Added `crs` argument to `anthopolos()`, `bravo()`, and `white_blau()` functions to provide spatial projection of the distance-based metrics

R/globals.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ globalVariables(
283283
'n_1',
284284
'n_2',
285285
't_cs',
286-
'DPxx_star'
286+
'DPxx_star',
287+
'DPxy_star'
287288
)
288289
)

R/morgan_denton.R

+450
Large diffs are not rendered by default.

R/morgan_massey.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#'
4040
#' Use the internal \code{state} and \code{county} arguments within the \code{\link[tidycensus]{get_acs}} function to specify geographic extent of the data output.
4141
#'
42-
#' _DPxx\*_ is a measure of clustering of racial or ethnic populations within smaller geographical units that are located within larger geographical units. _DPxx\*_ is some measure of the probability that a member of one subgroup(s) will meet or interact with a member of another subgroup(s). _DPxx\*_ can range in value from 0 to 1 with higher values signifying higher probability of isolation (less isolation).
42+
#' _DPxx\*_ is a measure of clustering of racial or ethnic populations within smaller geographical units that are located within larger geographical units. _DPxx\*_ is some measure of the probability that a member of one racial or ethnic subgroup will meet or interact with a member of the same racial or ethnic subgroup. _DPxx\*_ can range in value from 0 to 1 with higher values signifying higher probability of isolation (less isolation).
4343
#'
4444
#' The metric uses the exponential transform of a distance matrix (kilometers) between smaller geographical area centroids, with a diagonal defined as \code{(0.6*a_{i})^{0.5}} where \code{a_{i}} is the area (square kilometers) of smaller geographical unit \code{i} as defined by White (1983) \doi{10.1086/227768}.
4545
#'
@@ -293,7 +293,7 @@ morgan_massey <- function(geo_large = 'county',
293293
dplyr::mutate(subgroup = rowSums(as.data.frame(.)[, in_subgroup]))
294294
}
295295

296-
# Compute DPxx_star
296+
# Compute DPxx*
297297
## From Massey & Denton (1988) https://doi.org/10.1093/sf/67.2.281
298298
## DP_{xx}^{*}=\sum_{i=1}^{n}\frac{x_{i}}{X}\sum_{j=1}^{n}\frac{K_{ij}x_{j}}{t_{j}}
299299
## Where for i & j smaller geographical units:

R/ndi-package.R

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#'
4545
#' \code{\link{massey_duncan}} Computes the aspatial Absolute Concentration (\emph{ACO}) based on Massey & Denton (1988) \doi{10.1093/sf/67.2.281} and Duncan, Cuzzort, & Duncan (1961; LC:60007089).
4646
#'
47+
#' \code{\link{morgan_denton}} Computes the aspatial Distance-Decay Interaction Index (\emph{DPxy\*}) based on Morgan (1986) \url{https://www.jstor.org/stable/20001935} and Massey & Denton (1988) \doi{10.1093/sf/67.2.281}.
48+
#'
4749
#' \code{\link{morgan_massey}} Computes the aspatial Distance-Decay Isolation Index (\emph{DPxx\*}) based on Morgan (1986) \url{https://www.jstor.org/stable/20001935} and Massey & Denton (1988) \doi{10.1093/sf/67.2.281}.
4850
#'
4951
#' \code{\link{sudano}} Computes the aspatial Location Quotient (\emph{LQ}) based on Merton (1939) \doi{10.2307/2084686} and Sudano et al. (2013) \doi{10.1016/j.healthplace.2012.09.015}.

R/utils.R

+29-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,35 @@ djt_fun <- function(x, omit_NAs) {
221221
}
222222
}
223223

224-
# Internal function for Distance Decay Isolation
224+
# Internal function for Distance-Decay Interaction Index
225+
## From Massey & Denton (1988) https://doi.org/10.1093/sf/67.2.281
226+
## Returns NA value if only one smaller geography with population in a larger geography
227+
dpxy_star_fun <- function(x, crs, omit_NAs) {
228+
xx <- x %>%
229+
dplyr::select(TotalPopE, subgroup, subgroup_ixn, ALAND) %>%
230+
dplyr::filter(TotalPopE > 0)
231+
if (omit_NAs == TRUE) { xx <- xx[stats::complete.cases(sf::st_drop_geometry(xx)), ] }
232+
if (nrow(sf::st_drop_geometry(xx)) < 2 || any(sf::st_drop_geometry(xx) < 0) || any(is.na(sf::st_drop_geometry(xx)))) {
233+
NA
234+
} else {
235+
xx <- xx %>% sf::st_transform(crs = crs)
236+
x_i <- x_j <- xx$subgroup
237+
X <- sum(x_i, na.rm = TRUE)
238+
y_j <- xx$subgroup_ixn
239+
t_j <- xx$TotalPopE
240+
d_ij <- suppressWarnings(sf::st_distance(sf::st_centroid(xx), sf::st_centroid(xx)))
241+
diag(d_ij) <- sqrt(0.6 * xx$ALAND)
242+
c_ij <- -d_ij %>%
243+
units::set_units(value = km) %>%
244+
units::drop_units() %>%
245+
exp()
246+
K_ij <- c_ij * t_j / sum(c_ij * t_j, na.rm = TRUE)
247+
DPxx_star <- sum(x_i / X, na.rm = TRUE) * sum(K_ij * y_j / t_j, na.rm = TRUE)
248+
return(DPxx_star)
249+
}
250+
}
251+
252+
# Internal function for Distance-Decay Isolation Index
225253
## From Massey & Denton (1988) https://doi.org/10.1093/sf/67.2.281
226254
## Returns NA value if only one smaller geography with population in a larger geography
227255
dpxx_star_fun <- function(x, crs, omit_NAs) {

README.md

+52-1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ To install the development version from GitHub:
115115
<td>Compute the aspatial Neighborhood Deprivation Index (<i>NDI</i>) based on <a href='https://doi.org/10.1007/s11524-006-9094-x'>Messer et al. (2006)</a></td>
116116
</tr>
117117
<tr>
118+
<td><a href='/R/morgan_denton.R'><code>morgan_denton</code></a></td>
119+
<td>Compute the aspatial racial or ethnic Distance-Decay Interaction Index (<i>DPxy*</i>) based on <a href='https://www.jstor.org/stable/20001935'>Morgan (1983)</a> and <a href='https://doi.org/10.1093/sf/67.2.281'>Massey & Denton (1988)</a>
120+
</tr>
121+
<tr>
118122
<td><a href='/R/morgan_massey.R'><code>morgan_massey</code></a></td>
119123
<td>Compute the aspatial racial or ethnic Distance-Decay Isolation Index (<i>DPxx*</i>) based on <a href='https://www.jstor.org/stable/20001935'>Morgan (1983)</a> and <a href='https://doi.org/10.1093/sf/67.2.281'>Massey & Denton (1988)</a>
120124
</tr>
@@ -1356,7 +1360,7 @@ ggplot() +
13561360
# Compute aspatial racial or ethnic Isolation Index (Lieberson) #
13571361
# ------------------------------------------------------------- #
13581362

1359-
# Interaction Index based on Lieberson (1981) and Bell (1954)
1363+
# Isolation Index based on Lieberson (1981) and Bell (1954)
13601364
## Selected subgroup: Not Hispanic or Latino, Black or African American alone
13611365
## Selected large geography: census tract
13621366
## Selected small geography: census block group
@@ -1492,6 +1496,53 @@ ggsave(file.path('man', 'figures', 'aco.png'), height = 7, width = 7)
14921496

14931497
![](man/figures/aco.png)
14941498

1499+
```r
1500+
# --------------------------------------------------------------------------- #
1501+
# Compute aspatial racial or ethnic Distance-Decay Interaction Index (Morgan) #
1502+
# --------------------------------------------------------------------------- #
1503+
1504+
# Distance-Decay Interaction Index based on Morgan (1983) and Massey & Denton (1988)
1505+
## Selected subgroup: Not Hispanic or Latino, Black or African American alone
1506+
## Selected interaction subgroup: Not Hispanic or Latino, Black or African American alone
1507+
## Selected large geography: census tract
1508+
## Selected small geography: census block group
1509+
DPxy_star_2020_DC <- morgan_denton(
1510+
geo_large = 'tract',
1511+
geo_small = 'cbg',
1512+
state = 'DC',
1513+
year = 2020,
1514+
subgroup = 'NHoLB',
1515+
subgroup_ixn = 'NHoLW'
1516+
)
1517+
1518+
# Obtain the 2020 census tracts from the 'tigris' package
1519+
tract_2020_DC <- tracts(state = 'DC', year = 2020, cb = TRUE)
1520+
1521+
# Join the DPxx* (Morgan) values to the census tract geometry
1522+
DPxy_star_2020_DC <- tract_2020_DC %>%
1523+
left_join(DPxy_star_2020_DC$dpxy_star, by = 'GEOID')
1524+
1525+
ggplot() +
1526+
geom_sf(
1527+
data = DPxy_star_2020_DC,
1528+
aes(fill = DPxy_star),
1529+
color = 'white'
1530+
) +
1531+
theme_bw() +
1532+
scale_fill_viridis_c(limits = c(0, 1)) +
1533+
labs(
1534+
fill = 'Index (Continuous)',
1535+
caption = 'Source: U.S. Census ACS 2016-2020 estimates'
1536+
) +
1537+
ggtitle(
1538+
'Distance-Decay Interaction Index (Morgan)\nCensus block groups within tracts of Washington, D.C.',
1539+
subtitle = 'Black non-Hispanic vs. white non-Hispanic'
1540+
)
1541+
ggsave(file.path('man', 'figures', 'dpxy_star.png'), height = 7, width = 7)
1542+
```
1543+
1544+
![](man/figures/dpxy_star.png)
1545+
14951546
```r
14961547
# ------------------------------------------------------------------------- #
14971548
# Compute aspatial racial or ethnic Distance-Decay Isolation Index (Morgan) #

cran-comments.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
* Added `lieberson()` function to compute the aspatial racial or ethnic Isolation Index (_xPx\*_) based on Lieberson (1981; ISBN-13:978-1-032-53884-6) and and [Bell (1954)](https://doi.org/10.2307/2574118)
1111
* Added `massey()` function to compute the aspatial racial or ethnic Absolute Clustering (*ACL*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
1212
* Added `massey_duncan()` function to compute the aspatial racial or ethnic Absolute Concentration (*ACO*) based on [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281) and Duncan, Cuzzort, & Duncan (1961; LC:60007089)
13+
* Added `morgan_denton()` function to compute the aspatial racial or ethnic Distance-Decay Interaction Index (_DPxy\*_) based on [Morgan (1983)](https://www.jstor.org/stable/20001935) and [Massey & Denton (1988)](https://doi.org/10.1093/sf/67.2.281)
1314
* 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)
1415
* 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)
1516
* 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)
16-
* 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_massey()`, `sudano()`, `theil()`, and `white()`, `white_blau()` functions.
17+
* 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.
1718
* Added census block group computation for `anthopolos()` by specifying `geo == 'cbg'` or `geo == 'block group'`
1819
* 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`.
1920
* Added `crs` argument to `anthopolos()`, `bravo()`, and `white_blau()` functions to provide spatial projection of the distance-based metrics

inst/CITATION

+41-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ bibentry(bibtype = 'manual',
33
author = as.person('Ian D. Buller'),
44
publisher = 'The Comprehensive R Archive Network',
55
year = '2024',
6-
number = '0.1.6.9013.',
6+
number = '0.1.6.9014.',
77
doi = '10.5281/zenodo.6989030',
88
url = 'https://cran.r-project.org/package=ndi',
99

1010
textVersion =
1111
paste('Ian D. Buller (2024).',
1212
'ndi: Neighborhood Deprivation Indices.',
1313
'The Comprehensive R Archive Network.',
14-
'v0.1.6.9013.',
14+
'v0.1.6.9014.',
1515
'DOI:10.5281/zenodo.6989030',
1616
'Accessed by: https://cran.r-project.org/package=ndi'),
1717

@@ -460,6 +460,45 @@ bibentry(bibtype = 'Book',
460460
header = 'And (2):'
461461
)
462462

463+
bibentry(bibtype = 'Article',
464+
title = 'A Distance-Decay Based Interaction Index to Measure Residential Segregation',
465+
author = as.person('Barrie S. Morgan'),
466+
journal = 'Area',
467+
year = '1983',
468+
volume = '15',
469+
issue = '4',
470+
pages = '211--217',
471+
url = 'https://www.jstor.org/stable/20001935',
472+
473+
textVersion =
474+
paste('Barrie S. Morgan (1983).',
475+
'A Distance-Decay Based Interaction Index to Measure Residential Segregation.',
476+
'Area, 15(4), 211-217.',
477+
'https://www.jstor.org/stable/20001935'),
478+
479+
header = 'If you computed DPxy* (Morgan) values, please also cite (1):'
480+
)
481+
482+
bibentry(bibtype = 'Article',
483+
title = 'The Dimensions of Residential Segregation',
484+
author = c(as.person('Douglas S. Massey'),
485+
as.person('Nancy A. Denton')),
486+
journal = 'Social Forces',
487+
year = '1988',
488+
volume = '67',
489+
issue = '2',
490+
pages = '281--315',
491+
doi = '10.1093/sf/67.2.281',
492+
493+
textVersion =
494+
paste('Douglas S. Massey & Nancy A. Denton (1988).',
495+
'The Dimensions of Residential Segregation.',
496+
'Social Forces, 67(1), 281-315.',
497+
'DOI:10.1093/sf/67.2.281'),
498+
499+
header = 'And (2):'
500+
)
501+
463502
bibentry(bibtype = 'Article',
464503
title = 'A Distance-Decay Based Interaction Index to Measure Residential Segregation',
465504
author = as.person('Barrie S. Morgan'),

man/figures/dpxy_star.png

378 KB
Loading

0 commit comments

Comments
 (0)