spseg: Spatial Segregation Measures

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/spseg.R

Description

Calculates the set of spatial segregation measures developed by Reardon and O'Sullivan (2004).

Usage

1
2
3
4
5
spseg(x, data, method = "all", smoothing = "none", nrow = 100, ncol = 100, 
      window, sigma, useC = TRUE, negative.rm = FALSE, 
      tol = .Machine$double.eps, verbose = FALSE, ...)
spatseg(env, method = "all", useC = TRUE, negative.rm = FALSE, 
        tol = .Machine$double.eps)

Arguments

x

a numeric matrix or data frame with coordinates (each row is a point), or an object of class Spatial or ppp.

env

an object of SegLocal-class.

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 points in ‘x’, and the number of columns should be greater than one (i.e., at least two population groups are required). This can be missing if ‘x’ has a data frame attached to it.

method

a vector of character strings indicating an measure or measures to be computed. This must be one or more of the strings “all” (default), “exposure”, “information”, “diversity”, and “dissimilarity”. Abbreviations are accepted, as long as it is clear which method is meant.

smoothing

a character string indicating how to perform spatial smoothing of the population data. This must be (an abbreviation of) one of the strings “none” (default), “kernel”, or “equal”.

nrow

a numeric value indicating the number of row cells in the rasterised data surface. Ignored if ‘smoothing’ is “none”.

ncol

a numeric value indicating the number of column cells.

window

an optional object of class matrix to be passed to kernel2d. See ‘Details’ in deseg.

sigma

an optional numeric value specifying the kernel bandwidth to be passed to kernel2d. See also ‘Details’ in deseg.

useC

logical. If TRUE, calculate the segregation values in C.

negative.rm

logical. If TRUE, all geographic units where at least one group (i.e., column) has a population of zero or less will be removed to prevent -Inf or NaN in the information theory index. If FALSE, the non-positive values will be replaced with ‘tol’.

tol

a small, positive non-zero value. See ‘Details’.

verbose

logical. If TRUE, print the current stage of the computation and time spent on each job to the screen.

...

optional arguments to be passed to localenv to compute the population composition of each local environment.

Details

spatseg computes the set of spatial segregation measures proposed by Reardon and O'Sullivan.

spseg is a wrapper function, which calls spatseg after constructing a population density surface and its local environment parameters with user-specified options. Currently the population density surface is constructed by assuming that the population density is uniform in each census tract, or by using kernel2d in the package splancs. In the previous version (< 0.4.1), the function rasterize in raster was used in the case of the former, and density.ppp in spatstat for the latter.

In R, log(0) is defined as -Inf, and 0 * log(0) is NaN (not-a-number), in compliance with the IEEE Standard for Floating-Point Arithmetic. When computing the spatial information theory index, which is a spatial version of the entropy index, this is annoying because 0 * log(0) occurs quite often, especially when one or more groups are small, and/or when the grid size is very small. To work around this problem, the argument ‘tol’ is added, so instead of v * log(v), it calculates (v + tol) * log(v + tol), where v = 0. This makes the entropy practically zero, as ‘tol’ goes towards 0.

Value

An object of SegSpatial-class.

Note

The exposure/isolation index, P, is presented in a matrix form. The spatial exposure of group ‘m’ to group ‘n’ is located in the row ‘m’ and column ‘n’ of the matrix. The matrix is rarely symmetric in practice so the spatial exposure index should be interpreted with care.

The spatial isolation index values are given in the diagonal cells of the matrix; cell value at (m, m) indicates the degree of spatial isolation for group ‘m’ for example.

Author(s)

Seong-Yun Hong

References

Reardon, S. F. and O'Sullivan, D. (2004) Measures of spatial segregation. Sociological Methodology, 34, 121-162.

Reardon, S. F., Farrell, C. R., Matthews, S. A., O'Sullivan, D., Bischoff, K., and Firebaugh, G. (2009) Race and space in the 1990s: Changes in the geographic scale of racial residential segregation, 1990-2000. Social Science Research, 38, 55-70.

See Also

SegSpatial-class, localenv, kernel2d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# uses the idealised landscapes in 'segdata'
data(segdata)
grd <- GridTopology(cellcentre.offset=c(0.5,0.5),
                    cellsize=c(1,1), cells.dim=c(10,10))
grd.sp <- as.SpatialPolygons.GridTopology(grd)
test.df <- segdata[,1:2]

# no spatial smoothing
xx1 <- spseg(grd.sp, data = test.df)
print(xx1, digits = 3)

# plots the values in the slot 'data'
spplot(xx1, main = "No spatial smoothing")

# smoothes the data points
xx2 <- spseg(grd.sp, data = test.df, smoothing = "equal")
print(xx2, digits = 3)
spplot(xx2, main = "Equal")

# uses the kernel smoothing of the data points
xx3 <- spseg(grd.sp, data = test.df, smoothing = "kernel", 
             nrow = 20, ncol = 20)
print(xx3, digits = 3)
spplot(xx3, main = "Kernel")

## Not run: 
# same as the above but with a boundary polygon
w <- matrix(c(1.5, 1.5,
              1.5, 8.5,
              8.5, 8.5,
              8.5, 4.5,
              5.5, 4.5,
              5.5, 1.5), ncol = 2, byrow = TRUE)
xx4 <- spseg(grd.sp, data = segdata[,1:2], smoothing = "kernel", 
             window = w, nrow = 20, ncol = 20)
print(xx4, digits = 3)
spplot(xx4, main = "Kernel with a boundary polygon")

# retrieves the index values
as.list(xx4)

# shows the values in the slot 'env'
spplot(as(xx4, "SegLocal"), main = "Local population composition")
## End(Not run)

seg documentation built on May 29, 2017, 12:20 p.m.

Related to spseg in seg...