Calculate the diversity (or entropy) index.
calcUncertaintyIndex(belongmatrix)
A membership matrix
A vector with the values of the diversity (entropy) index
The diversity (or entropy) index (Theil 1972) is calculated for each observation an varies between 0 and 1. When the value is close to 0, the observation belong to only one cluster (as in hard clustering). When the value is close to 1, the observation is undecided and tends to belong to each cluster. Values above 0.9 should be investigated. The formula is:
$$H2_{i} = \frac{-\sum[u_{ij}\ln(u_{ij})]}{\ln(k)}$$
with i and observation, j a cluster, k the number of clusters and u the membership matrix.
It is a simplified formula because the sum of each row of a membership matrix is 1.
Theil H (1972). Statistical decomposition analysis; with applications in the social and administrative sciences. North-Holland.
data(LyonIris)
AnalysisFields <-c("Lden","NO2","PM25","VegHautPrt","Pct0_14","Pct_65","Pct_Img",
"TxChom1564","Pct_brevet","NivVieMed")
dataset <- sf::st_drop_geometry(LyonIris[AnalysisFields])
queen <- spdep::poly2nb(LyonIris,queen=TRUE)
Wqueen <- spdep::nb2listw(queen,style="W")
result <- SFCMeans(dataset, Wqueen,k = 5, m = 1.5, alpha = 1.5, standardize = TRUE)
calcUncertaintyIndex(result$Belongings)