Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates the decomposable segregation measure developed by Sadahiro and Hong (2013).
1 2 |
x |
a numeric matrix or data frame with coordinates (each row is a point), or an object of class |
data |
an object of class |
smoothing |
a character string indicating how to perform spatial smoothing of the population data. Currently only “kernel” is supported. |
nrow |
a numeric value indicating the number of row cells in the rasterised data surface. |
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 |
verbose |
logical. If TRUE, print the current stage of the computation and time spent on each job to the screen. |
The decomposable segregation measure is a surface-based, non-spatial method. The index calculation does not take into account the spatial arrangement of the population. It is the spatial smoothing process that deals with the spatial aspect of segregation. If the spatial smoothing is not performed properly, this measure may suffer from the same checkerboard problem as the traditional index of dissimilarity.
Currently deseg
uses the function kernel2d
in splancs, which employs a quartic kernel estimator. The points outside ‘window’ are not considered when computing the kernel estimates. The argument ‘window’ must be a polygon represented in a matrix form such that each row corresponds to a vertex. This is passed to kernel2d
as ‘poly’. If ‘window’ is missing, a square that covers all points in ‘x’ will be used.
If ‘sigma’ is not given, bw.nrd
in stats is used to find the optimal bandwidth.
An object of SegDecomp-class
.
Seong-Yun Hong
Sadahiro, Y. and Hong, S.-Y. (2013) Decomposition approach to the measurement of spatial segregation. CSIS Discussion Paper Series, 119, 1-33.
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 45 46 47 48 49 | # 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)
# displays the test data
plot(grd.sp)
plot(grd.sp[segdata[,9] == 100,], col = "Black", add = TRUE)
plot(grd.sp[segdata[,9] == 50,], col = "Grey", add = TRUE)
# tries different bandwidths for the same data
bw1 <- deseg(grd.sp, segdata[,9:10], sigma = 1, nrow = 20, ncol = 20)
print(bw1, digits = 3)
bw1.val <- sum(as.vector(bw1))
spplot(bw1, col.regions=rev(heat.colors(20)),
main = paste("Bandwidth = 1, S =", round(bw1.val, 2)))
bw2 <- deseg(grd.sp, segdata[,9:10], sigma = 2, nrow = 20, ncol = 20)
print(bw2, digits = 3)
bw2.val <- sum(as(bw2, "vector"))
spplot(bw2, col.regions=rev(heat.colors(20)),
main = paste("Bandwidth = 2, S =", round(bw2.val, 2)))
## Not run:
# let's see how the index value changes with different bandwidths
h0 <- seq(1, 5, length.out = 10); vals <- numeric()
for (i in 1:10) {
d <- deseg(grd.sp, segdata[,9:10], sigma = h0[i], verbose = TRUE)
vals <- append(vals, sum(as(d, "vector")))
}
plot(h0, vals, type = "b", xlab = "Bandwidth", ylab = "S")
title(main = "segdata[,9:10]")
# calculates the index for all data sets in 'segdata'
d.segdata <- matrix(NA, nrow = 3, ncol = 8)
for (i in 1:8) {
idx <- 2 * i
tmp <- deseg(grd.sp, segdata[,(idx-1):idx])
d.segdata[,i] <- as(tmp, "vector")
}
# presents the results as a bar chart
barplot(d.segdata, names.arg = LETTERS[1:8], main = "segdata",
legend.text = c(expression(italic(paste("S"[L]))),
expression(italic(paste("S"[C]))),
expression(italic(paste("S"[Q])))),
args.legend = list(x = "topright", horiz = TRUE))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.