Package 'OasisR'

Title: Outright Tool for the Analysis of Spatial Inequalities and Segregation
Description: A comprehensive set of indexes and tests for social segregation analysis, as described in Tivadar (2019) - 'OasisR': An R Package to Bring Some Order to the World of Segregation Measurement <doi:10.18637/jss.v089.i07>. The package is the most complete existing tool and it clarifies many ambiguities and errors regarding the definition of segregation indices. Additionally, 'OasisR' introduces several resampling methods that enable testing their statistical significance (randomization tests, bootstrapping, and jackknife methods).
Authors: Mihai Tivadar [aut, cre]
Maintainer: Mihai Tivadar <[email protected]>
License: GPL-2 | GPL-3
Version: 3.1.1
Built: 2025-01-06 06:49:46 UTC
Source: CRAN

Help Index


A function to compute the Massey and Denton Absolute Centralisation Index (ACE)

Description

The absolute centralization index measures a group spatial distribution compared to the distribution of land area around the city center. The function can be used in two ways: to provide an area vector and a vector containing the distances between spatial units centroids and the central spatial unit or a external geographic information source (spatial object or shape file).

Usage

ACE(x, a = NULL, dc = NULL, center = 1, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

a

a numeric vector containing spatial unit areas

dc

a numeric vector containing the distances between spatial units centroids and the central spatial unit

center

a numeric value giving the number of the spatial unit that represents the center in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Massey and Denton absolute centralisation index values for each group

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

See Also

ACEPoly,

RCE, RCEPoly, RCEPolyK,

ACEDuncan, ACEDuncanPoly,

ACEDuncanPolyK

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
distc<- distcenter(segdata, center = 28)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACE(x, a = ar, dc=distc) 

ACE(x, spatobj = segdata, center = 28) 

ACE(x, folder = foldername, shape = shapename, center = 28)

A function to compute Duncan's Absolute Centralisation Index (ACEDuncan)

Description

Duncan's absolute centralization index measures the proportion of a group that should change its localization to achieve the same level of centralization as the rest of the population. The function can be used in two ways: to provide a vector containing the distances between spatial/organizational unit centroids or a external geographic information source (spatial object or shape file).

Usage

ACEDuncan(x, dc = NULL, center = 1, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric vector containing the distances between spatial units centroids and the central spatial unit

center

a numeric value giving the number of the spatial unit that represents the center in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Duncan's absolute centralisation index values for each group

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

See Also

ACEDuncanPoly, ACEDuncanPolyK,

RCE, RCEPoly, RCEPolyK

ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
distc<- distcenter(segdata, center = 28)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACEDuncan(x, dc=distc) 

ACEDuncan(x, spatobj = segdata, center = 28) 

ACEDuncan(x, folder = foldername, shape = shapename, center = 28)

A function to compute Duncan's Polycentric Absolute Centralisation Index

Description

Polycentric version of Duncan's absolute centralization index. The function can be used in two ways: to provide a vector containing the distances between spatial/organizational unit centroids or a external geographic information source (spatial object or shape file).

Usage

ACEDuncanPoly(x, dc = NULL, center = 1, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric matrix/vector containing the distances between spatial units centroids and the central spatial unit(s).

center

a numeric vector giving the number of the spatial/organizational units that represents the centers in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Duncan's absolute polycentric centralisation index value for each group

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

ACEDuncan, ACEDuncanPolyK,

RCE, RCEPoly, RCEPolyK

ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACEDuncanPoly(x, spatobj = segdata, center = c(28, 83) )

ACEDuncanPoly(x, folder = foldername, shape = shapename, center = c(28, 83))

center <- c(28, 83)
polydist <- matrix(data = NA, nrow = nrow(x), ncol = length(center))
for (i in 1:ncol(polydist))
  polydist[,i] <- distcenter(spatobj = segdata, center = center[i])
ACEDuncanPoly(x, dc = polydist)

distmin <- vector(length = nrow(x))
for (i in 1:nrow(polydist)) distmin[i] <- min(polydist[i,])
ACEDuncan(x, dc = distmin)

A function to compute Duncan's Constrained Absolute Centralisation Index

Description

Constrained (local) version of Duncan's centralization index. The function can be used in two ways: to provide a matrix containing the distances between spatial/organizational unit centroids or a external geographic information source (spatial object or shape file).

Usage

ACEDuncanPolyK(x, dc = NULL,  K = NULL, kdist = NULL, center = 1,
                spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric matrix/vector containing the distances between spatial units centroids and the central spatial unit(s).

K

the number of neighbourhoods under the influence of a center

kdist

the maximal distance that defines the neighbourhoods influenced by a center

center

a numeric vector giving the number of the spatial units that represent the centers in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Duncan's constrainted absolute centralisation index value for each group

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

Folch D.C and Rey S. J (2016) The centralization index: A measure of local spatial segregation. Papers in Regional Science 95 (3), pp. 555-576

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

ACEDuncan, ACEDuncanPoly,

RCE, RCEPoly, RCEPolyK

ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACEDuncanPolyK(x, spatobj = segdata, center = c(28, 83))

ACEDuncanPolyK(x, folder = foldername, shape = shapename, center = c(28, 83), K = 3)

center <- c(28, 83)
polydist <- matrix(data = NA, nrow = nrow(x), ncol = length(center))
for (i in 1:ncol(polydist))
  polydist[,i] <- distcenter(spatobj = segdata, center = center[i])
ACEDuncanPolyK(x, dc = polydist, kdist = 2)

A function to compute the Massey and Denton Polycentric Absolute Centralisation Index

Description

The absolute centralization index measures a group spatial distribution compared to the distribution of land area around the city center. The function can be used in two ways: to provide an area vector and a vector containing the distances between spatial units centroids and the central spatial unit or a external geographic information source (spatial object or shape file).

Usage

ACEPoly(x, a = NULL, dc = NULL, center = 1, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

a

a numeric vector containing spatial unit areas

dc

a numeric matrix containing the distances between spatial units centroids and the central spatial units

center

a numeric vector giving the number of the spatial units that represent the centers in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Massey and Denton absolute polycentric centralisation index values for each group

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

ACE, RCE,

RCEPoly, RCEPolyK,

ACEDuncan, ACEDuncanPoly,

ACEDuncanPolyK

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACEPoly(x, spatobj = segdata, center = c(28, 83) )

ACEPoly(x, folder = foldername, shape = shapename, center = c(28, 83))

center <- c(28, 83)
polydist <- matrix(data = NA, nrow = nrow(x), ncol = length(center))
for (i in 1:ncol(polydist))
  polydist[,i] <- distcenter(spatobj = segdata, center = center[i])
ACEPoly(x, a = ar, dc = polydist)

distmin <- vector(length = nrow(x))
for (i in 1:nrow(polydist)) distmin[i] <- min(polydist[i,])
ACE(x, a = ar, dc = distmin)

A function to compute Absolute Clustering Index (ACL)

Description

The absolute clustering index, ACL, expresses the average number of a group's members in nearby spatial units, as a proportion of the total population in those spatial units. The spatial interactions can be expressed as a contiguity matrix (with diagonal equal to 1), as an inverse exponential function of the distance between spatial units centers (with diagonal equal to 0.6 of the square root of each spatial units area) or other user specified interaction matrix. The function can be used in two ways: to provide a spatial interactions matrix (a contiguity matrix or a distance matrix) or a external geographic information source (spatial object or shape file).

Usage

ACL(x, spatmat = 'c', c = NULL, queen = FALSE, d = NULL, distin = 'm',  
distout = 'm', diagval = '0', beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

spatmat

the method used for spatial calculations: 'c' for the contiguity matrix (by default) or any other user spatial interaction matrix and 'd' for the inverse exponential function of the distance.

c

a modified binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent or identical, and 0 otherwise.

queen

logical parameter difining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

d

a matrix of the distances between spatial unit centroids

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Absolute Clustering index values for each group

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

See Also

Proximity measures: Pxx, Pxy, Poo, SP

Relative Clustering Index: RCL

Examples

x <- segdata@data[ ,1:2]
contiguity <- contig(segdata)
diag(contiguity) <- 1
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ACL(x, c = contiguity) 

ACL(x, spatobj = segdata)

ACL(x, spatmat = 'd', folder = foldername, shape = shapename) 
 
ACL(x,  spatmat = 'd', diagval = 'a', spatobj = segdata)

ACL(x, d = dist, spatmat = 'd')

A function to compute Absolute Concentration index (ACO)

Description

The absolute concentration index, ACO, computes the total area inhabited by a group, and compares the result to the minimum and maximum possible areas that could be inhabited by that group in the study area. The function can be used in two ways: to provide an area vector or a external geographic information source (spatial object or shape file).

Usage

ACO(x, a = NULL, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

a

a numeric vector containing spatial unit areas

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Absolute Concentration index values for each group

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

See Also

Delta Index: Delta

Relative Concentration Index: RCO

Examples

x <- GreHSize@data[ ,3:5]
ar <- area(GreHSize)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'GreHSize'

ACO(x, a = ar) 

ACO(x, spatobj = GreHSize)

ACO(x, folder = foldername, shape = shapename)

A function to compute the spatial units' areas

Description

The function is based on sf package and can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

area(spatobj = NULL, folder = NULL, shape = NULL)

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

Value

A vector containing the areas of spatial units

See Also

Other spatial functions used for segregation indices computation: contig, perimeter, distance, distcenter, boundaries

Examples

area(segdata) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
area(folder = foldername, shape = shapename)

A function to compute Atkinson segregation index

Description

The spatial version of Atkinson inequality index is based on Lorenz curves. The user can decide wich part of the curve contributes more to the index, by choosing the value of the shape parameter, delta.

Usage

Atkinson (x, delta = 0.5)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

delta

an inequality aversion parameter

Value

A numeric vector containing Atkinson's segregation index values for each group

References

James, D. and K. E. Taeuber (1985) Measures of Segregation. Sociological Methodology 15, pp. 1-32

See Also

One-group evenness indices: ISDuncan, Gini, Gorard, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,7:8]
Atkinson(x) 
Atkinson(x, 0.1)
Atkinson(x, delta = 0.9)

A function to compute the matrix of common boundaries

Description

The function is based on sf package and it can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

boundaries(spatobj = NULL, folder = NULL, shape = NULL)

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

Value

A common boundaries matrix

See Also

Other spatial functions used for segregation indices computation: area, contig, perimeter, distance, distcenter

Examples

boundaries(segdata) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
boundaries(folder = foldername, shape = shapename)

A function to compute multigroup squared coefficient of variation index

Description

The index can be interpreted as a measure of the variance of the spatial representation of the groups accros spatial unite, or as a normalized chi-squared measure of association between groups and units.

Usage

CMulti(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup entropy segregation index value (numeric)

References

Reardon S. F. and Firebaugh G. (2002) Measures of multigroup segregation. Sociological Methodology, 32, pp. 33-67.

See Also

multigroup indices: PMulti, GiniMulti, DMulti, HMulti, RelDivers

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
CMulti(x)

A function to compute the contiguity matrix

Description

The function is based on sf package and can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

contig(spatobj = NULL, folder = NULL, shape = NULL, queen = FALSE)

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

queen

= TRUE for queen criteria, FALSE (by default) for rook criteria

Value

A first order contiguity (adjacency) matrix, where each element [i,j] equals 1 if i-th and j-th spatial units are adjacent, 0 otherwise (queen or rook criteria)

See Also

Other spatial functions used for segregation indices computation: area, perimeter, distance, distcenter, boundaries

Examples

contig(segdata) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
contig(folder = foldername, shape = shapename)

A function to compute Delta index

Description

The Delta index is a specific application of dissimilarity index DIDuncan which simply measures the dissimilarity between the spatial distribution of a group and the spatial distribution of available land. It can be interpreted as the share of group that would have to move to achieve uniform density over all spatial units. The function can be used in two ways: to provide an area vector or a external geographic information source (spatial object or shape file).

Usage

Delta(x, a = NULL, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

a

a numeric vector containing spatial unit areas

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Delta index values for each group

References

Duncan O. D., Cuzzoert and Duncan B. (1961) Problems in analyzing areal data. Statistical geography, Glencoe, Illinois: The free press of Glencoe

See Also

Absolute Concentration Index: ACO

Relative Concentration Index: RCO

Examples

x <- segdata@data[ ,1:2]
ar <- area(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

Delta(x, a = ar) 

Delta(x, spatobj = segdata)

Delta(x, folder = foldername, shape = shapename)

A function to compute Duncan's dissimilarity segregation index

Description

Duncan's dissimilarity index is the segregation index most commonly used in the literature. It is derived from Lorenz curves as the maximum difference between the segregation curve and the diagonal. The index measures the unevenness of a group's spatial distribution compared to another group. It can be interpreted as the share of the group that would have to move to achieve an even distribution compared to another group.

Usage

DIDuncan(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A matrix containing the dissimilarity index values for each pair of groups

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

See Also

Other one-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, HTheil, ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
DIDuncan(x)

A function to compute Morrill's dissimilarity index

Description

Morrill's dissimilarity index is a development of DIDuncan's index which takes into account the interactions between spatial units(contiguity). The function can be used in two ways: to provide a contiguity matrix or a external geographic information source (spatial object or shape file).

Usage

DIMorrill(x, c = NULL, queen = FALSE, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

c

a standard binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, and 0 otherwise.

queen

a logical parameter difining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension) .

Value

A matrix containing the Morrill's dissimilarity index values for each pair of groups

References

Morrill B. (1991) On the measure of geographic segregation. Geography research forum, 11, pp. 25-36.

See Also

Other one-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, HTheil, ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
contiguity <- contig(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

DIMorrill(x, c = contiguity) 

DIMorrill(x, spatobj = segdata, queen = FALSE)

DIMorrill(x, folder = foldername, shape = shapename)

A function to compute K-th order Morrill's dissimilarity index

Description

This function compute an adaptation of Morrill's dissimilarity index which takes into account the interactions between spatial units defined by K order contiguity matrix. The function can be used in two ways: to provide a contiguity matrix or a external geographic information source (spatial object or shape file).

Usage

DIMorrillK(x, ck = NULL, queen = FALSE, spatobj = NULL, 
folder = NULL, shape = NULL, K = 2, f = 'exp', beta = 1, prec = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

ck

a list with contiguity matrix for each order (from 1 to K)

queen

logical parameter difining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension) .

K

contiguity matrix order

f

the distance function, f = 'exp' (by default) for negative exponential function and f = 'rec' for reciprocal function

beta

distance decay parameter

prec

precision parameter. If not NULL, the function stop computing the spatial interaction when the impact on the indice is bellow 10 ^ (-prec)

Value

A matrix containing the Generalized Morrill's dissimilarity index values for each pair of groups

References

Morrill B. (1991) On the measure of geographic segregation. Geography research forum, 11, pp. 25-36.

See Also

Other one-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, HTheil, ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, DIMorrill, DIWong

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

DIMorrillK(x, spatobj = segdata, queen = FALSE, K = 3)

DIMorrillK(x, folder = foldername, shape = shapename, K = 4, f = 'rec')

A function to compute the distance matrix between centroids of spatial units

Description

The function is based on sf package and can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

distance(spatobj = NULL, folder = NULL, shape = NULL,
distin = 'm',  distout = 'm', diagval = '0')

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

distin

input metric conversion, based on measurements package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on measurements package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

the user has the choice of the definition of the diagonal: diagval = '0' (by default) for an 'empty' diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial units area) (White, 1983)

Value

A matrix with the distance between spatial units centroids

See Also

Other spatial functions used for segregation indices computation: area, contig, perimeter, distcenter, boundaries

Examples

distance(segdata) 

foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
distance(folder = foldername, shape = shapename)

A function to compute the distance from spatial units centroids to the center

Description

The function is based on sf package and it can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

distcenter(spatobj = NULL, folder = NULL, shape = NULL, 
center = 1, distin = 'm',  distout = 'm')

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

center

the row number of the center

distin

input metric conversion, based on measurements package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on measurements package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

Value

A vector with the distance to the center's centroid

See Also

Other spatial functions used for segregation indices computation: area, contig, perimeter, distance, boundaries

Examples

distcenter(segdata, center = 46) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
distcenter(folder = foldername, shape = shapename, center = 19)

A function to compute Wongs's dissimilarity index

Description

Wong's dissimilarity index is a development of DIDuncan's which takes into account the interactions between spatial units(common boundaries and perimeter/area ratios). The function can be used in two ways: to provide spatial data ( boundaries matrix, a perimeter vector and an area vector) or a external geographic information source (spatial object or shape file).

Usage

DIWong(x, b = NULL,  a = NULL, p = NULL, ptype = 'int', variant = 's', 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total totals because this will be interpreted as a group

b

a common boundaries matrix where each element Bij equals the shared boundary of i-th and j-th spatial units.

a

a numeric vector containing spatial unit areas

p

a numeric vector containing spatial units perimeters.

ptype

a string variable giving two options for perimeter calculation when a spatial object or shapefile is provided: 'int' to use only interior borders of spatial units, and 'all' to use entire borders, including to the exterior of the area

variant

a character variable that allows to choose the index version: variant = 's' for the dissimilarity index adjusted for contiguous spatial units boundary lengths and perimeter/area ratio (by default) and variant = 'w' for the version without perimeter/area ratio

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the Wong's dissimilarity index values for each pair of groups

References

Wong D. W. S. (1993) Spatial Indices of Segregation. Urban Studies, 30 (3), pp. 559-572.

See Also

Other one-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, DIMorrill, DIMorrillK

Examples

x <- segdata@data[ ,1:2]
bound <- boundaries(segdata)
per <- perimeter(segdata)
ar <- area(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

DIWong(x, b = bound, p = per, a = ar) 

DIWong(x, spatobj = segdata, variant = 'w') 

DIWong(x, folder = foldername, shape = shapename, ptype ='all')

A function to compute multigroup dissimilarity index

Description

multigroup dissimilarity index, is a multigroup version of Duncan's dissimilarity index (DIDuncan)

Usage

DMulti(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup dissimilarity index value (numeric)

References

Sakoda J. N. (1981) A generalized Index of dissimilarity. Demography,18, 245-250

See Also

multigroup indices: PMulti, GiniMulti, HMulti, CMulti, RelDivers

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
DMulti(x)

A function to compute the distance-decay isolation index (DPxx)

Description

The distance decay isolation index, DPxx, is a spatial adaptation of isolation index xPx. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

DPxx(x, d = NULL, distin = 'm',  distout = 'm', diagval = '0', beta = 1, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the distance-decay isolation index values for each group

References

Morgan, B. S. (1983) A Distance-Decay Based Interaction Index to Measure Residential Segregation. Area 15(3), pp. 211-217.

See Also

Isolation indices: xPx, Eta2

Interaction indices: xPy, DPxy

Examples

x <- segdata@data[ ,1:2]
ar <- area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

DPxx(x, d = dist)

DPxx(x, spatobj = segdata, diagval = 'a')

DPxx(x, folder = foldername, shape = shapename, diagval = '0')

A function to compute the distance-decay interaction index (DPxy)

Description

The distance decay interaction index, DPxy, is a spatial adaptation of interaction index xPy. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

DPxy(x, d = NULL, distin = 'm',  distout = 'm', diagval = '0', 
beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the distance-decay interaction index values for each pair of groups

References

Morgan, B. S. (1983) An Alternate Approach to the Development of a Distance-Based Measure of Racial Segregation. American Journal of Sociology 88, pp. 1237-1249.

See Also

Isolation indices: xPx, Eta2, DPxx

Interaction index: xPy

Examples

x <- segdata@data[ ,1:2]
ar <- area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

DPxy(x, d = dist)

DPxy(x, spatobj = segdata, diagval = 'a')

DPxy(x, folder = foldername, shape = shapename, diagval = '0')

A function to compute adjusted isolation index (Eta2)

Description

The adjusted isolation index is the standardized version of the isolation index, xPx, which controls for the effect of total population structure. Using the approximate version of xPx, the adjusted index is equal to Eta2 (the square of the correlation ratio) which, in the case of the binomial variable, is identical to the square of the mean square contingency coefficient phi. It can be used as a segregation score and varies from 0 (minimum segregation) to 1 (maximum segregation).

Usage

Eta2(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A numeric vector containing the adjusted isolation index values for each group

References

Bell W. (1954) A probability model for the measurement of ecological segregation. Social Forces 32(4), pp. 357-364

Duncan O. D. and Duncan B. (1955) Residential Distribution and Occupational Stratification.. American Journal of Sociology 60 (5), pp. 493-503

See Also

Isolation indices: xPx, DPxx

Interaction indices: xPy, DPxy

Examples

x <- segdata@data[ ,1:2]
Eta2(x)

A function to compute Gini's segregation index

Description

The segregation version of the Gini index can be derived from the Lorenz curve as the area between the segregation curve and the diagonal.

Usage

Gini(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A numeric vector containing Gini's segregation index values for each group

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

See Also

Other one-group evenness indices: ISDuncan, Atkinson, Gorard, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
Gini(x)

A function to compute the between group version of segregation Gini index

Description

The between group version of Gini index is obtained by computing the index for a subpopulation formed by each pair of groups

Usage

Gini2(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A matrix containing the between-group Gini index values for each pair of groups

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

Other one-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
Gini2(x)

A function to compute multigroup Gini index

Description

multigroup Gini is a multigroup version of the Gini index

Usage

GiniMulti(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup Gini index value (numeric)

References

Reardon S. F. (1998) Measures of racial diversity and segregation in multigroup and hierarchical structured Populations. Annual meeting of the Eastern Sociological Society, Philadelphia

See Also

multigroup indices: PMulti, GiniMulti, HMulti, CMulti, RelDivers

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
GiniMulti(x)

A function to compute Gorard's segregation index

Description

Gorard's index is an alternative to ISDuncan's index, which measures the dissimilarity between the distribution of a group and the total population.

Usage

Gorard(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total totals because this will be interpreted as a group

Value

A numeric vector containing Gorard's segregation index values for each group

References

Gorard S. (2000) Education and Social Justice. Cardiff, University of Wales Press

See Also

One-group evenness indices: ISDuncan, Gini, Atkinson, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
Gorard(x)

Households distribution by size in Grenoble urban area in 2011

Description

This data set gives the households distribution by size in Grenoble urban area in 2011, including the area vectorial map at municipality level.

Usage

data(GreHSize)

Format

A Spatial object including 52 polygons corresponding to each municipality of Grenoble Urban Area (Insee definition) and following data attributes:

Details

  • code: Municipality code

  • name: Municipality name

  • small: (1-2 persons household)

  • medium: (3-4 persons household)

  • big: (more then 5 persons household)

Source

Insee: Resultats du recensement de la population 2011, Insee


A function to compute local diversity index

Description

Local diversity index, HLoc, is a local adaptation of Pielou's normalized diversity index NShannon.

Usage

HLoc(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A numeric matrix containing the local diversity index values for each spatial unit

References

Theil H. (1972) Statistical Decomposition Analysis. North-Holland, Amsterdam

See Also

Other local indices LQ LShannon, LSimpson

Examples

x <- segdata@data[ ,1:2]
HLoc(x)

A function to compute multigroup entropy segregation index

Description

The multigroup version of Theil's entropy index HTheil

Usage

HMulti(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup entropy segregation index value (numeric)

References

Theil H. (1972) Statistical decomposition analysis: with applications in the social and administrative. Amsterdam, North-Holland, 337 p.

See Also

multigroup indices: PMulti, GiniMulti, DMulti, CMulti, RelDivers

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
HMulti(x)

A function to compute Shannon-Wiener diversity (entropy) index

Description

The Shannon-Wiener diversity index is based on the notion of entropy and measures population heterogeneity.

Usage

HShannon(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The Shannon-Wiener diversity index value (numeric)

References

Shannon C. E. (1948) A mathematical theory of communication. Bell System Technical Journal (27)

See Also

Social diversity indices: NShannon, ISimpson,

multigroup indices: PMulti, GiniMulti, DMulti, HMulti, CMulti, RelDivers

Examples

x <- segdata@data[ ,1:2]
HShannon(x)

A function to compute Theil's entropy segregation index

Description

The entropy index (also called information index) measures departure from evenness by assessing each spatial unit deviation from the entropy in the area.

Usage

HTheil (x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A numeric vector containing Theils's segregation index values for each group

References

Theil H. (1972) Statistical decomposition analysis: with applications in the social and administrative. Amsterdam, North-Holland, 337 p.

See Also

One-group evenness indices: ISDuncan, Gini, Gorard, Atkinson, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
HTheil(x)

A function to compute Duncan & Duncan segregation index

Description

Duncan's segregation index is one-group form of dissimilarity index DIDuncan and measures the unevenness of a group distribution compared to the rest of the population. It can be interpreted as the share of the group that would have to move to achieve an even distribution compared to the rest of the population.

Usage

ISDuncan (x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A numeric vector containing Duncan's segregation index values for each group

References

Duncan O. D. and Duncan B. (1955) Residential Distribution and Occupational Stratification. American Journal of Sociology 60 (5), pp. 493-503

See Also

One-group evenness indices: Gini, Atkinson, Gorard, HTheil, 'ISWong, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
ISDuncan(x)

A function to compute Simpson's interaction index

Description

Simpson's interaction index measures the probability that randomly selected individuals are not in the same group.

Usage

ISimpson(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The Simpson's interaction index value (numeric)

References

Simpson E. H. (1949) Measurement of diversity. Nature 163:688

See Also

Social diversity indices: HShannon, NShannon,

multigroup indices: PMulti, GiniMulti, DMulti, HMulti, CMulti, RelDivers

Examples

x <- segdata@data[ ,1:2]
ISimpson(x)

A function to compute Morrill's segregation index

Description

Morrill's segregation index is a development of ISDuncan's index which takes into account the interactions between spatial units(contiguity). The function can be used in two ways: to provide a contiguity matrix or a external geographic information source (spatial object or shape file).

Usage

ISMorrill(x, c = NULL, queen = FALSE, 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

c

a standard binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, and 0 otherwise.

queen

a logical parameter difining criteria used for the contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension) .

Value

A numeric vector containing Morrill's segregation index values for each group

References

Morrill B. (1991) On the measure of geographic segregation. Geography research forum, 11, pp. 25-36.

See Also

One-group evenness indices: ISDuncan, Gini, Gorard, HTheil, Atkinson, 'ISWong, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
contiguity <- contig(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ISMorrill(x, c = contiguity) 

ISMorrill(x, spatobj = segdata)

ISMorrill(x, folder = foldername, shape = shapename)

A function to compute K-th order Morrill's segregation index

Description

This function computes an adaptation of Morrill's segregation index which takes into account the interactions between spatial units defined by K-th ordered contiguity matrix. The index can be used in two ways: to provide a contiguity units defined by K order contiguity matrix. The function can be used in two matrix or a external geographic information source (spatial object or shape file).

Usage

ISMorrillK(x, ck = NULL, queen = FALSE, spatobj = NULL, folder = NULL, 
shape = NULL, K = 2, f = 'exp', beta = 1, prec = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greaterTR than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

ck

a list containing contiguity matrices coresponding to each order (from 1 to K)

queen

logical parameter defining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the driveis located.

shape

a character vector with the name of the shapefile (without the .shp extension).

K

the order of the contiguity matrix

f

the distance function, f = 'exp' (by default) for negative exponential function and f = 'rec' for reciprocal function

beta

distance decay parameter

prec

precision parameter. If not NULL, the function stop computing the spatial interaction when the impact on the indice is bellow 10 ^ (-prec)

Value

A numeric vector containing Generalized Morrill's segregation index values for each group

References

Morrill B. (1991) On the measure of geographic segregation. Geography research forum, 11, pp. 25-36.

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

One-group evenness indices: ISDuncan, Gini, Gorard, HTheil, Atkinson, 'ISWong, ISMorrill

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ISMorrillK(x, spatobj = segdata, queen = FALSE, K = 3)

ISMorrillK(x, folder = foldername, shape = shapename, K = 4, f = 'rec')

A function to compute Wong's segregation index

Description

Wong's segregation index is a development of ISDuncan's which takes into account the interactions between spatial units (common boundaries and perimeter/area ratio). The function can be used in two ways: to provide spatial data ( boundaries matrix, a perimeter vector and an area vector) or a external geographic information source (spatial object or shape file).

Usage

ISWong(x, b = NULL,  a = NULL, p = NULL, ptype = 'int', variant = 's', 
spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total totals because this will be interpreted as a group

b

a common boundaries matrix where each element Bij equals the shared boundary of i-th and j-th spatial units.

a

a numeric vector containing spatial unit areas

p

a numeric vector containing spatial units perimeters.

ptype

a string variable giving two options for perimeter calculation when a spatial object or shapefile is provided: 'int' to use only interior boundaries of spatial units, and 'all' to use entire boundaries, including the boundaries to the exterior

variant

a character variable that allows to choose the index version: variant = 's' for the index adjusted for contiguous spatial/organizational units boundary lengths and perimeter/area ratio (by default) and variant = 'w' for the version based only on shared boundaries length

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing Wong's segregation index values for each group

References

Wong D. W. S. (1998) Measuring multiethnic spatial segregation. Urban Geography, 19 (1), pp. 77-87.

See Also

One-group evenness indices: ISDuncan, Gini, Gorard, HTheil, 'Atkinson, ISMorrill, ISMorrillK

Between groups dissimilarity indices: DIDuncan, Gini2, DIMorrill, DIMorrillK, DIWong

Examples

x <- segdata@data[ ,1:2]
bound <- boundaries(segdata)
per <- perimeter(segdata)
ar <- area(segdata)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

ISWong(x, b = bound, p = per, a = ar) 

ISWong(x, spatobj = segdata, variant = 's', ptype = 'int')

ISWong(x, folder = foldername, shape = shapename, variant = 'w')

A function to compute location quotients (LQs)

Description

Location quotients compare the relative part of a group in a particular spatial unit, to the relative part of that same group in the area.

Usage

LQ(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A matrix containing the location quotients for each group in each spatial unit

References

Isard W. (1960) Methods of regional analysis: an introduction to regional science. The MIT Press, Cambridge

See Also

Other local indices LShannon HLoc, LSimpson

Examples

x <- segdata@data[ ,1:2]
LQ(x)

A function to compute Shannon-Wiener local diversity (entropy) index

Description

The Shannon-Wiener diversity index is based on the notion of entropy and measures population heterogeneity.

Usage

LShannon(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A vector containing the local Shannon-Wiener diversity index values for each spatial unit

References

Shannon C. E. (1948) A mathematical theory of communication. Bell System Technical Journal (27)

See Also

Other local indices: LQ, HLoc, LSimpson

Examples

x <- segdata@data[ ,1:2]
LShannon(x)

A function to compute local Simpson's index

Description

Local Simpson's interaction index measures the probability that randomly selected individuals are not in the same group in each spatial unit.

Usage

LSimpson (x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

A vector containing the local Simpson's interaction index values for each spatial unit

References

Simpson E. H. (1949) Measurement of diversity. Nature 163:688

See Also

Other local indices: LQ, HLoc, LShannon

Examples

x <- segdata@data[ ,1:2]
LSimpson (x)

A function to compute Shannon-Wiener diversity normalized index

Description

The Shannon-Wiener diversity index is based on the notion of entropy and measures population heterogeneity.

Usage

NShannon(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The Shannon-Wiener normalized diversity index value (numeric)

References

Shannon C. E. (1948) A mathematical theory of communication. Bell System Technical Journal (27)

See Also

Other multigroup eveness indices: HShannon, ISimpson, GiniMulti, DMulti, HMulti, CMulti

Other multigroup indices: PMulti, RelDivers

Examples

x <- segdata@data[ ,1:2]
NShannon(x)

A function to compute Reardon multigroup ordinal segregation indices

Description

A function to compute Reardon (2009) ordinal indices

Usage

ordinalseg(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group. The rows represent the nominal categories (spatial units) and the columns the ordinal categories.

Value

A vector containing Reardon's multigroup ordinal segregation indices: Lambda1 (the ordinal generalization of the information theory index), Lambda2 (the ordinal generalization of the variation ratio index), Lambda3 (the ordinal square root index), and Lambda4 (the ordinal absolute difference index)

References

Reardon S. F. (2009) Measures of ordinal segregation. Research on Economic Inequality, 17, pp. 129-155.

See Also

rankorderseg

Examples

x <- GreHSize@data[ ,3:5]
ordinalseg(x) 

x1 <- matrix(nrow = 4, ncol = 3)
x1[1,] <- c(0, 0, 30)
x1[2,] <- c(0, 20, 10)
x1[3,] <- c(10, 20 ,0)
x1[4,] <- c(30, 0 ,0)

x2 <- matrix(nrow = 4, ncol = 3)
x2[1,] <- c(0, 30, 0)
x2[2,] <- c(0, 10, 20)
x2[3,] <- c(10, 0, 20)
x2[4,] <- c(30, 0, 0)

ordinalseg(x1)
ordinalseg(x2)

A function to compute the spatial units' perimeters

Description

The function is based on on sf package and can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

perimeter(spatobj = NULL, folder = NULL, shape = NULL)

Arguments

spatobj

a spatial object (class sf, sfc or sfg) containing geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

Value

A vector containing the perimeter of spatial units

See Also

Other spatial functions used for segregation indices computation: area, contig, distance, distcenter, boundaries

Examples

perimeter(segdata)  
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
perimeter(folder = foldername, shape = shapename)

A function to compute multigroup normalised exposure (PMulti)

Description

The multigroup normalised isolation index is a multigroup version of the isolation index (xPx)

Usage

PMulti(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup normalised isolation index value (numeric)

References

James, F. J. (1986) A New Generalized 'Exposure-Based' Segregation Index. Sociological Methods and Research, 14, pp. 301-316

Reardon S. F. and G. Firebaugh (2002) Measures of multigroup Segregation. Sociological Methodology, 32(1), pp 33-67

See Also

multigroup indices: GiniMulti, DMulti, HMulti, CMulti, RelDivers

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
PMulti(x)

A function to compute the mean proximity between persons without regard to group (Poo)

Description

Mean proximity, Poo, computes the mean distance between the individuals in the area with no regard for group. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file)

Usage

Poo(x, d = NULL, fdist = 'e', distin = 'm',  distout = 'm', diagval = '0', 
itype = 'multi', beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

itype

a character string defining the index type: itype = 'multi' (by default) for the multigroup index (White, 1986) or itype = 'between' for the between groups version (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

The Poo index value (numeric)

References

White M. J. (1983) The Measurement of Spatial Segregation. American Journal of Sociology, 88, p. 1008-1019

White, M. J. (1986) Segregation and Diversity Measures in Population DistributionE. Population Index 52(2): 198-221.

See Also

Proximity measures: Pxx, Pxy, SP

Clustering Indices: ACL, RCL

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

Poo(x, spatobj = segdata)

Poo(x, folder = foldername, shape = shapename, fdist = 'l') 

Poo(x, spatobj = segdata, diagval ='a')

Poo(x, d = dist, fdist = 'e')

A function to compute the mean proximity between members of a group (Pxx)

Description

Mean proximity, Pxx, computes the mean distance between the members of a group. The distance matrix can be expressed as a linear or as an inverse exponential function of the distance between spatial unit centroids.The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

Pxx(x, d = NULL, fdist = 'e', distin = 'm',  distout = 'm', diagval = '0', 
beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A numeric vector containing the Pxx index values for each group

References

White M. J. (1983) The Measurement of Spatial Segregation. American Journal of Sociology, 88, p. 1008-1019

See Also

Proximity measures: Pxy, Poo, SP

Clustering Indices: ACL, RCL

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

Pxx(x, spatobj = segdata)

Pxx(x, folder = foldername, shape = shapename, fdist = 'l') 

Pxx(x, spatobj = segdata, diagval ='a')

Pxx(x, d = dist, fdist = 'e')

A function to compute the mean proximity between persons of different groups (Pxy)

Description

Mean proximity, Pxy, computes the mean distance between the members of different groups.The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

Pxy(x, d = NULL, fdist = 'e', distin = 'm',  distout = 'm', diagval = '0', 
beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the Pxy index values for each pair of groups

References

White M. J. (1983) The Measurement of Spatial Segregation. American Journal of Sociology, 88, p. 1008-1019

See Also

Proximity measures: Pxx, Poo, SP

Clustering Indices: ACL, RCL

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

Pxy(x, spatobj = segdata)

Pxy(x, folder = foldername, shape = shapename, fdist = 'l') 

Pxy(x, spatobj = segdata, diagval ='a')

Pxy(x, d = dist, fdist = 'e')

A function to compute rank-ordered segregation indices

Description

A function computing Reardon (2011) rank-ordered segregation indices

Usage

rankorderseg(x, polorder = 4, pred = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group. The rows represent the nominal categories (spatial units) and the columns the population distribution as ordered groups divided by thresholds

polorder

order of the polynomial approximation (4 by default)

pred

a numerical vector with percentiles to be predicted. If NULL, the predictions are made at threshold levels

Value

A list containing the results for three rank-ordered indices: rank-order information theory index (Hr), rank-order variation ratio index (Rr) and rank-order square root index (Sr). For each index, a sublist is provided, containing: Index (the rank-ordered index value), Hp/Rp/Sp (a vector containing the ordinal information theory/variance ratio/square root segregation index values at thresholds), Coefficients (the coefficients extracted from the polynomial estimation model, including basic statistics), Predict (a list containing predicted values of the corresponding ordinal index (fit); standard error of predicted means (se.fit); degrees of freedom for residual (df); and residual standard deviations (residuale.scale). If pred is NULL, the function will return the statistics at thresholds)

References

Reardon S. F. (2011) Measures of Income Segregation . The Stanford Center on Poverty and Inequality

See Also

ordinalseg

Examples

x1 <- matrix(nrow = 4, ncol = 7)
x1[1,] <- c( 10,  10, 10, 20, 30, 40, 50)
x1[2,] <- c( 0, 20, 10, 10, 10, 20, 20)
x1[3,] <- c(10, 20,  10, 10, 10, 0, 0 )
x1[4,] <- c(30, 30,  20, 10, 10, 0, 0 )
x2 <- x1
x2[,c(3,4,6,7)] <- x1[,c(6,7,3,4)]

rankorderseg(x1)
rankorderseg(x2, pred = seq(0, 1, 0.1))

A function to compute Duncan's Relative Centralisation Index (RCE)

Description

The relative centralisation index measures the proportion of a group that should change its localization to achieve the same level of centralization as another group. The function can be used in two ways: to provide a vector containing the distances between spatial unit centroids or a external geographic information source (spatial object or shape file).

Usage

RCE(x, dc = NULL, center = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric vector containing the distances between spatial units centroids and the central spatial unit

center

a numeric value giving the number of the spatial unit that represents the center in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the relative centralisation index values for each pair of groups

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

See Also

RCEPoly, RCEPolyK,

ACEDuncan, ACEDuncanPoly,

ACEDuncanPolyK, ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
distc<- distcenter(segdata, center = 28)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

RCE(x, dc=distc) 

RCE(x, spatobj = segdata, center = 28) 

RCE(x, folder = foldername, shape = shapename, center = 28)

A function to compute Duncan's Polycentric Relative Centralisation Index

Description

The polycentric version of the relative centralisation index. The function can be used in two ways: to provide a matrix containing the distances between spatial/organizational unit centroids or a external geographic information source (spatial object or shape file).

Usage

RCEPoly(x, dc = NULL, center = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric matrix/vector containing the distances between spatial units centroids and the central spatial unit(s).

center

a numeric vector giving the number of the spatial units that represent the centers in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the polycentric relative centralisation index values for each pair of groups

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

RCE, RCEPolyK,

ACEDuncan, ACEDuncanPoly,

ACEDuncanPolyK, ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

RCEPoly(x, spatobj = segdata, center = c(28, 83) )

RCEPoly(x, folder = foldername, shape = shapename, center = c(28, 83))

center <- c(28, 83)
polydist <- matrix(data = NA, nrow = nrow(x), ncol = length(center))
for (i in 1:ncol(polydist))
  polydist[,i] <- distcenter(spatobj = segdata, center = center[i])
RCEPoly(x, dc = polydist)

distmin <- vector(length = nrow(x))
for (i in 1:nrow(polydist)) distmin[i] <- min(polydist[i,])
RCE(x, dc = distmin)

A function to compute Constrained Polyentric Relative Centralisation Index

Description

The constrained (local) version of relative centralization index. The function can be used in two ways: to provide a matrix containing the distances between spatial unit centroids or a external geographic information source (spatial object or shape file).

Usage

RCEPolyK(x, dc = NULL,  K = NULL, kdist = NULL, center = 1,
                spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

dc

a numeric matrix/vector containing the distances between spatial units centroids and the central spatial unit(s).

K

the number of neighbourhoods under the influence of a center

kdist

the maximal distance that defines the neighbourhoods influenced by a center

center

a numeric vector giving the number of the spatial units that represent the centers in the table

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

a matrix containing the constrainted polycentric relative centralisation index values for each pair of groups

References

Duncan O. D. and Duncan B. (1955) A Methodological Analysis of Segregation Indexes. American Sociological Review 41, pp. 210-217

Folch D.C and Rey S. J (2016) The centralization index: A measure of local spatial segregation. Papers in Regional Science 95 (3), pp. 555-576

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

RCE, RCEPoly,

ACEDuncan, ACEDuncanPoly,

ACEDuncanPolyK, ACE, ACEPoly

Examples

x <- segdata@data[ ,1:2]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

RCEPolyK(x, spatobj = segdata, center = c(28, 83))

RCEPolyK(x, folder = foldername, shape = shapename, center = c(28, 83), K = 3)

center <- c(28, 83)
polydist <- matrix(data = NA, nrow = nrow(x), ncol = length(center))
for (i in 1:ncol(polydist))
  polydist[,i] <- distcenter(spatobj = segdata, center = center[i])
RCEPolyK(x, dc = polydist, kdist = 2)

A function to compute the relative clustering index (RCL)

Description

The relative clustering index, RCL, compares the mean proximity of a group to the mean proximity of another group. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

RCL(x, d = NULL, fdist = 'e', distin = 'm',  distout = 'm', diagval = '0', 
beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the relative clustering index values for each pair of groups

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

See Also

Proximity measures: Pxx, Pxy, Poo, SP

Clustering Indices: ACL

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

RCL(x, spatobj = segdata)

RCL(x, folder = foldername, shape = shapename, fdist = 'l') 

RCL(x, spatobj = segdata, diagval ='a')

RCL(x, d = dist, fdist = 'e')

A function to compute Relative Concentration index (RCO)

Description

The relative concentration index, measures the share of space occupied by a group compared to another group. The function can be used in two ways: to provide an area vector or a external geographic information source (spatial object or shape file).

Usage

RCO(x, a = NULL, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

a

a numeric vector containing spatial unit areas

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

A matrix containing the relative concentration index values for each pair of groups

References

Massey D. S. and Denton N. A. (1988) The dimensions of residential segregation. Social Forces 67(2), pp. 281-315.

See Also

one-group concentration indices: Delta, ACO

Examples

x <- GreHSize@data[ ,3:5]
ar <- area(GreHSize)
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'GreHSize'

RCO(x, a = ar) 

RCO(x, spatobj = GreHSize)

RCO(x, folder = foldername, shape = shapename)

A function to compute multigroup relative diversity index

Description

The relative diversity index is a multigroup index based on Simpson's interaction index ISimpson

Usage

RelDivers(x)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

Value

The multigroup relative diversity index value (numeric)

References

Carlson S. M. (1992) Trends in race/sex occupational inequality: conceptual and measurement issues. Social Problems, 39, p. 269-290

See Also

multigroup indices: PMulti, GiniMulti, DMulti, HMulti, CMulti

Social diversity indices: HShannon, NShannon, ISimpson,

Examples

x <- segdata@data[ ,1:2]
RelDivers(x)

A function to plot the results of resampling methods

Description

Plot of Monte Carlo simulations results. The function can be used in two ways: buy providing a ResampleTest object, using ResampleTest or a simulated distribution vector, a value and a name of the index

Usage

ResamplePlot(ResampleTest, var = 1, coldist = 'red', colind = 'blue', 
legend = TRUE, legendpos = 'top', cex.legend = 1, bty = 'o')

Arguments

ResampleTest

- a ResampleTest object prodused with ResampleTest function

var

the number of the variable to be plot

coldist

color used to plot the simulated distribution

colind

color used to plot the index

legend

logical parameter, to control the legend's plots

legendpos

a character string giving the legend's position: 'bottomright', 'bottom', 'bottomleft', 'left', 'topleft', 'top', 'topright', 'right' and 'center'.

cex.legend

a numerical value giving the amount by which plotting text and symbols in legend should be magnified relative to the default.

bty

a character string which determines the type of box of the legend. If bty is one of 'o' (the default), 'l', '7', 'c', 'u', or ']' the resulting box resembles the corresponding upper case letter. A value of 'n' suppresses the box.

Value

A plot with resampling theoretical distribution

References

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

ResampleTest

Examples

x <- segdata@data[ ,1:2]

xtest <- ResampleTest (x, fun ='ISMorrill', simtype = 'MonteCarlo', 
                       sampleunit = 'unit', spatobj = segdata)
                       
ResamplePlot(xtest, var = 1)

A function to test segregation indices by resampling

Description

Resampling tests for segregation indexes.

Usage

ResampleTest(
  x,
  fun,
  var = NULL,
  simtype = "MonteCarlo",
  sampleunit = "unit",
  samplesize = NULL,
  perc = c(0.05, 0.95),
  outl = FALSE,
  outmeth = "bp",
  sdtimes = 2,
  IQRrange = 1.5,
  proba = NULL,
  nsim = NULL,
  spatobj = NULL,
  folder = NULL,
  shape = NULL,
  delta = 0.5,
  exact = FALSE,
  d = NULL,
  c = NULL,
  a = NULL,
  ck = NULL,
  f = "exp",
  b = NULL,
  p = NULL,
  spatmat = "c",
  queen = FALSE,
  distin = "m",
  distout = "m",
  diagval = "0",
  fdist = "e",
  itype = "multi",
  dc = NULL,
  center = 1,
  polorder = 4,
  pred = NULL,
  K = 2,
  ptype = "int",
  variant = "s",
  ...
)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

fun

a character vector with the segregation function to be tested

var

vector with the variables to be tested

simtype

a character vector with the type of simulation. If simtype = 'Boot', the function generates bootstrap replications If simtype = 'Jack', the function generates jackknife replications If simtype = 'MonteCarlo', the function produces a randomization test using Monte Carlo simulations

sampleunit

= 'unit' (by default) when the sampling unit is the spatial/organisational unit and sampleunit = 'ind' for individual sampling

samplesize

the size of the sample used for bootstraping. If null, the samplesize equals the number of spatial/organizational units(sampleunit = 'unit') or the total total population (sampleunit = 'ind')

perc

the percentiles for the bootstrap replications

outl

logical parameter for jackknife simulations, if TRUE the function provides the outliers obtained by jackknife iterations

outmeth

- a character vector designing the outliers detection method: outmeth = 'bp' (by default) for boxplot method, outmeth = 'sd' for standard deviation method, outmeth = 'z' for normal scores method, outmeth = 't' for t Student scores method, outmeth = 'chisq' for chi-squared scores method, outmeth = 'mad' for median absolute deviation method. The estimations based on scoring methods are obtained using outliers package

sdtimes

multiplication factor of the standard deviation used for outliers detection with jackknife simulations (2 by default)

IQRrange

determines the boxplot thresholds (1.5 by default) as multiplication of IQR (Inter Quartile Range)

proba

for Monte Carlo simulations, proba is a vector with location probabilities. If proba = NULL, the vector is equiprobable. If outliers are determined with jackknife technique, proba indicates the probability (confidence interval) for scoring tests.

nsim

the number of simulations

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

delta

an inequality aversion parameter

exact

a logical variable to specifiy the index version: exact = FALSE (by default) for the approximate version of the index, and exact = TRUE for the exact version

d

a matrix of the distances between spatial unit centroids

c

a standard binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, and 0 otherwise.

a

a numeric vector containing spatial unit areas

ck

a list containing contiguity matrices coresponding to each order (from 1 to K)

f

the distance function, f = 'exp' (by default) for negative exponential function and f = 'rec' for reciprocal function

b

a common boundaries matrix where each element Bij

p

a numeric vector containing spatial units perimeters.

spatmat

the method used for spatial calculations: 'c' for the contiguity matrix (by default) or any other user spatial interaction matrix and 'd' for the inverse exponential function of the distance.

queen

logical parameter defining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

itype

a character string defining the index type: itype = 'multi' (by default) for the multigroup index (White, 1986) or itype = 'between' for the between groups version (White, 1983)

dc

a numeric vector containing the distances between spatial units centroids and the central spatial unit

center

a numeric value giving the number of the spatial unit that represents the center in the table

polorder

order of the polynomial approximation (4 by default)

pred

a numerical vector with percentiles to be predicted.

K

the order of the contiguity matrix

ptype

a string variable giving two options for perimeter calculation when a spatial object or shapefile is provided: 'int' to use only interior boundaries of spatial units, and 'all' to use entire boundaries, including the boundaries to the exterior

variant

a character variable that allows to choose the index version: variant = 's' for the dissimilarity index adjusted for contiguous spatial units boundary lengths and perimeter/area ratio (by default) and variant = 'w' for the version without perimeter/area ratio

...

other specific parameters

Value

A list including: the index's name, the simulation type, the summary statistics of the simulations, the simulated index distribution, the simulated population distribution, a matrix with outliers (jackknife), a list with outliers values (jackknife)

References

Efron, B., and Tibshirani, R. J. (1993). An Introduction to the Bootstrap. New York, Chapman and Hall

Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39

See Also

ResamplePlot

Examples

x <- segdata@data[ ,1:2]

xtest <- ResampleTest (x, fun ='ISMorrill', simtype = 'MonteCarlo', 
                       sampleunit = 'ind', spatobj = segdata)
xtest$Summary

xtest <- ResampleTest (x, fun ='ISMorrill', simtype = 'Boot', 
                       sampleunit = 'unit', spatobj = segdata)
xtest$Summary

xtest <- ResampleTest (GreHSize@data[,3:5], fun='ISDuncan', simtype = 'Jack', 
                       sampleunit = 'unit',  spatobj = GreHSize, 
                       outl = TRUE, outmeth = 'sd', sdtimes = 3)
xtest$Summary
xtest$OutliersVal

Theoretical two groups distribution on a 10x10 grid map.

Description

The theoretical examples ( Morrill 1991, Wong 1993) adapted from Hong and O'Sullivan (2015). The space is represented by a 10x10 checkboard, with different distributions of two social groups in the area.

Usage

data(segdata)

Format

A 10x10 grid Spatial object and following data attributes:

Details

  • : spatial ID;

  • : municipality name;

  • : pattern A: minority distribution;

  • : pattern A: majority distribution;

  • : pattern B: minority distribution;

  • : pattern B: majority distribution;

  • : pattern C: minority distribution;

  • : pattern C: majority distribution;

  • : pattern D: minority distribution;

  • : pattern D: majority distribution;

  • : pattern E: minority distribution;

  • : pattern E: majority distribution;

  • : pattern F: minority distribution;

  • : pattern F: majority distribution;

  • : pattern G: minority distribution;

  • : pattern G: majority distribution;

  • : pattern H: minority distribution;

  • : pattern H: majority distribution;

  • : pattern I: minority distribution;

  • : pattern I: majority distribution;


A function to clean and prepare the data for segregation analysis

Description

The function cleans and prepares the data for segregation analysis

Usage

segdataclean (x, c = NULL, b = NULL, a = NULL, p = NULL, 
ck = NULL, d = NULL, dc = NULL, spatobj = NULL, folder = NULL, shape = NULL, 
warnings = TRUE)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

c

a standard binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, and 0 otherwise.

b

a common boundaries matrix where each element Bij

a

a numeric vector containing spatial unit areas

p

a numeric vector containing spatial units perimeters.

ck

a list containing contiguity matrices coresponding to each order (from 1 to K)

d

a matrix of the distances between spatial unit centroids

dc

a numeric vector containing the distances between spatial units centroids and the central spatial unit

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

warnings

- warning alert (by default TRUE)

Value

The objects (data matrix, geographical vectors/matrices, spatial objects) cleaned from null rows or columns

See Also

Other local indices: LQ, HLoc, LShannon

Examples

x <- segdata@data[ ,1:2]
x[ ,3] <- rep (0 ,100)
x[1:3, ] <- rep (c(0, 0, 0), 3)
x1 <- x
spatobj <- segdata
cldata <- segdataclean(x1, segdata)
x1 <- cldata$x
spatobj <- cldata$spatobj

c <- contig (segdata)
c <- segdataclean(x, c = c)$c

A function to compute the spatial proximity index (SP)

Description

The spatial proximity index, SP, compares the clustering level (mean proximity) of a group compared to another group. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

Usage

SP(x, d = NULL, fdist = 'e', distin = 'm',  distout = 'm', diagval = '0', 
itype = 'multi', beta = 1, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

d

a matrix of the distances between spatial unit centroids

fdist

the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear.

distin

input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial/organizational unitsarea) (White, 1983)

itype

a character string defining the index type: itype = 'multi' (by default) for the multigroup index (White, 1986), itype = 'between' for the between groups version (White, 1983), or itype = 'one' for the one-group version (Apparicio et al, 2008)

beta

distance decay parameter

spatobj

a spatial object (SpatialPolygonsDataFrame) with geographic information

folder

a character vector with the folder (directory) name indicating where the shapefile is located on the drive

shape

a character vector with the name of the shapefile (without the .shp extension).

Value

If itype = 'multi' the function returns the multigroup spatial proximity index value (numeric). If itype = 'between', the function returns a matrix containing the between group values of the index. If itype = 'one', the function's output is a numeric vector containing the index values for each group

References

White M. J. (1983) The Measurement of Spatial Segregation. American Journal of Sociology, 88, p. 1008-1019.

White, M. J. (1986) Segregation and Diversity Measures in Population DistributionE. Population Index 52(2): 198-221.

Apparicio, P., V. Petkevitch and M. Charron (2008): Segregation Analyzer: A C#.Net application for calculating residential segregation indices, Cybergeo: European Journal of Geography, 414, 1-27.

See Also

Proximity measures: Pxx, Pxy, Poo

Clustering Indices: ACL, RCL

Examples

x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'

SP(x, spatobj = segdata)

SP(x, folder = foldername, shape = shapename, fdist = 'l', itype = 'between') 

SP(x, spatobj = segdata, diagval ='a', itype = 'one')

SP(x, d = dist, fdist = 'e')

A function to compute Bell's isolation index (xPx)

Description

The isolation index, xPx, is an exposure index that measures the probability that two members of a group share the same spatial unit. This index can be calculated using the approximate or the exact method (see Bell, 1954).

Usage

xPx(x, exact = FALSE)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

exact

a logical variable to specifiy the index version: exact = FALSE (by default) for the approximate version of the index, and exact = TRUE for the exact version

Value

A numeric vector containing the isolation index values for each group

References

Bell W. (1954) A probability model for the measurement of ecological segregation. Social Forces 32(4), pp. 357-364

See Also

Isolation indices: Eta2, DPxx

Interaction indices: xPy, DPxy

Examples

x <- segdata@data[ ,7:8]
xPx(x) 
xPx(x, exact = TRUE)

A function to compute interaction index (xPy)

Description

The interaction index, xPy, is an exposure between groups index which measures the probability that a member of a group shares the same spatial unit with a member of another group. The index can be calculated with the approximate or exact method (see Bell, 1954).

Usage

xPy(x, exact = FALSE)

Arguments

x

an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group.

exact

a logical variable to specifiy the index version: exact = FALSE (by default) for the approximate version of the index, and exact = TRUE for the exact version

Value

A matrix containing the interaction index values for each pair of groups

References

Bell W. (1954) A probability model for the measurement of ecological segregation. Social Forces 32(4), pp. 357-364

See Also

Isolation indices: xPx, Eta2, DPxx

Distance decay interaction index: DPxy

Examples

x <- segdata@data[ ,1:2]
xPy(x)