<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/pca-hierarchical-tree-partition-why-do-we-need-to-choose-for-visualizing-data/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://francoishusson.wordpress.com/2017/02/20/pca-hierarchical-tree-partitioning-why-do-we-need-to-choose-for-visualizing-data/"> François Husson</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Principal component methods such as PCA (principal component analysis) or MCA (multiple correspondence analysis) can be used as a pre-processing step before clustering.</p>
<p>But principal component methods give also a framework to visualize data. Thus, the clustering methods can be represented onto the map provided by the principal component method. In the figure below, the hierarchical tree is represented in 3D onto the principal component map (using the first 2 component obtained with PCA). And then, a partition has been done and individuals are coloured according to their belonging cluster.</p>
<p><img sizes="(max-width: 499px) 100vw, 499px" data-image-description="" data-orig-file="https://i2.wp.com/francoishusson.files.wordpress.com/2017/02/arbre_temperature.png?resize=456%2C382&amp;ssl=1" data-orig-size="984,824" data-image-title="arbre_temperature" class="wp-image-137" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="137" data-permalink="https://francoishusson.wordpress.com/2017/02/20/pca-hierarchical-tree-partitioning-why-do-we-need-to-choose-for-visualizing-data/arbre_temperature/" alt="arbre_temperature" data-medium-file="https://i2.wp.com/francoishusson.files.wordpress.com/2017/02/arbre_temperature.png?resize=456%2C382&amp;ssl=1?w=300" data-large-file="https://i2.wp.com/francoishusson.files.wordpress.com/2017/02/arbre_temperature.png?resize=456%2C382&amp;ssl=1?w=634" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i2.wp.com/francoishusson.files.wordpress.com/2017/02/arbre_temperature.png?resize=456%2C382&ssl=1"></p>
<p>Thus, the graph gives simultaneously the information given by  the principal component map, the hierarchical tree and the clusters (see th function HCPC in the FactoMineR package).</p>
<p><span>library(FactoMineR) </span></p>
<p><span>temperature &lt;- read.table(“<a target="_blank" rel="nofollow" href="http://factominer.free.fr/livre/temperat.csv&amp;%238221">http://factominer.free.fr/livre/temperat.csv&amp;#8221</a>;,</span><br>
<span>      header=TRUE, sep=”;”, dec=”.”, row.names=1)</span></p>
<p><span>res.pca &lt;- PCA(temperature[1:23,], scale.unit=TRUE, ncp=Inf,</span><br>
<span>     graph = FALSE,quanti.sup=13:16,quali.sup=17)</span></p>
<p><span>res.hcpc &lt;- HCPC(res.pca) </span></p>
<p>The approaches complement one another in two ways:</p>
<ul>
<li>firstly, a continuous view (the trend identified by the principal components) and a discontinuous view (the clusters) of the same data set are both represented in a unique framework;</li>
<li>secondly, the two-dimensional map provides no information about the position of the individuals in the other dimensions; the tree and the clusters, defined from more dimensions, offer some information “outside of the map”; two individuals close together on the map can be in the same cluster (and therefore not too far from one another along the other dimensions) or in two different clusters (as they are far from one another along other dimensions).</li>
</ul>
<p>So why do we need to choose when we want to better visualize the data?</p>
<p>The example shows the common use of PCA and clustering methods, but rather than PCA we can use correspondence analysis on contingency tables, or multiple correspondence analysis on categorical variables.</p>
<p>If you want to learn more, you can see <a target="_blank" rel="nofollow" href="https://www.youtube.com/watch?v=EJqYTDTJJug">this video</a>, or you cab enroll in <a target="_blank" rel="nofollow" href="https://www.fun-mooc.fr/courses/agrocampusouest/40001S03EN/session03/about">this MOOC</a> (free) and you can see this <a title="hcpc_husson_josse" target="_blank" rel="nofollow" href="https://francoishusson.files.wordpress.com/2017/02/hcpc_husson_josse.pdf">unpublished paper</a>.</p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/francoishusson.wordpress.com/99/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/francoishusson.wordpress.com/99/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://francoishusson.wordpress.com/2017/02/20/pca-hierarchical-tree-partitioning-why-do-we-need-to-choose-for-visualizing-data/"> François Husson</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/jdkUfWDmyck"></a></div>