Indices for assessing class intervals
jenks.tests.RdThe function returns values of two indices for assessing class intervals: the goodness of variance fit measure, and the tabular accuracy index; optionally the overview accuracy index is also returned if the area argument is not missing.
Details
The goodness of variance fit measure is given by Armstrong et al. (2003, p. 600) as:
$$GVF = 1 - \frac{\sum_{j=1}^{k}\sum_{i=1}^{N_j}{(z_{ij} - \bar{z}_j)}^2}{\sum_{i=1}^{N}{(z_{i} - \bar{z})}^2}$$
where the \(z_{i}, i=1,\ldots,N\) are the observed values, \(k\) is the number of classes, \(\bar{z}_j\) the class mean for class \(j\), and \(N_j\) the number of counties in class \(j\).
The tabular accuracy index is given by Armstrong et al. (2003, p. 600) as:
$$TAI = 1 - \frac{\sum_{j=1}^{k}\sum_{i=1}^{N_j}{|z_{ij} - \bar{z}_j|}}{\sum_{i=1}^{N}{|z_{i} - \bar{z}|}}$$
The overview accuracy index for polygon observations with known areas is given by Armstrong et al. (2003, p. 600) as:
$$OAI = 1 - \frac{\sum_{j=1}^{k}\sum_{i=1}^{N_j}{|z_{ij} - \bar{z}_j| a_{ij}}}{\sum_{i=1}^{N}{|z_{i} - \bar{z}| a_i}}$$
where \(a_i, i=1,\ldots,N\) are the polygon areas, and as above the \(a_{ij}\) term is indexed over \(j=1,\ldots,k\) classes, and \(i=1,\ldots,N_j\) polygons in class \(j\).
References
Armstrong, M. P., Xiao, N., Bennett, D. A., 2003. "Using genetic algorithms to create multicriteria class intervals for choropleth maps". Annals, Association of American Geographers, 93 (3), 595–623; Jenks, G. F., Caspall, F. C., 1971. "Error on choroplethic maps: definition, measurement, reduction". Annals, Association of American Geographers, 61 (2), 217–244
Examples
if (!require("spData", quietly=TRUE)) {
  message("spData package needed for examples")
  run <- FALSE
} else {
  run <- TRUE
}
if (run) {
data(jenks71, package="spData")
fix5 <- classIntervals(jenks71$jenks71, n=5, style="fixed",
 fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30))
print(jenks.tests(fix5, jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         5.0000000         0.9107081         0.6879834         0.6617187 
if (run) {
q5 <- classIntervals(jenks71$jenks71, n=5, style="quantile")
print(jenks.tests(q5, jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         5.0000000         0.8329466         0.6654742         0.6280755 
if (run) {
set.seed(1)
k5 <- classIntervals(jenks71$jenks71, n=5, style="kmeans")
print(jenks.tests(k5, jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         5.0000000         0.9253431         0.7067202         0.6974831 
if (run) {
h5 <- classIntervals(jenks71$jenks71, n=5, style="hclust", method="complete")
print(jenks.tests(h5, jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         5.0000000         0.8705880         0.6098086         0.6099738 
if (run) {
print(jenks.tests(getHclustClassIntervals(h5, k=7), jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         7.0000000         0.9298169         0.6951671         0.6851124 
if (run) {
print(jenks.tests(getHclustClassIntervals(h5, k=9), jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         9.0000000         0.9720995         0.8134540         0.8106422 
if (run) {
set.seed(1)
b5 <- classIntervals(jenks71$jenks71, n=5, style="bclust")
print(jenks.tests(b5, jenks71$area))
}
#> Committee Member: 1(1) 2(1) 3(1) 4(1) 5(1) 6(1) 7(1) 8(1) 9(1) 10(1)
#> Computing Hierarchical Clustering
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         5.0000000         0.8926083         0.6481529         0.6451755 
if (run) {
print(jenks.tests(getBclustClassIntervals(b5, k=7), jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         7.0000000         0.9642511         0.7833643         0.7759815 
if (run) {
print(jenks.tests(getBclustClassIntervals(b5, k=9), jenks71$area))
}
#>         # classes   Goodness of fit  Tabular accuracy Overview accuracy 
#>         9.0000000         0.9708970         0.8081457         0.8034682