calcUncertaintyIndex | R Documentation |
Calculate the diversity (or entropy) index.
calcUncertaintyIndex(belongmatrix)
belongmatrix |
A membership matrix |
The diversity (or entropy) index \insertCitetheil1972statisticalgeocmeans 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.
A vector with the values of the diversity (entropy) index
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.