Learn R Programming

seg (version 0.2-2)

spseg: Calculate Spatial Segregation Measures

Description

Calculate Reardon and O'Sullivan's four spatial segregation measures.

Usage

spseg(x, data, method = "all", smoothing = "none", nrow = 100, 
      ncol = 100, window, sigma, useC = TRUE, negative.rm = FALSE, 
      tol = .Machine$double.eps, verbose = FALSE, ...)
SegSpatial(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 class SegLocalEnv.
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 (at least two popul
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
smoothing
a character string indicating a smoothing method. This must be (an abbreviation of) one of the strings "none" (default), "kernel", or "equal".
nrow
an optional numeric value indicating the number of row cells in the rasterised data surface. Ignored if smoothing = "none".
ncol
an optional numeric value indicating the number of column cells.
window
an optional object of class owin to be passed to smooth.ppp. See Details.
sigma
an optional numeric value specifying standard deviation of isotropic Gaussian smoothing kernel to be passed to density.ppp. See also Details.
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
the tolerance for detecting differences between values. Differences in the input values that are smaller than tol should make no changes in the output index values. The default is .Machine$double.eps. See help(.Machine)
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 getLocalEnv to compute the population composition of each local environment.

Value

  • An object of class SegSpatialExt.

Details

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

spseg is a wrapper function, which calls SegSpatial after constructing a population density surface and its local environment parameters with user-specified options. Currently the population density surface is estimated using the rasterize function in the raster package if the population density is assumed to be uniform in each census tract, or using density.ppp in the spatstat package if the kernel density estimation is to be used. The local environment parameters are calculated based on the output surface using getSegLocalEnv.

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

getSegLocalEnv, SegSpatial-class, rasterize, density.ppp

Examples

Run this code
# Create a random data set with 50 data points and 3 population groups
xy <- matrix(runif(100), ncol = 2)
pop <- matrix(runif(150), ncol = 3)
rana <- spseg(xy, pop, smoothing = "kernel", maxdist = 0.5)
ranb <- spseg(xy, pop, smoothing = "kernel", useExp = FALSE, 
            power = 0, maxdist = 0.5)
print(ranb, digits = 3)
par(mfrow = c(1, 3), mar = c(0, 1, 0, 2.5))
plot(ranb, main = "")

# Auckland population data set
data(auckpop2006)
pp <- spseg(auckpop2006, smoothing = "kernel", maxdist = 3000)
print(pp, digits = 3)
par(mfrow = c(2, 3), mar = c(1, 1, 2.5, 2.5))
plot(pp, main = names(auckpop2006))
slot(pp, "sigma")
qq <- spseg(auckpop2006, smoothing = "kernel", maxdist = 3000, sigma = 3000)
print(qq, digits = 3)
par(mfrow = c(2, 3), mar = c(1, 1, 2.5, 2.5))
plot(qq, main = names(auckpop2006))
rr <- spseg(auckpop2006, smoothing = "kernel", maxdist = 3000, sigma = 700)
print(rr, digits = 3)
par(mfrow = c(2, 3), mar = c(1, 1, 2.5, 2.5))
plot(rr, main = names(auckpop2006))

ee <- spseg(auckpop2006, smoothing = "equal", maxdist = 3000)
print(ee, digits = 3)
par(mfrow = c(2, 3), mar = c(1, 1, 2.5, 2.5))
plot(ee, main = names(auckpop2006))
ff <- spseg(auckpop2006, smoothing = "equal", maxdist = 100)
gg <- spseg(auckpop2006, smoothing = "kernel", nrow = 300, ncol = 300, 
            maxdist = 3000, verbose = TRUE)

Run the code above in your browser using DataLab