Learn R Programming

seg (version 0.3-3)

whiteseg: Calculate White's Segregation Measure

Description

whiteseg computes White's P index. Unlike the traditional, aspatial index of dissimilarity, this measure incorporates the spatial relationships among the geographic units into the calculation, so it does not suffer from the checkerboard problem.

Usage

whiteseg(x, data, nb, fun, ...)

Arguments

x
a numeric matrix or data frame with coordinates (each row is a point), or an object of class Spatial.
data
an object of class matrix, or one that can be coerced to that class. The number of rows in data should equal the number of geographic units in x, and the number of columns should be greater than one (at least
nb
an optional matrix object indicating the distances between the geographic units.
fun
a function for the calculation of proximity. The function should take a numeric vector as an argument (distance) and return a vector of the same length (proximity). If this is not specified, a negative exponential function is used by default.
...
optional arguments to be passed to dist when calculating the distances between the geographic units in x. Ignored if nb is given. See help(dist) for available options.

Value

  • A single numeric value indicating the degree of segregation; a value of 1 indicates absence of segregation, and values greater than 1.0 indicate clustering. If the index value is less than one, it indicates an unusual form of segregation (i.e., people live closer to other population groups).

Details

nb must be a square matrix (same number of rows and columns) but does not have to be symmetric. When nb is not specified, whiteseg computes the distance matrix of x using the specified optional arguments in ....

References

White, M. J. (1983). The measurement of spatial segregation. The American Journal of Sociology, 88, 1008-1018.

See Also

seg, spseg, dist

Examples

Run this code
require(sp)
grd <- GridTopology(cellcentre.offset=c(0.5,0.5),
                    cellsize=c(1,1), cells.dim=c(10,10))
grd.sp <- as.SpatialPolygons.GridTopology(grd)

data(segdata)
parval <- par()
par(mfrow = c(2, 4), mar = c(0, 1, 0, 1))

d <- numeric()
p <- numeric()
for (i in 1:8) {
  idx <- 2 * i
  d <- append(d, seg(segdata[,(idx-1):idx]))
  p <- append(p, whiteseg(grd.sp, data = segdata[,(idx-1):idx]))
  full <- segdata[,(idx-1)] == 100
  half <- segdata[,(idx-1)] == 50
  plot(grd.sp)
  plot(grd.sp[full,], col = "Black", add = TRUE)
  if (any(half))
    plot(grd.sp[half,], col = "Grey", add = TRUE)
  text(5, 11.5, labels = 
       paste("D = ", round(d[i], 2), ", P = ", round(p[i], 2), sep = ""))
}
par(mfrow = parval$mfrow, mar = parval$mar)

Run the code above in your browser using DataLab