data(elec88)
# Dissimilarity matrix.
d0 <- dist(elec88$xy/100)
# Frequency distribution maximizing spatial diversity in France
# according to Rao's quadratic entropy.
France.m <- divcmax(d0)
w0 <- France.m$vectors$num
v0 <- France.m$value
idx <- (1:94) [w0 > 0]
if(!adegraphicsLoaded()) {
# Smallest circle including all the 94 departments.
# The squared radius of that circle is the maximal value of the
# spatial diversity.
w1 <- elec88$xy[idx, ]/100
w.c <- apply(w1 * w0[idx], 2, sum)
plot(elec88$xy[, 1]/100, elec88$xy[, 2]/100, asp=1)
symbols(w.c[1], w.c[2], circles = sqrt(v0), inches = FALSE, add = TRUE)
s.value(elec88$xy/100, w0, add.plot = TRUE)
}
Run the code above in your browser using DataLab