2

Context: I am trying to 1) define cluster based on certain individuals and 2) assign others individuals to the defined clusters.

What has been done: I use FactoMineR functions PCA() and HCPC() according to the workflow described by Husson, F., Josse, J., Pages, J., 2010. Principal component methods - hierarchical clustering - partitional clustering: why would we need to choose for visualizing data? Technical Report – Agrocampus 17.

Question: it is possible to assign each supplementary individual (PCA(..., ind.sup =***) a cluster defined in the Hierarchical Clustering analysis?

Similar question: this question has already been asked on stackoverflow here but it was 5 years ago and the answer does not fit into HCPC workflow.

Please fin below some code using base R dataset mtcars:

if(!require(FactoMineR)){install.packages("FactoMineR")}
library(FactoMineR)
if(!require(factoextra)){install.packages("factoextra")}
library(factoextra)

# lets use mtcars dataset for this question
head(mtcars)
# some individuals are considered as supplementary:
mtcars[22:nrow(mtcars),] 

# HCPC workflow
res.pca = PCA(mtcars, 
              ind.sup = c(22:nrow(mtcars)), # the last 10 individuals are supplementary
              scale.unit = TRUE, 
              ncp = 5, 
              graph = TRUE)
fviz_pca_ind(res.pca) # here supplementary individuals are included

res.hcpc = HCPC(res.pca, 
                nb.clust = -1, # automatic tree cut
                min = 3, 
                max = NULL, 
                graph = FALSE, 
                kk=Inf) # no k-means pre-processing
# here are the two results needed to illustrate my question
fviz_dend(res.hcpc, show_labels = TRUE)
res.hcpc$desc.ind # notice that individuals considered as supplementary are not included in any cluster

Expected output: the expected output is something like this where supplementary individuals are assigned to cluster and clearly identified: [Example of expected graphical output](https://i.stack.imgur.com/ZrOwu.png). With Fiat X-9 and Lotus Europa (supplementary individuals) assigned to the cluster with Fiat 128 for example.

Earl Mascetti
  • 1,278
  • 3
  • 16
  • 31
Paul
  • 2,850
  • 1
  • 12
  • 37

0 Answers0