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

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

1 2 3 4 5 |

`x` |
a numeric matrix or data frame with coordinates (each row is a point), or an object of class |

`env` |
an object of |

`data` |
an object of class |

`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 |

`sigma` |
an optional numeric value specifying the kernel bandwidth to be passed to |

`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 |

`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.

An object of `SegSpatial-class`

.

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.

Seong-Yun Hong

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.

`SegSpatial-class`

, `localenv`

, `kernel2d`

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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.