Last chance! 50% off unlimited learning
Sale ends in
seg
calculates Duncan and Duncan's index of dissimilarity between two population groups. If seg(data, nb, tol = .Machine$double.eps)
matrix
object describing the intensity of interaction between geographic units..Machine$double.eps
. See help(.Machine)
seg
calculates the traditional index of dissimilarity proposed by Duncan and Duncan (1955).
If help(nb2mat)
for more information regarding how to construct such a matrix.
For Wong's D(w) and D(s), see https://sites.google.com/site/hongseongyun/seg. Note that the sum of all elements in spseg
, whiteseg
if (require(spdep)) {
grd <- GridTopology(cellcentre.offset=c(0.5,0.5),
cellsize=c(1,1), cells.dim=c(10,10))
grd.sp <- as.SpatialPolygons.GridTopology(grd)
grd.nb <- nb2mat(poly2nb(grd.sp, queen = FALSE), style = "B")
grd.nb <- grd.nb / sum(grd.nb)
data(segdata)
parval <- par()
par(mfrow = c(2, 4), mar = c(0, 1, 0, 1))
d <- numeric()
m <- numeric()
for (i in 1:8) {
idx <- 2 * i
d <- append(d, seg(segdata[,(idx-1):idx]))
m <- append(m, seg(segdata[,(idx-1):idx], grd.nb))
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),
", D(adj) = ", round(m[i], 2), sep = ""))
}
par(mfrow = parval$mfrow, mar = parval$mar)
}
Run the code above in your browser using DataLab