## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
Bien que cela puisse regrouper par défaut uniquement en fonction de l’envergure de la commune, il est intéressant d’un point de vue statistique de donner un poids aux communes pour mieux étaler le nuage de points. De plus, cela permettra de donner une ‘importance’ aux communes : deux communes avec des fragilités identiques n’obtiendront pas forcément les mêmes aides pour privilégier au plus grand nombre (c’est aussi plus fiable d’aider les grandes communes selon les indicateurs).
## Warning: ggrepel: 6 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
##
## === INTERPRÉTATION DES DIMENSIONS ===
##
## Dim1 :
## Variables structurantes : partPopEt, partPopImmi, txEmp, partEmpDurLim, txChom, partMenVoit, partMen1p, partMenProp, partResPrincApp, DISP_MED_A21
## Pôle positif : partPopEt, partPopImmi, partEmpDurLim, txChom, partMen1p, partResPrincApp
## Pôle négatif : txEmp, partMenVoit, partMenProp, DISP_MED_A21
##
## Dim2 :
## Variables structurantes : partPop75p, partResSec, nbPersResPrinc
## Pôle positif : partPop75p, partResSec
## Pôle négatif : nbPersResPrinc
FactoInvestigate::description(res.PCA_option2)
##
## * * *
##
## The **dimension 1** opposes individuals such as *Avignon*, *Sorgues*, *Monteux*, *Jonquières*, *Vedène*, *Carpentras*, *Le Pontet* and *Cavaillon* (to the right of the graph, characterized by a strongly positive coordinate on the axis)
## to individuals such as *Gordes* and *Vaison-la-Romaine* (to the left of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group in which the individuals *Sorgues*, *Monteux*, *Jonquières*, *Vedène*, *Carpentras*, *Le Pontet* and *Cavaillon* stand (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individual *Avignon* stands (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Gordes* and *Vaison-la-Romaine* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group 4 (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## Note that the variable *partMenProp* is highly correlated with this dimension (correlation of 0.91). This variable could therefore summarize itself the dimension 1.
##
## * * *
##
## The **dimension 2** opposes individuals such as *Gordes* and *Vaison-la-Romaine* (to the top of the graph, characterized by a strongly positive coordinate on the axis)
## to individuals such as *Sorgues*, *Monteux*, *Jonquières*, *Vedène*, *Carpentras*, *Le Pontet* and *Cavaillon* (to the bottom of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group in which the individuals *Gordes* and *Vaison-la-Romaine* stand (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group 2 (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Sorgues*, *Monteux*, *Jonquières*, *Vedène*, *Carpentras*, *Le Pontet* and *Cavaillon* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
## *** : The Hubert index is a graphical method of determining the number of clusters.
## In the plot of Hubert index, we seek a significant knee that corresponds to a
## significant increase of the value of the measure i.e the significant peak in Hubert
## index second differences plot.
##
## *** : The D index is a graphical method of determining the number of clusters.
## In the plot of D index, we seek a significant knee (the significant peak in Dindex
## second differences plot) that corresponds to a significant increase of the value of
## the measure.
##
## *******************************************************************
## * Among all indices:
## * 11 proposed 3 as the best number of clusters
## * 4 proposed 4 as the best number of clusters
## * 2 proposed 5 as the best number of clusters
## * 4 proposed 7 as the best number of clusters
## * 2 proposed 8 as the best number of clusters
##
## ***** Conclusion *****
##
## * According to the majority rule, the best number of clusters is 3
##
##
## *******************************************************************
##
## === CLASSIFICATION ===
## Nombre optimal de clusters : 3
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## drawn <-
## c("Avignon", "Sorgues", "Vaison-la-Romaine", "Monteux", "Gordes",
## "Cavaillon", "Le Pontet", "Jonquières", "Carpentras", "Vedène"
## )
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'tree', title = '')
## ```
##
## **Figure.1 - Hierarchical tree.**
##
## The classification made on individuals reveals 3 clusters.
##
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'map', draw.tree = FALSE, title = '')
## ```
##
## **Figure.2 - Ascending Hierarchical Classification of the individuals.**
##
## The **cluster 1** is made of individuals such as *Gordes*, *Jonquières*, *Vaison-la-Romaine* and *Vedène*. This group is characterized by :
##
## - high values for variables like *DISP_MED_A21*, *txEmp*, *partMenProp*, *partMenVoit*, *partArtCadr*, *partPopBacSup*, *partPop60_74*, *partPI*, *partResSec* and *partPopBac* (variables are sorted from the strongest).
## - low values for variables like *partPopImmi*, *partEmpDurLim*, *partPopEt*, *txChom*, *partPopSansDip*, *partResPrincApp*, *partEmpSal*, *partMen1p*, *partOuvr* and *partPop15_24* (variables are sorted from the weakest).
##
## The **cluster 2** is made of individuals such as *Carpentras*, *Cavaillon*, *Monteux*, *Le Pontet* and *Sorgues*. This group is characterized by :
##
## - high values for variables like *partOuvr*, *partPopSansDip*, *partEmpSal*, *partEmpDurLim*, *partPopEt*, *partPopImmi*, *txChom*, *partEmpl*, *partPop0_14* and *partPopBepCap* (variables are sorted from the strongest).
## - low values for variables like *partPopBacSup*, *partArtCadr*, *txScol15_24*, *DISP_MED_A21*, *partPI*, *partResSec*, *txEmp*, *partMenProp*, *partPopBac* and *partTpsPart* (variables are sorted from the weakest).
##
## The **cluster 3** is made of individuals such as *Avignon*. This group is characterized by :
##
## - high values for variables like *partPop15_24*, *partResPrincApp*, *partPopImmi*, *partMen1p*, *partResVac*, *txChom*, *partPopEt*, *partResPrincSurocc*, *partFamMono* and *partEmpDurLim* (variables are sorted from the strongest).
## - low values for variables like *partMenVoit*, *partMenProp*, *txEmp*, *partPopBepCap*, *DISP_MED_A21*, *partPop60_74*, *nbPersResPrinc*, *partPop75p*, *partPI* and *partPopBac* (variables are sorted from the weakest).
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = '3D.map', ind.names=FALSE, title = '')
## ```
##
## **Figure.3 - Hierarchical tree on the factorial map.**
##
## The hierarchical tree can be drawn on the factorial map with the individuals colored according to their clusters.
##
## === CLASSIFICATION K-MEANS ===
## Nombre optimal de clusters : 3
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
##
## === INTERPRÉTATION DES DIMENSIONS ===
##
## Dim1 :
## Variables structurantes : partPopEt, partPopImmi, txEmp, partEmpDurLim, txChom, partMenVoit, partPopSansDip, partMenProp, partResPrincApp, DISP_MED_A21
## Pôle positif : partPopEt, partPopImmi, partEmpDurLim, txChom, partPopSansDip, partResPrincApp
## Pôle négatif : txEmp, partMenVoit, partMenProp, DISP_MED_A21
##
## Dim2 :
## Variables structurantes : partPop0_14, partPop60_74, partPop75p, indiceJeunesse, nbPersResPrinc
## Pôle positif : partPop0_14, indiceJeunesse, nbPersResPrinc
## Pôle négatif : partPop60_74, partPop75p
##
## * * *
##
## The **dimension 1** opposes individuals such as *Carpentras*, *Apt*, *Orange*, *Cavaillon*, *Le Pontet* and *Avignon* (to the right of the graph, characterized by a strongly positive coordinate on the axis)
## to individuals such as *Gordes*, *Venasque* and *Vaison-la-Romaine* (to the left of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group in which the individuals *Carpentras*, *Apt*, *Orange*, *Cavaillon*, *Le Pontet* and *Avignon* stand (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group 2 (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Gordes*, *Venasque* and *Vaison-la-Romaine* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group 4 (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
##
## * * *
##
## The **dimension 2** opposes individuals characterized by a strongly positive coordinate on the axis (to the top of the graph)
## to individuals such as *Gordes*, *Venasque* and *Vaison-la-Romaine* (to the bottom of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group 1 (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Gordes*, *Venasque* and *Vaison-la-Romaine* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
## *** : The Hubert index is a graphical method of determining the number of clusters.
## In the plot of Hubert index, we seek a significant knee that corresponds to a
## significant increase of the value of the measure i.e the significant peak in Hubert
## index second differences plot.
##
## *** : The D index is a graphical method of determining the number of clusters.
## In the plot of D index, we seek a significant knee (the significant peak in Dindex
## second differences plot) that corresponds to a significant increase of the value of
## the measure.
##
## *******************************************************************
## * Among all indices:
## * 12 proposed 3 as the best number of clusters
## * 2 proposed 4 as the best number of clusters
## * 2 proposed 5 as the best number of clusters
## * 3 proposed 6 as the best number of clusters
## * 3 proposed 7 as the best number of clusters
## * 2 proposed 8 as the best number of clusters
##
## ***** Conclusion *****
##
## * According to the majority rule, the best number of clusters is 3
##
##
## *******************************************************************
##
## === CLASSIFICATION ===
## Nombre optimal de clusters : 3
df_clustered <- cbind(data_clean[7:31, ], cluster = res.HCPC_option3$data.clust$clust[1:25])
df_clustered <- as.data.frame(df_clustered)
num_vars <- names(df_clustered)[sapply(df_clustered, is.numeric)]
# pas dans le heatmap
vars_to_use <- setdiff(num_vars, c("cluster","popMuni2020"))
# Moyennes pondérées
cluster_means <- df_clustered %>%
dplyr::group_by(cluster) %>%
dplyr::summarise(across(all_of(vars_to_use),
~ weighted.mean(.x, w = popMuni2020, na.rm = TRUE)),
.groups = "drop")
data_for_heatmap <- as.matrix(cluster_means[,-1])
rownames(data_for_heatmap) <- paste("Cluster", cluster_means$cluster)
data_for_heatmap_scaled <- scale(data_for_heatmap)
pheatmap::pheatmap(t(data_for_heatmap_scaled),
cluster_rows = TRUE,
cluster_cols = TRUE,
main = "main_title",
display_numbers = round(t(data_for_heatmap), 2))
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## drawn <-
## c("Avignon", "Cavaillon", "Carpentras", "Saint-Christol", "Gordes",
## "Vaison-la-Romaine", "Orange", "Apt", "Le Pontet", "Venasque"
## )
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'tree', title = '')
## ```
##
## **Figure.1 - Hierarchical tree.**
##
## The classification made on individuals reveals 3 clusters.
##
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'map', draw.tree = FALSE, title = '')
## ```
##
## **Figure.2 - Ascending Hierarchical Classification of the individuals.**
##
## The **cluster 1** is made of individuals such as *Venasque*, *Gordes* and *Vaison-la-Romaine*. This group is characterized by :
##
## - high values for variables like *partPop60_74*, *partResSec*, *partPop75p*, *partTpsPart*, *partArtCadr*, *partMenProp*, *partPopBacSup*, *partMenVoit*, *DISP_MED_A21* and *partPopBac* (variables are sorted from the strongest).
## - low values for variables like *indiceJeunesse*, *partPop0_14*, *partPop15_24*, *nbPersResPrinc*, *partEmpSal*, *partPop25_59*, *partResPrincApp*, *partOuvr*, *partPopSansDip* and *partEmpl* (variables are sorted from the weakest).
##
## The **cluster 2** is made of individuals sharing :
##
## - high values for variables like *nbPersResPrinc*, *partPop25_59*, *txEmp*, *indiceJeunesse*, *DISP_MED_A21*, *partMenVoit*, *partPI*, *partPop0_14*, *partMenProp* and *partPopBepCap* (variables are sorted from the strongest).
## - low values for variables like *partMen1p*, *partPop75p*, *partPopImmi*, *partPopEt*, *txChom*, *partTpsPart*, *partEmpDurLim*, *partResSec*, *partPop60_74* and *partPopSansDip* (variables are sorted from the weakest).
##
## The **cluster 3** is made of individuals such as *Carpentras*, *Apt*, *Avignon*, *Cavaillon*, *Orange*, *Le Pontet* and *Saint-Christol*. This group is characterized by :
##
## - high values for variables like *partPopImmi*, *partResPrincApp*, *txChom*, *partPopEt*, *partPopSansDip*, *partEmpDurLim*, *partMen1p*, *partEmpSal*, *partPop15_24* and *partOuvr* (variables are sorted from the strongest).
## - low values for variables like *partMenVoit*, *DISP_MED_A21*, *partMenProp*, *txEmp*, *partPopBacSup*, *partArtCadr*, *partPop60_74*, *partResSec*, *partPopBac* and *partPI* (variables are sorted from the weakest).
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = '3D.map', ind.names=FALSE, title = '')
## ```
##
## **Figure.3 - Hierarchical tree on the factorial map.**
##
## The hierarchical tree can be drawn on the factorial map with the individuals colored according to their clusters.
##
## === CLASSIFICATION K-MEANS ===
## Nombre optimal de clusters : 3
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
##
## === INTERPRÉTATION DES DIMENSIONS ===
##
## Dim1 :
## Variables structurantes : txEmp, txChom, partMenVoit, partPopBacSup, partPopSansDip, partMenProp, partResPrincApp, DISP_MED_A21
## Pôle positif : txChom, partPopSansDip, partResPrincApp
## Pôle négatif : txEmp, partMenVoit, partPopBacSup, partMenProp, DISP_MED_A21
##
## Dim2 :
## Variables structurantes : partPop0_14, partPop60_74, indiceJeunesse, nbPersResPrinc
## Pôle positif : partPop0_14, indiceJeunesse, nbPersResPrinc
## Pôle négatif : partPop60_74
##
## * * *
##
## The **dimension 1** opposes individuals such as *Le Pontet*, *Cavaillon*, *Carpentras*, *Orange*, *Apt*, *Avignon* and *Saint-Christol* (to the right of the graph, characterized by a strongly positive coordinate on the axis)
## to individuals such as *Gordes*, *Savoillan* and *Saint-Léger-du-Ventoux* (to the left of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group in which the individuals *Le Pontet*, *Cavaillon*, *Carpentras*, *Orange*, *Apt* and *Avignon* stand (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individual *Saint-Christol* stands (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Gordes*, *Savoillan* and *Saint-Léger-du-Ventoux* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group 4 (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
##
## * * *
##
## The **dimension 2** opposes individuals characterized by a strongly positive coordinate on the axis (to the top of the graph)
## to individuals such as *Gordes*, *Saint-Christol*, *Savoillan* and *Saint-Léger-du-Ventoux* (to the bottom of the graph, characterized by a strongly negative coordinate on the axis).
##
## The group 1 (characterized by a positive coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individuals *Gordes*, *Savoillan* and *Saint-Léger-du-Ventoux* stand (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
##
## The group in which the individual *Saint-Christol* stands (characterized by a negative coordinate on the axis) is sharing :
##
## - variables whose values do not differ significantly from the mean.
## *** : The Hubert index is a graphical method of determining the number of clusters.
## In the plot of Hubert index, we seek a significant knee that corresponds to a
## significant increase of the value of the measure i.e the significant peak in Hubert
## index second differences plot.
##
## *** : The D index is a graphical method of determining the number of clusters.
## In the plot of D index, we seek a significant knee (the significant peak in Dindex
## second differences plot) that corresponds to a significant increase of the value of
## the measure.
##
## *******************************************************************
## * Among all indices:
## * 10 proposed 3 as the best number of clusters
## * 3 proposed 4 as the best number of clusters
## * 7 proposed 5 as the best number of clusters
## * 1 proposed 6 as the best number of clusters
## * 1 proposed 7 as the best number of clusters
## * 2 proposed 8 as the best number of clusters
##
## ***** Conclusion *****
##
## * According to the majority rule, the best number of clusters is 3
##
##
## *******************************************************************
##
## === CLASSIFICATION ===
## Nombre optimal de clusters : 3
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## drawn <-
## c("Saint-Christol", "Saint-Léger-du-Ventoux", "Avignon", "Savoillan",
## "Cavaillon", "Carpentras", "Apt", "Orange", "Le Pontet", "Gordes"
## )
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'tree', title = '')
## ```
##
## **Figure.1 - Hierarchical tree.**
##
## The classification made on individuals reveals 3 clusters.
##
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = 'map', draw.tree = FALSE, title = '')
## ```
##
## **Figure.2 - Ascending Hierarchical Classification of the individuals.**
##
## The **cluster 1** is made of individuals such as *Gordes*, *Saint-Léger-du-Ventoux* and *Savoillan*. This group is characterized by :
##
## - high values for the variables *partPop60_74*, *partResSec*, *partPop75p*, *partArtCadr*, *partTpsPart*, *partMenProp*, *partMenVoit*, *partPopBacSup*, *partPopBac* and *partMen1p* (variables are sorted from the strongest).
## - low values for variables like *indiceJeunesse*, *nbPersResPrinc*, *partPop0_14*, *partPop25_59*, *partPop15_24*, *partEmpSal*, *partOuvr*, *partResPrincApp*, *partResVac* and *partEmpl* (variables are sorted from the weakest).
##
## The **cluster 2** is made of individuals sharing :
##
## - high values for the variables *indiceJeunesse*, *nbPersResPrinc*, *partPop25_59*, *partPop0_14*, *partPI*, *txEmp*, *partPop15_24*, *DISP_MED_A21*, *partEmpSal* and *partEmpl* (variables are sorted from the strongest).
## - low values for the variables *partPop60_74*, *partResSec*, *partPop75p*, *partTpsPart*, *partPopImmi*, *partPopEt*, *partMen1p*, *partArtCadr*, *txChom* and *partPopSansDip* (variables are sorted from the weakest).
##
## The **cluster 3** is made of individuals such as *Carpentras*, *Apt*, *Avignon*, *Cavaillon*, *Orange*, *Le Pontet* and *Saint-Christol*. This group is characterized by :
##
## - high values for variables like *partResPrincApp*, *partPopSansDip*, *txChom*, *partPopImmi*, *partPopEt*, *partEmpSal*, *partOuvr*, *partEmpDurLim*, *partPop15_24* and *partResVac* (variables are sorted from the strongest).
## - low values for the variables *partMenVoit*, *partMenProp*, *txEmp*, *DISP_MED_A21*, *partPopBacSup*, *partResSec*, *partPop60_74*, *partArtCadr*, *partPopBac* and *txScol15_24* (variables are sorted from the weakest).
##
## ```{r, echo = FALSE, fig.align = 'center', fig.height = 5.5, fig.width = 5.5}
## par(mar = c(4.1, 4.1, 1.1, 2.1))
## plot.HCPC(res, choice = '3D.map', ind.names=FALSE, title = '')
## ```
##
## **Figure.3 - Hierarchical tree on the factorial map.**
##
## The hierarchical tree can be drawn on the factorial map with the individuals colored according to their clusters.
##
## === CLASSIFICATION K-MEANS ===
## Nombre optimal de clusters : 3
## Warning in validateCoords(lng, lat, funcName): Data contains 2 rows with either
## missing or invalid lat/lon values and will be ignored
stab_hclust3$bootmean
## [1] 0.6948023 0.6800599 0.5905861
stab_hclust4$bootmean
## [1] 0.7045184 0.6941074 0.6488566
stab_km3$bootmean
## [1] 0.7457502 0.8753085 0.8251897
stab_km4$bootmean
## [1] 0.7477204 0.8837481 0.8439563
## variance cumulée
res.PCA_option3$eig[1:2, 3]
## comp 1 comp 2
## 38.25453 55.64312
res.PCA_option4$eig[1:2, 3]
## comp 1 comp 2
## 25.22745 43.06824