<?xml version="1.0" encoding="UTF-8" ?>
<!-- RSS generated by PHPBoost on Sun, 08 Mar 2026 08:42:36 +0100 -->

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Easy Guides]]></title>
		<atom:link href="https://www.sthda.com/english/syndication/rss/wiki/31" rel="self" type="application/rss+xml"/>
		<link>https://www.sthda.com</link>
		<description><![CDATA[Last articles of the category: Factoextra R Package: Easy Multivariate Data Analyses and Elegant Visualization]]></description>
		<copyright>(C) 2005-2026 PHPBoost</copyright>
		<language>en</language>
		<generator>PHPBoost</generator>
		
		
		<item>
			<title><![CDATA[Factoextra R Package: Easy Multivariate Data Analyses and Elegant Visualization]]></title>
			<link>https://www.sthda.com/english/wiki/factoextra-r-package-easy-multivariate-data-analyses-and-elegant-visualization</link>
			<guid>https://www.sthda.com/english/wiki/factoextra-r-package-easy-multivariate-data-analyses-and-elegant-visualization</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->
  <div id="rdoc">

<p><br/></p>
<p><a href="https://www.sthda.com/english/rpkgs/factoextra"><strong>factoextra</strong></a> is an R package making easy to <em>extract</em> and <em>visualize</em> the output of exploratory <strong>multivariate data analyses</strong>, including:</p>
<ol style="list-style-type: decimal">
<li><p><a href="factominer-and-factoextra-principal-component-analysis-visualization-r-software-and-data-mining">Principal Component Analysis (PCA)</a>, which is used to summarize the information contained in a continuous (i.e, quantitative) multivariate data by reducing the dimensionality of the data without loosing important information.</p></li>
<li><p><a href="correspondence-analysis-in-r-the-ultimate-guide-for-the-analysis-the-visualization-and-the-interpretation-r-software-and-data-mining">Correspondence Analysis (CA)</a>, which is an extension of the principal component analysis suited to analyse a large contingency table formed by two <em>qualitative variables</em> (or categorical data).</p></li>
<li><p><a href="multiple-correspondence-analysis-essentials-interpretation-and-application-to-investigate-the-associations-between-categories-of-multiple-qualitative-variables-r-software-and-data-mining">Multiple Correspondence Analysis (MCA)</a>, which is an adaptation of CA to a data table containing more than two categorical variables.</p></li>
<li><p><a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_mfa.html">Multiple Factor Analysis (MFA)</a> dedicated to datasets where variables are organized into groups (qualitative and/or quantitative variables).</p></li>
<li><p><a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_hmfa.html">Hierarchical Multiple Factor Analysis (HMFA)</a>: An extension of MFA in a situation where the data are organized into a hierarchical structure.</p></li>
<li><p><a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_famd.html">Factor Analysis of Mixed Data (FAMD)</a>, a particular case of the MFA, dedicated to analyze a data set containing both quantitative and qualitative variables.</p></li>
</ol>
<p>There are a number of R packages implementing principal component methods. These packages include: <em>FactoMineR</em>, <em>ade4</em>, <em>stats</em>, <em>ca</em>, <em>MASS</em> and <em>ExPosition</em>.</p>
<p>However, the result is presented differently according to the used packages. To help in the interpretation and in the visualization of multivariate analysis - such as cluster analysis and dimensionality reduction analysis - we developed an easy-to-use R package named <a href="https://www.sthda.com/english/rpkgs/factoextra">factoextra</a>.</p>
<br/>
<div class="block">
<ul>
<li><p>The R package <strong>factoextra</strong> has flexible and easy-to-use methods to extract quickly, in a human readable standard data format, the analysis results from the different packages mentioned above.</p></li>
<li><p>It produces a <strong>ggplot2</strong>-based <strong>elegant data visualization</strong> with less typing.</p></li>
<li>It contains also many functions facilitating clustering analysis and visualization.</li>
</ul>
</div>
<p><br/></p>
<div class="success">
<p>We’ll use i) the FactoMineR package (Sebastien Le, et al., 2008) to compute PCA, (M)CA, FAMD, MFA and HCPC; ii) and the factoextra package for extracting and visualizing the results.</p>
<p>FactoMineR is a great and my favorite package for computing principal component methods in R. It’s very easy to use and very well documented. The official website is available at: <a href="http://factominer.free.fr/" class="uri">http://factominer.free.fr/</a>. Thanks to <a href="http://math.agrocampus-ouest.fr/infoglueDeliverLive/membres/Francois.Husson">François Husson</a> for his impressive work.</p>
</div>
<p><span class="warning">The figure below shows methods, which outputs can be visualized using the factoextra package. The official online documentation is available at: <a href="https://www.sthda.com/english/rpkgs/factoextra" class="uri">https://www.sthda.com/english/rpkgs/factoextra</a>. </span></p>
<p><img src="https://www.sthda.com/english/sthda/RDoc/images/factoextra-r-package.png" alt="multivariate analysis, factoextra, cluster, r, pca" /></p>

<br/>
<div id="TOC">
  <strong>Contents</strong>
<ul>
<li><a href="#why-using-factoextra">Why using factoextra?</a></li>
<li><a href="#installing-factominer">Installing FactoMineR</a></li>
<li><a href="#installing-and-loading-factoextra">Installing and loading factoextra</a></li>
<li><a href="#main-functions-in-the-factoextra-package">Main functions in the factoextra package</a><ul>
<li><a href="#visualizing-dimension-reduction-analysis-outputs">Visualizing dimension reduction analysis outputs</a></li>
<li><a href="#extracting-data-from-dimension-reduction-analysis-outputs">Extracting data from dimension reduction analysis outputs</a></li>
<li><a href="#clustering-analysis-and-visualization">Clustering analysis and visualization</a></li>
</ul></li>
<li><a href="#dimension-reduction-and-factoextra">Dimension reduction and factoextra</a><ul>
<li><a href="#principal-component-analysis">Principal component analysis</a></li>
<li><a href="#correspondence-analysis">Correspondence analysis</a></li>
<li><a href="#multiple-correspondence-analysis">Multiple correspondence analysis</a></li>
<li><a href="#advanced-methods">Advanced methods</a></li>
</ul></li>
<li><a href="#cluster-analysis-and-factoextra">Cluster analysis and factoextra</a><ul>
<li><a href="#partitioning-clustering">Partitioning clustering</a></li>
<li><a href="#hierarchical-clustering">Hierarchical clustering</a></li>
<li><a href="#determine-the-optimal-number-of-clusters">Determine the optimal number of clusters</a></li>
</ul></li>
<li><a href="#acknoweledgment">Acknoweledgment</a></li>
<li><a href="#references">References</a></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<div id="why-using-factoextra" class="section level2">
<h2>Why using factoextra?</h2>
<ol style="list-style-type: decimal">
<li><p>The <em>factoextra</em> R package can handle the results of PCA, CA, MCA, MFA, FAMD and HMFA from several packages, for extracting and visualizing the most important information contained in your data.</p></li>
<li><em>After PCA, CA, MCA, MFA, FAMD and HMFA, the most important row/column elements</em> can be highlighted using :

</li>
</ol>
<ul>
<li>their cos2 values corresponding to their quality of representation on the factor map</li>
<li>their contributions to the definition of the principal dimensions.</li>
</ul>
<p><span class="success">If you want to do this, the factoextra package provides a convenient solution.</span></p>
<ol start="3" style="list-style-type: decimal">
<li><em>PCA and (M)CA are used sometimes for prediction problems</em> : one can predict the coordinates of new supplementary variables (quantitative and qualitative) and supplementary individuals using the information provided by the previously performed PCA or (M)CA. This can be done easily using the <a href="factominer-and-factoextra-principal-component-analysis-visualization-r-software-and-data-mining">FactoMineR</a> package.</li>
</ol>
<p><span class="success">If you want to make predictions with PCA/MCA and to visualize the position of the supplementary variables/individuals on the factor map using ggplot2: then factoextra can help you. It’s quick, write less and do more…</span></p>
<ol start="4" style="list-style-type: decimal">
<li><em>Several functions from different packages - FactoMineR, ade4, ExPosition, stats - are available in R for performing PCA, CA or MCA</em>. However, The components of the output vary from package to package.</li>
</ol>
<p><span class="success">No matter the package you decided to use, factoextra can give you a human understandable output.</span></p>
</div>
<div id="installing-factominer" class="section level2">
<h2>Installing FactoMineR</h2>
<p>The FactoMineR package can be installed and loaded as follow:</p>
<pre class="r"><code># Install
install.packages("FactoMineR")

# Load
library("FactoMineR")</code></pre>
</div>
<div id="installing-and-loading-factoextra" class="section level2">
<h2>Installing and loading factoextra</h2>
<ul>
<li>factoextra can be installed from <a href="https://cran.r-project.org/package=factoextra">CRAN</a> as follow:</li>
</ul>
<pre class="r"><code>install.packages("factoextra")</code></pre>
<ul>
<li>Or, install the latest version from <a href="https://github.com/kassambara/factoextra">Github</a></li>
</ul>
<pre class="r"><code>if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/factoextra")</code></pre>
<ul>
<li>Load factoextra as follow :</li>
</ul>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="main-functions-in-the-factoextra-package" class="section level2">
<h2>Main functions in the factoextra package</h2>
<p><span class="warning">See the online documentation (<a href="https://www.sthda.com/english/rpkgs/factoextra" class="uri">https://www.sthda.com/english/rpkgs/factoextra</a>) for a complete list.</span></p>
<div id="visualizing-dimension-reduction-analysis-outputs" class="section level3">
<h3>Visualizing dimension reduction analysis outputs</h3>
<table style="width:97%;">
<colgroup>
<col width="13%" />
<col width="83%" />
</colgroup>
<thead>
<tr class="header">
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>fviz_eig (or fviz_eigenvalue)</em></td>
<td>Extract and visualize the eigenvalues/variances of dimensions.</td>
</tr>
<tr class="even">
<td><em>fviz_pca</em></td>
<td>Graph of individuals/variables from the output of <em>Principal Component Analysis</em> (PCA).</td>
</tr>
<tr class="odd">
<td><em>fviz_ca</em></td>
<td>Graph of column/row variables from the output of <em>Correspondence Analysis</em> (CA).</td>
</tr>
<tr class="even">
<td><em>fviz_mca</em></td>
<td>Graph of individuals/variables from the output of <em>Multiple Correspondence Analysis</em> (MCA).</td>
</tr>
<tr class="odd">
<td><em>fviz_mfa</em></td>
<td>Graph of individuals/variables from the output of <em>Multiple Factor Analysis</em> (MFA).</td>
</tr>
<tr class="even">
<td><em>fviz_famd</em></td>
<td>Graph of individuals/variables from the output of <em>Factor Analysis of Mixed Data</em> (FAMD).</td>
</tr>
<tr class="odd">
<td><em>fviz_hmfa</em></td>
<td>Graph of individuals/variables from the output of <em>Hierarchical Multiple Factor Analysis</em> (HMFA).</td>
</tr>
<tr class="even">
<td><em>fviz_ellipses</em></td>
<td>Draw confidence ellipses around the categories.</td>
</tr>
<tr class="odd">
<td><em>fviz_cos2</em></td>
<td>Visualize the quality of representation of the row/column variable from the results of PCA, CA, MCA functions.</td>
</tr>
<tr class="even">
<td><em>fviz_contrib</em></td>
<td>Visualize the contributions of row/column elements from the results of PCA, CA, MCA functions.</td>
</tr>
</tbody>
</table>
</div>
<div id="extracting-data-from-dimension-reduction-analysis-outputs" class="section level3">
<h3>Extracting data from dimension reduction analysis outputs</h3>
<table style="width:97%;">
<colgroup>
<col width="13%" />
<col width="83%" />
</colgroup>
<thead>
<tr class="header">
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>get_eigenvalue</em></td>
<td>Extract and visualize the eigenvalues/variances of dimensions.</td>
</tr>
<tr class="even">
<td><em>get_pca</em></td>
<td>Extract all the results (coordinates, squared cosine, contributions) for the active individuals/variables from <em>Principal Component Analysis</em> (PCA) outputs.</td>
</tr>
<tr class="odd">
<td><em>get_ca</em></td>
<td>Extract all the results (coordinates, squared cosine, contributions) for the active column/row variables from <em>Correspondence Analysis</em> outputs.</td>
</tr>
<tr class="even">
<td><em>get_mca</em></td>
<td>Extract results from <em>Multiple Correspondence Analysis</em> outputs.</td>
</tr>
<tr class="odd">
<td><em>get_mfa</em></td>
<td>Extract results from <em>Multiple Factor Analysis</em> outputs.</td>
</tr>
<tr class="even">
<td><em>get_famd</em></td>
<td>Extract results from <em>Factor Analysis of Mixed Data</em> outputs.</td>
</tr>
<tr class="odd">
<td><em>get_hmfa</em></td>
<td>Extract results from <em>Hierarchical Multiple Factor Analysis</em> outputs.</td>
</tr>
<tr class="even">
<td><em>facto_summarize</em></td>
<td>Subset and summarize the output of factor analyses.</td>
</tr>
</tbody>
</table>
</div>
<div id="clustering-analysis-and-visualization" class="section level3">
<h3>Clustering analysis and visualization</h3>
<table style="width:97%;">
<colgroup>
<col width="13%" />
<col width="83%" />
</colgroup>
<thead>
<tr class="header">
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>dist</em>(fviz_dist, get_dist)</td>
<td>Enhanced Distance Matrix Computation and Visualization.</td>
</tr>
<tr class="even">
<td><em>get_clust_tendency</em></td>
<td>Assessing Clustering Tendency.</td>
</tr>
<tr class="odd">
<td><em>fviz_nbclust</em>(fviz_gap_stat)</td>
<td>Determining and Visualizing the Optimal Number of Clusters.</td>
</tr>
<tr class="even">
<td><em>fviz_dend</em></td>
<td>Enhanced Visualization of Dendrogram</td>
</tr>
<tr class="odd">
<td><em>fviz_cluster</em></td>
<td>Visualize Clustering Results</td>
</tr>
<tr class="even">
<td><em>fviz_mclust</em></td>
<td>Visualize Model-based Clustering Results</td>
</tr>
<tr class="odd">
<td><em>fviz_silhouette</em></td>
<td>Visualize Silhouette Information from Clustering.</td>
</tr>
<tr class="even">
<td><em>hcut</em></td>
<td>Computes Hierarchical Clustering and Cut the Tree</td>
</tr>
<tr class="odd">
<td><em>hkmeans</em> (hkmeans_tree, print.hkmeans)</td>
<td>Hierarchical k-means clustering.</td>
</tr>
<tr class="even">
<td><em>eclust</em></td>
<td>Visual enhancement of clustering analysis</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="dimension-reduction-and-factoextra" class="section level2">
<h2>Dimension reduction and factoextra</h2>
<p>As depicted in the figure below, the type of analysis to be performed depends on the data set formats and structures.</p>
<p><img src="https://www.sthda.com/english/sthda/RDoc/images/multivariate-analysis-factoextra.png" alt="dimension reduction and factoextra" /></p>
<p>In this section we start by illustrating classical methods - such as PCA, CA and MCA - for analyzing a data set containing continuous variables, contingency table and qualitative variables, respectively.</p>
<p>We continue by discussing advanced methods - such as FAMD, MFA and HMFA - for analyzing a data set containing a mix of variables (qualitatives &amp; quantitatives) organized or not into groups.</p>
<p>Finally, we show how to perform hierarchical clustering on principal components (HCPC), which useful for performing clustering with a data set containing only qualitative variables or with a mixed data of qualitative and quantitative variables.</p>
<div id="principal-component-analysis" class="section level3">
<h3>Principal component analysis</h3>
<ul>
<li>Data: <em>decathlon2</em> [in <em>factoextra</em> package]</li>
<li>PCA function: <em>FactoMineR::PCA</em>()</li>
<li>Visualization <em>factoextra::fviz_pca</em>()</li>
</ul>
<p><span class="success">Read more about computing and interpreting principal component analysis at: <a href="factominer-and-factoextra-principal-component-analysis-visualization-r-software-and-data-mining"><strong>Principal Component Analysis</strong> (PCA)</a>.</span></p>
<ol style="list-style-type: decimal">
<li><strong>Loading data</strong></li>
</ol>
<pre class="r"><code>library("factoextra")
data("decathlon2")
df <- decathlon2[1:23, 1:10]</code></pre>
<ol start="2" style="list-style-type: decimal">
<li><strong>Principal component analysis</strong></li>
</ol>
<pre class="r"><code>library("FactoMineR")
res.pca <- PCA(df,  graph = FALSE)</code></pre>
<ol start="3" style="list-style-type: decimal">
<li><strong>Extract and visualize eigenvalues/variances</strong>:</li>
</ol>
<pre class="r"><code># Extract eigenvalues/variances
get_eig(res.pca)</code></pre>
<pre><code>##        eigenvalue variance.percent cumulative.variance.percent
## Dim.1   4.1242133        41.242133                    41.24213
## Dim.2   1.8385309        18.385309                    59.62744
## Dim.3   1.2391403        12.391403                    72.01885
## Dim.4   0.8194402         8.194402                    80.21325
## Dim.5   0.7015528         7.015528                    87.22878
## Dim.6   0.4228828         4.228828                    91.45760
## Dim.7   0.3025817         3.025817                    94.48342
## Dim.8   0.2744700         2.744700                    97.22812
## Dim.9   0.1552169         1.552169                    98.78029
## Dim.10  0.1219710         1.219710                   100.00000</code></pre>
<pre class="r"><code># Visualize eigenvalues/variances
fviz_screeplot(res.pca, addlabels = TRUE, ylim = c(0, 50))</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-pca-eigenvalue-1.png" alt="factoextra" width="432" />
<p class="caption">
factoextra
</p>
</div>
<p>4.<strong>Extract and visualize results for variables</strong>:</p>
<pre class="r"><code># Extract the results for variables
var <- get_pca_var(res.pca)
var</code></pre>
<pre><code>## Principal Component Analysis Results for variables
##  ===================================================
##   Name       Description
## 1 "$coord"   "Coordinates for the variables"
## 2 "$cor"     "Correlations between variables and dimensions"
## 3 "$cos2"    "Cos2 for the variables"
## 4 "$contrib" "contributions of the variables"</code></pre>
<pre class="r"><code># Coordinates of variables
head(var$coord)</code></pre>
<pre><code>##                   Dim.1       Dim.2      Dim.3       Dim.4      Dim.5
## X100m        -0.8506257 -0.17939806  0.3015564  0.03357320 -0.1944440
## Long.jump     0.7941806  0.28085695 -0.1905465 -0.11538956  0.2331567
## Shot.put      0.7339127  0.08540412  0.5175978  0.12846837 -0.2488129
## High.jump     0.6100840 -0.46521415  0.3300852  0.14455012  0.4027002
## X400m        -0.7016034  0.29017826  0.2835329  0.43082552  0.1039085
## X110m.hurdle -0.7641252 -0.02474081  0.4488873 -0.01689589  0.2242200</code></pre>
<pre class="r"><code># Contribution of variables
head(var$contrib)</code></pre>
<pre><code>##                  Dim.1      Dim.2     Dim.3       Dim.4     Dim.5
## X100m        17.544293  1.7505098  7.338659  0.13755240  5.389252
## Long.jump    15.293168  4.2904162  2.930094  1.62485936  7.748815
## Shot.put     13.060137  0.3967224 21.620432  2.01407269  8.824401
## High.jump     9.024811 11.7715838  8.792888  2.54987951 23.115504
## X400m        11.935544  4.5799296  6.487636 22.65090599  1.539012
## X110m.hurdle 14.157544  0.0332933 16.261261  0.03483735  7.166193</code></pre>
<pre class="r"><code># Graph of variables: default plot
fviz_pca_var(res.pca, col.var = "black")</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-pca-variables-1.png" alt="factoextra" width="432" />
<p class="caption">
factoextra
</p>
</div>
<p>It’s possible to control variable colors using their contributions (“contrib”) to the principal axes:</p>
<pre class="r"><code># Control variable colors using their contributions
fviz_pca_var(res.pca, col.var="contrib",
             gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
             repel = TRUE # Avoid text overlapping
             )</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-pca-variable-colors-by-contributions-1.png" alt="factoextra" width="480" />
<p class="caption">
factoextra
</p>
</div>
<ol start="5" style="list-style-type: decimal">
<li><strong>Variable contributions to the principal axes</strong>:</li>
</ol>
<pre class="r"><code># Contributions of variables to PC1
fviz_contrib(res.pca, choice = "var", axes = 1, top = 10)

# Contributions of variables to PC2
fviz_contrib(res.pca, choice = "var", axes = 2, top = 10)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-pca-variable-contributions-1.png" alt="factoextra" width="336" /><img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-pca-variable-contributions-2.png" alt="factoextra" width="336" />
<p class="caption">
factoextra
</p>
</div>
<ol start="6" style="list-style-type: decimal">
<li><strong>Extract and visualize results for individuals</strong>:</li>
</ol>
<pre class="r"><code># Extract the results for individuals
ind <- get_pca_ind(res.pca)
ind</code></pre>
<pre><code>## Principal Component Analysis Results for individuals
##  ===================================================
##   Name       Description
## 1 "$coord"   "Coordinates for the individuals"
## 2 "$cos2"    "Cos2 for the individuals"
## 3 "$contrib" "contributions of the individuals"</code></pre>
<pre class="r"><code># Coordinates of individuals
head(ind$coord)</code></pre>
<pre><code>##                Dim.1      Dim.2      Dim.3       Dim.4       Dim.5
## SEBRLE     0.1955047  1.5890567  0.6424912  0.08389652  1.16829387
## CLAY       0.8078795  2.4748137 -1.3873827  1.29838232 -0.82498206
## BERNARD   -1.3591340  1.6480950  0.2005584 -1.96409420  0.08419345
## YURKOV    -0.8889532 -0.4426067  2.5295843  0.71290837  0.40782264
## ZSIVOCZKY -0.1081216 -2.0688377 -1.3342591 -0.10152796 -0.20145217
## McMULLEN   0.1212195 -1.0139102 -0.8625170  1.34164291  1.62151286</code></pre>
<pre class="r"><code># Graph of individuals
# 1. Use repel = TRUE to avoid overplotting
# 2. Control automatically the color of individuals using the cos2
    # cos2 = the quality of the individuals on the factor map
    # Use points only
# 3. Use gradient color
fviz_pca_ind(res.pca, col.ind = "cos2",
             gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
             repel = TRUE # Avoid text overlapping (slow if many points)
             )</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-principal-component-analysis-data-mining-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<pre class="r"><code># Biplot of individuals and variables
fviz_pca_biplot(res.pca, repel = TRUE)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-principal-component-analysis-data-mining-2.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<ol start="7" style="list-style-type: decimal">
<li><strong>Color individuals by groups</strong>:</li>
</ol>
<pre class="r"><code># Compute PCA on the iris data set
# The variable Species (index = 5) is removed
# before PCA analysis
iris.pca <- PCA(iris[,-5], graph = FALSE)

# Visualize
# Use habillage to specify groups for coloring
fviz_pca_ind(iris.pca,
             label = "none", # hide individual labels
             habillage = iris$Species, # color by groups
             palette = c("#00AFBB", "#E7B800", "#FC4E07"),
             addEllipses = TRUE # Concentration ellipses
             )</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-individuals-factor-map-color-by-groups-1.png" alt="factoextra" width="576" />
<p class="caption">
factoextra
</p>
</div>
</div>
<div id="correspondence-analysis" class="section level3">
<h3>Correspondence analysis</h3>
<ul>
<li>Data: <em>housetasks</em> [in factoextra]</li>
<li>CA function <em>FactoMineR::CA</em>()</li>
<li>Visualize with <em>factoextra::fviz_ca</em>()</li>
</ul>
<p><span class="success">Read more about computing and interpreting correspondence analysis at: <a href="correspondence-analysis-in-r-the-ultimate-guide-for-the-analysis-the-visualization-and-the-interpretation-r-software-and-data-mining"><strong>Correspondence Analysis</strong> (CA)</a>.</span></p>
<ul>
<li><strong>Compute CA</strong>:</li>
</ul>
<pre class="r"><code> # Loading data
data("housetasks")

 # Computing CA
library("FactoMineR")
res.ca <- CA(housetasks, graph = FALSE)</code></pre>
<ul>
<li><strong>Extract results for row/column variables</strong>:</li>
</ul>
<pre class="r"><code># Result for row variables
get_ca_row(res.ca)

# Result for column variables
get_ca_col(res.ca)</code></pre>
<ul>
<li><strong>Biplot of rows and columns</strong></li>
</ul>
<pre class="r"><code>fviz_ca_biplot(res.ca, repel = TRUE)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-correspondence-analysis-biplot-1.png" alt="factoextra" width="480" />
<p class="caption">
factoextra
</p>
</div>
<p>To visualize only row points or column points, type this:</p>
<pre class="r"><code># Graph of row points
fviz_ca_row(res.ca, repel = TRUE)

# Graph of column points
fviz_ca_col(res.ca)

# Visualize row contributions on axes 1
fviz_contrib(res.ca, choice ="row", axes = 1)

# Visualize column contributions on axes 1
fviz_contrib(res.ca, choice ="col", axes = 1)</code></pre>
</div>
<div id="multiple-correspondence-analysis" class="section level3">
<h3>Multiple correspondence analysis</h3>
<ul>
<li>Data: <strong>poison</strong> [in factoextra]</li>
<li>MCA function <strong>FactoMineR::MCA</strong>()</li>
<li>Visualization <strong>factoextra::fviz_mca</strong>()</li>
</ul>
<p><span class="success">Read more about computing and interpreting multiple correspondence analysis at: <a href="multiple-correspondence-analysis-essentials-interpretation-and-application-to-investigate-the-associations-between-categories-of-multiple-qualitative-variables-r-software-and-data-mining"><strong>Multiple Correspondence Analysis</strong> (MCA)</a>.</span></p>
<ol style="list-style-type: decimal">
<li><strong>Computing MCA</strong>:</li>
</ol>
<pre class="r"><code>library(FactoMineR)
data(poison)
res.mca <- MCA(poison, quanti.sup = 1:2,
              quali.sup = 3:4, graph=FALSE)</code></pre>
<ol start="2" style="list-style-type: decimal">
<li><strong>Extract results for variables and individuals</strong>:</li>
</ol>
<pre class="r"><code># Extract the results for variable categories
get_mca_var(res.mca)

# Extract the results for individuals
get_mca_ind(res.mca)</code></pre>
<ol start="3" style="list-style-type: decimal">
<li><strong>Contribution of variables and individuals to the principal axes</strong>:</li>
</ol>
<pre class="r"><code># Visualize variable categorie contributions on axes 1
fviz_contrib(res.mca, choice ="var", axes = 1)

# Visualize individual contributions on axes 1
# select the top 20
fviz_contrib(res.mca, choice ="ind", axes = 1, top = 20)</code></pre>
<ol start="4" style="list-style-type: decimal">
<li><strong>Graph of individuals</strong></li>
</ol>
<pre class="r"><code># Color by groups
# Add concentration ellipses
# Use repel = TRUE to avoid overplotting
grp <- as.factor(poison[, "Vomiting"])
fviz_mca_ind(res.mca,  habillage = grp,
             addEllipses = TRUE, repel = TRUE)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-mca-graph-of-individuals-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<ol start="5" style="list-style-type: decimal">
<li><strong>Graph of variable categories</strong>:</li>
</ol>
<pre class="r"><code>fviz_mca_var(res.mca, repel = TRUE)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-mca-graph-variables-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<ol start="6" style="list-style-type: decimal">
<li><strong>Biplot of individuals and variables</strong>:</li>
</ol>
<pre class="r"><code>fviz_mca_biplot(res.mca, repel = TRUE)</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-mca-biplot-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
</div>
<div id="advanced-methods" class="section level3">
<h3>Advanced methods</h3>
<p>The factoextra R package has also functions that support the visualization of advanced methods such:</p>
<ul>
<li>Factor Analysis of Mixed Data (FAMD): : <a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_famd.html">FAMD Examples</a></li>
<li>Multiple Factor Analysis (MFA): <a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_mfa.html">MFA Examples</a></li>
<li>Hierarchical Multiple Factor Analysis (HMFA): <a href="https://www.sthda.com/english/rpkgs/factoextra/reference/fviz_hmfa.html">HMFA Examples</a></li>
<li><a href="hcpc-hierarchical-clustering-on-principal-components-hybrid-approach-2-2-unsupervised-machine-learning">Hierachical Clustering on Principal Components (HCPC)</a></li>
</ul>
</div>
</div>
<div id="cluster-analysis-and-factoextra" class="section level2">
<h2>Cluster analysis and factoextra</h2>
<p>To learn more about cluster analysis, you can refer to the book available at: <a href="https://www.sthda.com/english/wiki/practical-guide-to-cluster-analysis-in-r-book">Practical Guide to Cluster Analysis in R</a></p>
<p><a href = "https://www.sthda.com/english/wiki/practical-guide-to-cluster-analysis-in-r-book"><img src = "/../sthda/RDoc/images/clustering-e1-cover.png" alt = "clustering book cover"/></a></p>
<p>The main parts of the book include:</p>
<ul>
<li><em>distance measures</em>,</li>
<li><em>partitioning clustering</em>,</li>
<li><em>hierarchical clustering</em>,</li>
<li><em>cluster validation methods</em>, as well as,</li>
<li><em>advanced clustering methods</em> such as fuzzy clustering, density-based clustering and model-based clustering.</li>
</ul>
<p>The book presents the basic principles of these tasks and provide many examples in R. It offers solid guidance in data mining for students and researchers.</p>
<div id="partitioning-clustering" class="section level3">
<h3>Partitioning clustering</h3>
<p><img src="https://www.sthda.com/english/sthda/RDoc/images/partitioning-clustering.png" alt="Partitioning cluster analysis" /></p>
<pre class="r"><code># 1. Loading and preparing data
data("USArrests")
df <- scale(USArrests)

# 2. Compute k-means
set.seed(123)
km.res <- kmeans(scale(USArrests), 4, nstart = 25)

# 3. Visualize
library("factoextra")
fviz_cluster(km.res, data = df,
             palette = c("#00AFBB","#2E9FDF", "#E7B800", "#FC4E07"),
             ggtheme = theme_minimal(),
             main = "Partitioning Clustering Plot"
             )</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-partitioning-clustering-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<br/>


<div class="success">
<p>Read more:</p>
<ol style="list-style-type: decimal">
<li><p><a href="cluster-analysis-in-r-unsupervised-machine-learning">Cluster analysis in R: All what you should know</a>.</p></li>
<li><a href="partitioning-cluster-analysis-quick-start-guide-unsupervised-machine-learning">Partitioning cluster analysis</a>.</li>
</ol>
</div>
<p><br/></p>
</div>
<div id="hierarchical-clustering" class="section level3">
<h3>Hierarchical clustering</h3>
<p><img src="https://www.sthda.com/english/sthda/RDoc/images/hierarchical-clustering.png" alt="Hierarchical clustering" /></p>
<pre class="r"><code>library("factoextra")
# Compute hierarchical clustering and cut into 4 clusters
res <- hcut(USArrests, k = 4, stand = TRUE)

# Visualize
fviz_dend(res, rect = TRUE, cex = 0.5,
          k_colors = c("#00AFBB","#2E9FDF", "#E7B800", "#FC4E07"))</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-hierarchical-clustering-1.png" alt="factoextra" width="518.4" />
<p class="caption">
factoextra
</p>
</div>
<br/>


<div class="success">
<p>Read more:</p>
<ol style="list-style-type: decimal">
<li><p><a href="cluster-analysis-in-r-unsupervised-machine-learning">Cluster analysis in R: All what you should know</a></p></li>
<li><a href="hierarchical-clustering-essentials-unsupervised-machine-learning">Hierarchical clustering essentials</a></li>
</ol>
</div>
<p><br/></p>
</div>
<div id="determine-the-optimal-number-of-clusters" class="section level3">
<h3>Determine the optimal number of clusters</h3>
<pre class="r"><code># Optimal number of clusters for k-means
library("factoextra")
my_data <- scale(USArrests)
fviz_nbclust(my_data, kmeans, method = "gap_stat")</code></pre>
<div class="figure">
<img src="https://www.sthda.com/english/sthda/RDoc/figure/r-packages/factoextra/factoextra-determine-the-number-of-clusters-gap-statistics-1.png" alt="factoextra" width="384" />
<p class="caption">
factoextra
</p>
</div>
</div>
</div>
<div id="acknoweledgment" class="section level2">
<h2>Acknoweledgment</h2>
<p>I would like to thank <a href="https://github.com/inventionate">Fabian Mundt</a> for his active contributions to factoextra.</p>
<p>We sincerely thank all developers for their efforts behind the packages that <strong>factoextra</strong> depends on, namely, <a href="https://cran.r-project.org/package=ggplot2">ggplot2</a> (Hadley Wickham, Springer-Verlag New York, 2009), <a href="https://cran.r-project.org/package=FactoMineR">FactoMineR</a> (Sebastien Le et al., Journal of Statistical Software, 2008), <a href="https://cran.r-project.org/package=dendextend">dendextend</a> (Tal Galili, Bioinformatics, 2015), <a href="https://cran.r-project.org/package=dendextend">cluster</a> (Martin Maechler et al., 2016) and more …..</p>
</div>
<div id="references" class="section level2">
<h2>References</h2>
<ul>
<li>H. Wickham (2009). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York.</li>
<li>Maechler, M., Rousseeuw, P., Struyf, A., Hubert, M., Hornik, K.(2016). cluster: Cluster Analysis Basics and Extensions. R package version 2.0.5.</li>
<li>Sebastien Le, Julie Josse, Francois Husson (2008). FactoMineR: An R Package for Multivariate Analysis. Journal of Statistical Software, 25(1), 1-18. 10.18637/jss.v025.i01</li>
<li>Tal Galili (2015). dendextend: an R package for visualizing, adjusting, and comparing trees of hierarchical clustering. Bioinformatics. DOI: 10.1093/bioinformatics/btv428</li>
</ul>
</div>
<div id="infos" class="section level2">
<h2>Infos</h2>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.3.2) and <strong>factoextra</strong> (ver. 1.0.4.999) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('#rdoc h1').addClass('wiki_paragraph1');
    jQuery('#rdoc h2').addClass('wiki_paragraph2');
    jQuery('#rdoc h3').addClass('wiki_paragraph3');
    jQuery('#rdoc h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Sun, 19 Feb 2017 17:10:58 +0100</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/fviz-pca-quick-principal-component-analysis-data-visualization-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/fviz-pca-quick-principal-component-analysis-data-visualization-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#principal-component-analysis">Principal component analysis</a></li>
<li><a href="#fviz_pca_ind-graph-of-individuals">fviz_pca_ind(): Graph of individuals</a></li>
<li><a href="#fviz_pca_var-graph-of-variables">fviz_pca_var(): Graph of variables</a></li>
<li><a href="#fviz_pca_biplot-biplot-of-individuals-of-variables">fviz_pca_biplot(): Biplot of individuals of variables</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Draw the graph of individuals/variables from the output of <strong>Principal Component Analysis</strong> (PCA).</p>
<p>The following functions, from <strong>factoextra</strong> package are use:</p>
<ul>
<li><strong>fviz_pca_ind()</strong>: Graph of individuals</li>
<li><strong>fviz_pca_var()</strong>: Graph of variables</li>
<li><strong>fviz_pca_biplot()</strong> (or <em>fviz_pca()</em>): Biplot of individuals and variables</li>
</ul>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Graph of individuals
fviz_pca_ind(X, axes = c(1, 2), geom = c("point", "text"),
       label = "all", invisible = "none", labelsize = 4,
       pointsize = 2, habillage = "none",
       addEllipses = FALSE, ellipse.level = 0.95, 
       col.ind = "black", col.ind.sup = "blue", alpha.ind = 1,
       select.ind = list(name = NULL, cos2 = NULL, contrib = NULL),
       jitter = list(what = "label", width = NULL, height = NULL),  ...)

# Graph of variables
fviz_pca_var(X, axes = c(1, 2), geom = c("arrow", "text"),
       label = "all", invisible = "none", labelsize = 4,
       col.var = "black", alpha.var = 1, col.quanti.sup = "blue",
       col.circle = "grey70",
       select.var = list(name =NULL, cos2 = NULL, contrib = NULL),
       jitter = list(what = "label", width = NULL, height = NULL))

# Biplot of individuals and variables
fviz_pca_biplot(X, axes = c(1, 2), geom = c("point", "text"),
   label = "all", invisible = "none", labelsize = 4, pointsize = 2,
    habillage = "none", addEllipses = FALSE, ellipse.level = 0.95,
    col.ind = "black", col.ind.sup = "blue", alpha.ind = 1,
    col.var = "steelblue", alpha.var = 1, col.quanti.sup = "blue",
    col.circle = "grey70", 
    select.var = list(name = NULL, cos2 = NULL, contrib= NULL), 
    select.ind = list(name = NULL, cos2 = NULL, contrib = NULL),
    jitter = list(what = "label", width = NULL, height = NULL), ...)

# An alias of fviz_pca_biplot()
fviz_pca(X, ...)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
<thead>
<tr>
<th>
Argument
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>X</strong>
</td>
<td>
an object of class PCA [FactoMineR]; prcomp and princomp [stats]; dudi and pca [ade4].
</td>
</tr>
<tr>
<td>
<strong>axes</strong>
</td>
<td>
a numeric vector of length 2 specifying the dimensions to be plotted.
</td>
</tr>
<tr>
<td>
<strong>geom</strong>
</td>
<td>
a text specifying the geometry to be used for the graph. Allowed values are the combination of c(“point”, “arrow”, “text”). Use “point” (to show only points); “text” to show only labels; c(“point”, “text”) or c(“arrow”, “text”) to show both types.
</td>
</tr>
<tr>
<td>
<strong>label</strong>
</td>
<td>
a text specifying the elements to be labelled. Default value is “all”. Allowed values are “none” or the combination of c(“ind”, “ind.sup”, “quali”, “var”, “quanti.sup”). “ind” can be used to label only active individuals. “ind.sup” is for supplementary individuals. “quali” is for supplementary qualitative variables. “var” is for active variables. “quanti.sup” is for quantitative supplementary variables.
</td>
</tr>
<tr>
<td>
<strong>invisible</strong>
</td>
<td>
a text specifying the elements to be hidden on the plot. Default value is “none”. Allowed values are the combination of c(“ind”, “ind.sup”, “quali”, “var”, “quanti.sup”).
</td>
</tr>
<tr>
<td>
<strong>labelsize</strong>
</td>
<td>
font size for the labels.
</td>
</tr>
<tr>
<td>
<strong>pointsize</strong>
</td>
<td>
the size of points.
</td>
</tr>
<tr>
<td>
<strong>habillage</strong>
</td>
<td>
an optional factor variable for coloring the observations by groups. Default value is “none”. If X is a PCA object from FactoMineR package, habillage can also specify the supplementary qualitative variable (by its index or name) to be used for coloring individuals by groups (see ?PCA in FactoMineR).
</td>
</tr>
<tr>
<td>
<strong>addEllipses</strong>
</td>
<td>
logical value. If TRUE, draws ellipses around the individuals when habillage != “none”.
</td>
</tr>
<tr>
<td>
<strong>ellipse.level</strong>
</td>
<td>
the size of the concentration ellipse in normal probability.
</td>
</tr>
<tr>
<td>
<strong>col.ind,col.var</strong>
</td>
<td>
colors for individuals and variables, respectively. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the colors for individuals/variables are automatically controlled by their qualities of representation (“cos2”), contributions (“contrib”), coordinates (x^2 + y^2, “coord”), x values (“x”) or y values (“y”). To use automatic coloring (by cos2, contrib, ….), make sure that habillage =“none”.
</td>
</tr>
<tr>
<td>
<strong>col.ind.sup</strong>
</td>
<td>
color for supplementary individuals.
</td>
</tr>
<tr>
<td>
<strong>alpha.ind,alpha.var</strong>
</td>
<td>
controls the transparency of individual and variable colors, respectively. The value can variate from 0 (total transparency) to 1 (no transparency). Default value is 1. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the transparency for the individual/variable colors are automatically controlled by their qualities (“cos2”), contributions (“contrib”), coordinates (x^2 + y^2 , “coord”), x values(“x”) or y values(“y”). To use this, make sure that habillage =“none”.
</td>
</tr>
<tr>
<td>
<strong>select.ind,select.var</strong>
</td>
<td>
<p>a selection of individuals/variables to be drawn. Allowed values are NULL or a list containing the arguments name, cos2 or contrib:</p>
<ul>
<li>name: is a character vector containing individuals/variables to be drawn</li>
<li>cos2: if cos2 is in [0, 1], ex: 0.6, then individuals/variables with a cos2 > 0.6 are drawn. if cos2 > 1, ex: 5, then the top 5 individuals/variables with the highest cos2 are drawn.</li>
<li>contrib: if contrib > 1, ex: 5, then the top 5 individuals/variables with the highest cos2 are drawn
</td>
</tr></li>
</ul>
<tr>
<td>
<strong>jitter</strong>
</td>
<td>
a parameter used to jitter the points in order to reduce overplotting. It’s a list containing the objects <em>what, width and height</em> (Ex.; jitter = list(what, width, height)). <strong>what</strong>: the element to be jittered. Possible values are “point” or “p”; “label” or “l”; “both” or “b”. <strong>width</strong>: degree of jitter in x direction (ex: 0.2). <strong>height</strong>: degree of jitter in y direction (ex: 0.2).
</td>
</tr>
<tr>
<td>
<strong>col.quanti.sup</strong>
</td>
<td>
a color for the quantitative supplementary variables.
</td>
</tr>
<tr>
<td>
<strong>col.circle</strong>
</td>
<td>
a color for the correlation circle.
</td>
</tr>
<tr>
<td>
<strong>…</strong>
</td>
<td>
Arguments to be passed to the function fviz_pca_biplot().
</td>
</tr>
</tbody>
</table>
</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A <strong>ggplot2 plot</strong></p>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="principal-component-analysis" class="section level2">
<h2>Principal component analysis</h2>
<p>A principal component analysis (PCA) is performed using the built-in R function <strong>prcomp()</strong> and <em>iris</em> data:</p>
<pre class="r"><code>data(iris)
head(iris)</code></pre>
<pre><code>  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa</code></pre>
<pre class="r"><code># The variable Species (index = 5) is removed
# before the PCA analysis
res.pca <- prcomp(iris[, -5],  scale = TRUE)</code></pre>
</div>
<div id="fviz_pca_ind-graph-of-individuals" class="section level2">
<h2>fviz_pca_ind(): Graph of individuals</h2>
<pre class="r"><code># Default plot
fviz_pca_ind(res.pca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change title and axis labels
fviz_pca_ind(res.pca) +
  labs(title ="PCA", x = "PC1", y = "PC2")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change axis limits by specifying the min and max
fviz_pca_ind(res.pca) +
   xlim(-4, 4) + ylim (-4, 4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use text only
fviz_pca_ind(res.pca, geom="text")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-4.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use points only
fviz_pca_ind(res.pca, geom="point")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-5.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the size of points
fviz_pca_ind(res.pca, geom="point", pointsize = 4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-6.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change point color and theme
fviz_pca_ind(res.pca, col.ind = "blue")+
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-factoextra-data-mining-7.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of individuals
# using the cos2 or the contributions
# cos2 = the quality of the individuals on the factor map
fviz_pca_ind(res.pca, col.ind="cos2")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-color-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Gradient color
fviz_pca_ind(res.pca, col.ind="cos2") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.6)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-color-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the theme and use only points
fviz_pca_ind(res.pca, col.ind="cos2", geom = "point") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.6)+ theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-color-factoextra-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Color by the contributions
fviz_pca_ind(res.pca, col.ind="contrib") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-contributions-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of the color by the
# contributions
fviz_pca_ind(res.pca, alpha.ind="contrib") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-contributions-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Color individuals by groups
fviz_pca_ind(res.pca, label="none", habillage=iris$Species)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Add ellipses
p <- fviz_pca_ind(res.pca, label="none", habillage=iris$Species,
             addEllipses=TRUE, ellipse.level=0.95)
print(p)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change group colors using RColorBrewer color palettes
p + scale_color_brewer(palette="Dark2") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code>p + scale_color_brewer(palette="Paired") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-4.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code>p + scale_color_brewer(palette="Set1") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-5.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change color manually
p + scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-groups-factoextra-data-mining-6.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize individuals with cos2 > 0.96
fviz_pca_ind(res.pca, select.ind = list(cos2 = 0.96))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-select-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 20 according the cos2
fviz_pca_ind(res.pca, select.ind = list(cos2 = 20))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-select-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 20 contributing individuals
fviz_pca_ind(res.pca, select.ind = list(contrib = 20))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-select-factoextra-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_pca_ind(res.pca,
select.ind = list(name = c("23", "42", "119")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-individuals-select-factoextra-data-mining-4.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_pca_var-graph-of-variables" class="section level2">
<h2>fviz_pca_var(): Graph of variables</h2>
<pre class="r"><code># Default plot
fviz_pca_var(res.pca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use points and text
fviz_pca_var(res.pca, geom = c("point", "text"))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change color and theme
fviz_pca_var(res.pca, col.var="steelblue")+
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control variable colors using their contributions
fviz_pca_var(res.pca, col.var="contrib")+
 scale_color_gradient2(low="white", mid="blue",
           high="red", midpoint=96) +
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-4.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of variables using their contributions
fviz_pca_var(res.pca, alpha.var="contrib") +
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-5.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize variables with cos2 >= 0.96
fviz_pca_var(res.pca, select.var = list(cos2 = 0.96))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-6.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 3 contributing variables
fviz_pca_var(res.pca, select.var = list(contrib = 3))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-7.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_pca_var(res.pca,
   select.var= list(name = c("Sepal.Width", "Petal.Length")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-variables-data-mining-8.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_pca_biplot-biplot-of-individuals-of-variables" class="section level2">
<h2>fviz_pca_biplot(): Biplot of individuals of variables</h2>
<pre class="r"><code>fviz_pca_biplot(res.pca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-1.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only the labels for variables
fviz_pca_biplot(res.pca, label ="var")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-2.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only labels for individuals
fviz_pca_biplot(res.pca, label ="ind")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-3.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide variables
fviz_pca_biplot(res.pca, invisible ="var")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-4.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide individuals
fviz_pca_biplot(res.pca, invisible ="ind")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-5.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of individuals using the cos2
fviz_pca_biplot(res.pca, label ="var", col.ind="cos2") +
       theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-6.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the color by groups, add ellipses
fviz_pca_biplot(res.pca, label="var", habillage=iris$Species,
               addEllipses=TRUE, ellipse.level=0.95)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-7.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 30 contributing individuals
fviz_pca_biplot(res.pca, label="var",
               select.ind = list(contrib = 30))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_pca-principal-component-analysis-biplot-factoextra-data-mining-8.png" title="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" alt="fviz_pca: Quick Principal Component Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.2.1) and <strong>factoextra</strong> (ver. 1.0.3) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Thu, 12 Nov 2015 01:15:35 +0100</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/fviz-mca-quick-multiple-correspondence-analysis-data-visualization-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/fviz-mca-quick-multiple-correspondence-analysis-data-visualization-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#multiple-correspondence-analysis">Multiple Correspondence Analysis</a></li>
<li><a href="#fviz_mca_ind-graph-of-individuals">fviz_mca_ind(): Graph of individuals</a></li>
<li><a href="#fviz_mca_var-graph-of-variable-categories">fviz_mca_var(): Graph of variable categories</a></li>
<li><a href="#fviz_mca_biplot-biplot-of-individuals-of-variable-categories">fviz_mca_biplot(): Biplot of individuals of variable categories</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Draw the graph of individuals/variables from the output of <strong>Multiple Correspondence Analysis</strong> (MCA).</p>
<p>The following functions, from <strong>factoextra</strong> package are use:</p>
<ul>
<li><strong>fviz_mca_ind()</strong>: Graph of individuals</li>
<li><strong>fviz_mca_var()</strong>: Graph of variable categories</li>
<li><strong>fviz_mca_biplot()</strong> (or <em>fviz_mca()</em>): Biplot of individuals and variable categories</li>
</ul>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Graph of individuals
fviz_mca_ind(X, axes = c(1, 2), 
  geom = c("point", "text"), label = "all", invisible = "none",
  labelsize = 4, pointsize = 2, habillage = "none",
  addEllipses = FALSE, ellipse.level = 0.95, col.ind = "blue",
  col.ind.sup = "darkblue", alpha.ind = 1, shape.ind = 19,
  select.ind = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric", 
  jitter = list(what = "label", width = NULL, height = NULL), ...)

# Graph of variables
fviz_mca_var(X, axes = c(1, 2),
  geom = c("point", "text"), label = "all",
  invisible = "none", labelsize = 4, pointsize = 2, col.var = "red",
  alpha.var = 1, shape.var = 17, col.quanti.sup = "blue",
  col.quali.sup = "darkgreen", col.circle = "grey70",
  select.var = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric", 
  jitter = list(what = "label", width = NULL, height = NULL))

# Biplot of individuals and variables
fviz_mca_biplot(X, axes = c(1, 2), geom = c("point", "text"),
  label = "all", invisible = "none", labelsize = 4, pointsize = 2,
  habillage = "none", addEllipses = FALSE, ellipse.level = 0.95,
  col.ind = "blue", col.ind.sup = "darkblue", alpha.ind = 1,
  col.var = "red", alpha.var = 1, col.quanti.sup = "blue",
  col.quali.sup = "darkgreen", shape.ind = 19, shape.var = 17,
  select.var = list(name = NULL, cos2 = NULL, contrib = NULL),
  select.ind = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric", arrows = c(FALSE, FALSE), 
  jitter = list(what = "label", width = NULL, height = NULL), ...)

# An alias of fviz_mca_biplot()
fviz_mca(X, ...)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
<thead>
<tr>
<th>
Argument
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>X</strong>
</td>
<td>
an object of class MCA [FactoMineR]; mca [ade4].
</td>
</tr>
<tr>
<td>
<strong>axes</strong>
</td>
<td>
a numeric vector of length 2 specifying the dimensions to be plotted.
</td>
</tr>
<tr>
<td>
<strong>geom</strong>
</td>
<td>
a text specifying the geometry to be used for the graph. Allowed values are the combination of c(“point”, “arrow”, “text”). Use “point” (to show only points); “text” to show only labels; c(“point”, “text”) or c(“arrow”, “text”) to show both types.
</td>
</tr>
<tr>
<td>
<strong>label</strong>
</td>
<td>
a text specifying the elements to be labelled. Default value is “all”. Allowed values are “none” or the combination of c(“ind”, “ind.sup”,“var”, “quali.sup”, “quanti.sup”). “ind” can be used to label only active individuals. “ind.sup” is for supplementary individuals. “var” is for active variable categories. “quali.sup” is for supplementary qualitative variable categories. “quanti.sup” is for quantitative supplementary variables.
</td>
</tr>
<tr>
<td>
<strong>invisible</strong>
</td>
<td>
a text specifying the elements to be hidden on the plot. Default value is “none”. Allowed values are the combination of c(“ind”, “ind.sup”,“var”, “quali.sup”, “quanti.sup”).
</td>
</tr>
<tr>
<td>
<strong>labelsize</strong>
</td>
<td>
font size for the labels.
</td>
</tr>
<tr>
<td>
<strong>pointsize</strong>
</td>
<td>
the size of points.
</td>
</tr>
<tr>
<td>
<strong>habillage</strong>
</td>
<td>
an optional factor variable for coloring the observations by groups. Default value is “none”. If X is a MCA object from FactoMineR package, habillage can also specify the supplementary qualitative variable (by its index or name) to be used for coloring individuals by groups (see ?MCA in FactoMineR).
</td>
</tr>
<tr>
<td>
<strong>addEllipses</strong>
</td>
<td>
logical value. If TRUE, draws ellipses around the individuals when habillage != “none”.
</td>
</tr>
<tr>
<td>
<strong>ellipse.level</strong>
</td>
<td>
the size of the concentration ellipse in normal probability.
</td>
</tr>
<tr>
<td>
<strong>col.ind,col.var</strong>
</td>
<td>
colors for individuals and variables, respectively. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the colors for individuals/variables are automatically controlled by their qualities of representation (“cos2”), contributions (“contrib”), coordinates (x^2 + y^2 , “coord”), x values (“x”) or y values (“y”). To use automatic coloring (by cos2, contrib, ….), make sure that habillage =“none”.
</td>
</tr>
<tr>
<td>
<strong>col.ind.sup</strong>
</td>
<td>
color for supplementary individuals.
</td>
</tr>
<tr>
<td>
<strong>alpha.ind,alpha.var</strong>
</td>
<td>
controls the transparency of individual and variable colors, respectively. The value can variate from 0 (total transparency) to 1 (no transparency). Default value is 1. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the transparency for the individual/variable colors are automatically controlled by their qualities (“cos2”), contributions (“contrib”), coordinates (x<sup>2+y</sup>2 , “coord”), x values(“x”) or y values(“y”). To use this, make sure that habillage =“none”.
</td>
</tr>
<tr>
<td>
<strong>select.ind,select.var</strong>
</td>
<td>
<p>a selection of individuals/variables to be drawn. Allowed values are NULL or a list containing the arguments name, cos2 or contrib:</p>
<ul>
<li>name: is a character vector containing individuals/variables to be drawn</li>
<li>cos2: if cos2 is in [0, 1], ex: 0.6, then individuals/variables with a cos2 > 0.6 are drawn. if cos2 > 1, ex: 5, then the top 5 individuals/variables with the highest cos2 are drawn.</li>
<li>contrib: if contrib > 1, ex: 5, then the top 5 individuals/variables with the highest cos2 are drawn
</td>
</tr></li>
</ul>
<tr>
<td>
<strong>map</strong>
</td>
<pre><code><td>character string specifying the map type. Allowed options include: "symmetric", "rowprincipal", "colprincipal", "symbiplot", "rowgab", "colgab", "rowgreen" and "colgreen". See details</td></tr></code></pre>
<tr>
<td>
<strong>jitter</strong>
</td>
<td>
a parameter used to jitter the points in order to reduce overplotting. It’s a list containing the objects <em>what, width and height</em> (Ex.; jitter = list(what, width, height)). <strong>what</strong>: the element to be jittered. Possible values are “point” or “p”; “label” or “l”; “both” or “b”. <strong>width</strong>: degree of jitter in x direction (ex: 0.2). <strong>height</strong>: degree of jitter in y direction (ex: 0.2).
</td>
</tr>
<tr>
<td>
<strong>col.quanti.sup, col.quali.sup</strong>
</td>
<td>
a color for the quantitative/qualitative supplementary variables.
</td>
</tr>
<tr>
<td>
<strong>arrows</strong>
</td>
<td>
Vector of two logicals specifying if the plot should contain points (FALSE, default) or arrows (TRUE). First value sets the rows and the second value sets the columns.
</td>
</tr>
<tr>
<td>
<strong>…</strong>
</td>
<td>
Arguments to be passed to the function fviz_mca_biplot().
</td>
</tr>
</tbody>
</table>
</div>
<div id="details" class="section level1">
<h1>Details</h1>
<p>The default plot of MCA is a “symmetric” plot in which both rows and columns are in principal coordinates. In this situation, it’s not possible to interpret the distance between row points and column points. To overcome this problem, the simplest way is to make an asymmetric plot. This means that, the column profiles must be presented in row space or vice-versa. The allowed options for the argument map are:</p>
<ul>
<li><p>“rowprincipal” or “colprincipal”: asymmetric plots with either rows in principal coordinates and columns in standard coordinates, or vice versa. These plots preserve row metric or column metric respectively.</p></li>
<li><p>“symbiplot”: Both rows and columns are scaled to have variances equal to the singular values (square roots of eigenvalues), which gives a symmetric biplot but does not preserve row or column metrics.</p></li>
<li><p>“rowgab” or “colgab”: Asymmetric maps, proposed by Gabriel &amp; Odoroff (1990), with rows (respectively, columns) in principal coordinates and columns (respectively, rows) in standard coordinates multiplied by the mass of the corresponding point.</p></li>
<li><p>“rowgreen” or “colgreen”: The so-called contribution biplots showing visually the most contributing points (Greenacre 2006b). These are similar to “rowgab” and “colgab” except that the points in standard coordinates are multiplied by the square root of the corresponding masses, giving reconstructions of the standardized residuals.</p></li>
</ul>
</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A <strong>ggplot2</strong> plot</p>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="multiple-correspondence-analysis" class="section level2">
<h2>Multiple Correspondence Analysis</h2>
<p>A <strong>Multiple Correspondence Analysis</strong> (MCA) is performed using the function <strong>MCA()</strong> [in <em>FactoMineR</em>] and <em>poison</em> data [in <em>FactoMineR</em>]:</p>
<pre class="r"><code># Install and load FactoMineR to compute MCA
# install.packages("FactoMineR")
library("FactoMineR")
data(poison)
poison.active <- poison[1:55, 5:15]
head(poison.active[, 1:6])</code></pre>
<pre><code>    Nausea Vomiting Abdominals   Fever   Diarrhae   Potato
1 Nausea_y  Vomit_n     Abdo_y Fever_y Diarrhea_y Potato_y
2 Nausea_n  Vomit_n     Abdo_n Fever_n Diarrhea_n Potato_y
3 Nausea_n  Vomit_y     Abdo_y Fever_y Diarrhea_y Potato_y
4 Nausea_n  Vomit_n     Abdo_n Fever_n Diarrhea_n Potato_y
5 Nausea_n  Vomit_y     Abdo_y Fever_y Diarrhea_y Potato_y
6 Nausea_n  Vomit_n     Abdo_y Fever_y Diarrhea_y Potato_y</code></pre>
<pre class="r"><code>res.mca <- MCA(poison.active, graph=FALSE)</code></pre>
</div>
<div id="fviz_mca_ind-graph-of-individuals" class="section level2">
<h2>fviz_mca_ind(): Graph of individuals</h2>
<pre class="r"><code># Default plot
fviz_mca_ind(res.mca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-1.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change title and axis labels
fviz_mca_ind(res.mca) +
 labs(title = "MCA", x = "Dim.1", y ="Dim.2" )</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-2.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change axis limits by specifying the min and max
fviz_mca_ind(res.mca) +
   xlim(-0.8, 1.5) + ylim (-1.5, 1.5)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-3.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use text only
fviz_mca_ind(res.mca, geom = "text")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-4.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use points only
fviz_mca_ind(res.mca, geom="point")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-5.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the size of points
fviz_mca_ind(res.mca, geom="point", pointsize = 4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-6.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change point color and theme
fviz_mca_ind(res.mca, col.ind = "blue")+
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-7.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Reduce overplotting
fviz_mca_ind(res.mca, 
             jitter = list(width = 0.2, height = 0.2))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-factoextra-data-mining-8.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of individuals
# using the cos2 or the contributions
# cos2 = the quality of the individuals on the factor map
fviz_mca_ind(res.mca, col.ind="cos2")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-1.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Gradient color
fviz_mca_ind(res.mca, col.ind="cos2") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-2.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the theme and use only points
fviz_mca_ind(res.mca, col.ind="cos2", geom = "point") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.4)+ theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-3.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Color by the contributions
fviz_mca_ind(res.mca, col.ind="contrib") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=1.5)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-4.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of the color by the
# contributions
fviz_mca_ind(res.mca, alpha.ind="contrib") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-5.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Color individuals by groups
grp <- as.factor(poison.active[, "Vomiting"])
fviz_mca_ind(res.mca, label="none", habillage=grp)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-6.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Add ellipses
p <- fviz_mca_ind(res.mca, label="none", habillage=grp,
             addEllipses=TRUE, ellipse.level=0.95)
print(p)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-7.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change group colors using RColorBrewer color palettes
p + scale_color_brewer(palette="Dark2") +
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-8.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code>p + scale_color_brewer(palette="Paired") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-9.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code>p + scale_color_brewer(palette="Set1") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-10.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change color manually
p + scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-colors-factoextra-data-mining-11.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize individuals with cos2 >= 0.4
fviz_mca_ind(res.mca, select.ind = list(cos2 = 0.4))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-select-factoextra-data-mining-1.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 20 according to the cos2
fviz_mca_ind(res.mca, select.ind = list(cos2 = 20))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-select-factoextra-data-mining-2.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 20 contributing individuals
fviz_mca_ind(res.mca, select.ind = list(contrib = 20))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-select-factoextra-data-mining-3.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_mca_ind(res.mca,
select.ind = list(name = c("44", "38", "53",  "39")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-individuals-select-factoextra-data-mining-4.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_mca_var-graph-of-variable-categories" class="section level2">
<h2>fviz_mca_var(): Graph of variable categories</h2>
<pre class="r"><code># Default plot
fviz_mca_var(res.mca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-1.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change color and theme
fviz_mca_var(res.mca, col.var="steelblue")+
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-2.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control variable colors using their contributions
fviz_mca_var(res.mca, col.var = "contrib")+
 scale_color_gradient2(low = "white", mid = "blue",
           high = "red", midpoint = 2) +
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-3.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of variables using their contributions
fviz_mca_var(res.mca, alpha.var = "contrib") +
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-4.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize categories with cos2 >= 0.4
fviz_mca_var(res.mca, select.var = list(cos2 = 0.4))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-5.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 10 contributing variable categories
fviz_mca_var(res.mca, select.var = list(contrib = 10))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-6.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_mca_var(res.mca,
 select.var= list(name = c("Courg_n", "Fever_y", "Fever_n")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-variables-factoextra-data-mining-7.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_mca_biplot-biplot-of-individuals-of-variable-categories" class="section level2">
<h2>fviz_mca_biplot(): Biplot of individuals of variable categories</h2>
<pre class="r"><code>fviz_mca_biplot(res.mca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-1.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only the labels for variable categories
fviz_mca_biplot(res.mca, label ="var")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-2.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only labels for individuals
fviz_mca_biplot(res.mca, label ="ind")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-3.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide variable categories
fviz_mca_biplot(res.mca, invisible ="var")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-4.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide individuals
fviz_mca_biplot(res.mca, invisible ="ind")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-5.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of individuals using the cos2
fviz_mca_biplot(res.mca, label ="var", col.ind="cos2") +
       theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-6.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the color by groups, add ellipses
fviz_mca_biplot(res.mca, label="var", col.var ="blue",
   habillage=grp, addEllipses=TRUE, ellipse.level=0.95) +
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-7.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 30 contributing individuals
# And the top 10 variables
fviz_mca_biplot(res.mca,
               select.ind = list(contrib = 30),
               select.var = list(contrib = 10))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_mca-multiple-correspondence-analysis-biplot-factoextra-data-mining-8.png" title="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" alt="fviz_mca: Quick Multiple Correspondence Analysis data visualization - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.2.1) and <strong>factoextra</strong> (ver. 1.0.3) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Thu, 12 Nov 2015 01:09:40 +0100</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[fviz_ca: Quick Correspondence Analysis data visualization using factoextra - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/fviz-ca-quick-correspondence-analysis-data-visualization-using-factoextra-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/fviz-ca-quick-correspondence-analysis-data-visualization-using-factoextra-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">


<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#correspondence-analysis">Correspondence Analysis</a></li>
<li><a href="#fviz_ca_row-graph-of-row-variables">fviz_ca_row(): Graph of row variables</a></li>
<li><a href="#fviz_ca_col-graph-of-column-categories">fviz_ca_col(): Graph of column categories</a></li>
<li><a href="#fviz_ca_biplot-biplot-of-rows-and-columns">fviz_ca_biplot(): Biplot of rows and columns</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Graph of column/row variables from the output of <strong>Correspondence Analysis</strong> (CA).</p>
<p>The following functions, from <strong>factoextra</strong> package are use:</p>
<ul>
<li><strong>fviz_ca_row()</strong>: Graph of row variables</li>
<li><strong>fviz_ca_col()</strong>: Graph of column variables</li>
<li><strong>fviz_ca_biplot()</strong>: Biplot of row and column variables</li>
<li><strong>fviz_ca()</strong>: An alias of fviz_ca_biplot()</li>
</ul>
<p>These functions are included in <strong>factoextra</strong> package.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Graph of row variables
fviz_ca_row(X, axes = c(1, 2), shape.row = 19,
  geom = c("point", "text"), label = "all", 
  invisible = "none", labelsize = 4, pointsize = 2,
  col.row = "blue", col.row.sup = "darkblue", alpha.row = 1,
  select.row = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric",
  jitter = list(what = "label", width = NULL, height = NULL), ...)

# Graph of column variables
fviz_ca_col(X, axes = c(1, 2), shape.col = 17,
  geom = c("point", "text"), label = "all",
  invisible = "none", labelsize = 4, pointsize = 2,
  col.col = "red", col.col.sup = "darkred", alpha.col = 1,
  select.col = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric",
 jitter = list(what = "label", width = NULL, height = NULL), ...)

# Biplot of row and column  variables
fviz_ca_biplot(X, axes = c(1, 2), shape.row = 19, shape.col = 17,
  geom = c("point", "text"), label = "all", invisible = "none",
  labelsize = 4, pointsize = 2, col.col = "red",
  col.col.sup = "darkred", alpha.col = 1, col.row = "blue",
  col.row.sup = "darkblue", alpha.row = 1,
  select.col = list(name = NULL, cos2 = NULL, contrib = NULL),
  select.row = list(name = NULL, cos2 = NULL, contrib = NULL),
  map = "symmetric", arrows = c(FALSE, FALSE),
  jitter = list(what = "label", width = NULL, height = NULL), ...)


# An alias of fviz_ca_biplot()
fviz_ca(X, ...)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
<thead>
<tr>
<th>
Argument
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>X</strong>
</td>
<td>
an object of class CA [FactoMineR], ca [ca], coa [ade4]; correspondence [MASS].
</td>
</tr>
<tr>
<td>
<strong>axes</strong>
</td>
<td>
a numeric vector of length 2 specifying the dimensions to be plotted.
</td>
</tr>
<tr>
<td>
<strong>shape.row,shape.col</strong>
</td>
<td>
the point shapes to be used for row/column variables. Default values are 19 for rows and 17 for columns.
</td>
</tr>
<tr>
<td>
<strong>geom</strong>
</td>
<td>
a text specifying the geometry to be used for the graph. Allowed values are the combination of c(“point”, “arrow”, “text”). Use “point” (to show only points); “text” to show only labels; c(“point”, “text”) or c(“arrow”, “text”) to show both types.
</td>
</tr>
<tr>
<td>
<strong>label</strong>
</td>
<td>
a character vector specifying the elements to be labelled. Default value is “all”. Allowed values are “none” or the combination of c(“row”, “row.sup”, “col”, “col.sup”). Use “col” to label only active column variables; “col.sup” to label only supplementary columns; etc
</td>
</tr>
<tr>
<td>
<strong>invisible</strong>
</td>
<td>
a character value specifying the elements to be hidden on the plot. Default value is “none”. Allowed values are the combination of c(“row”, “row.sup”, “col”, col.sup“).
</td>
</tr>
<tr>
<td>
<strong>labelsize</strong>
</td>
<td>
font size for the labels.
</td>
</tr>
<tr>
<td>
<strong>pointsize</strong>
</td>
<td>
the size of points.
</td>
</tr>
<tr>
<td>
<strong>map</strong>
</td>
<td>
character string specifying the map type. Allowed options include: “symmetric”, “rowprincipal”, “colprincipal”, “symbiplot”, “rowgab”, “colgab”, “rowgreen” and “colgreen”. See details
</td>
</tr>
<tr>
<pre><code><td>**jitter**</td><td>a parameter used to jitter the points in order to reduce overplotting. It&amp;#39;s a list containing the objects *what, width and height* (Ex.; jitter = list(what, width, height)). **what**: the element to be jittered. Possible values are "point" or "p"; "label" or "l"; "both" or "b". **width**: degree of jitter in x direction (ex: 0.2).  **height**: degree of jitter in y direction (ex: 0.2).</td></tr></code></pre>
<tr>
<td>
<strong>col.col,col.row</strong>
</td>
<td>
color for column/row points. The default values are “red” and “blue”, respectively. Allowed values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the colors for row/column variables are automatically controlled by their qualities (“cos2”), contributions (“contrib”), coordinates (x^2 + y^2, “coord”), x values(“x”) or y values(“y”)
</td>
</tr>
<tr>
<td>
<strong>col.col.sup,col.row.sup</strong>
</td>
<td>
colors for the supplementary column and row points, respectively.
</td>
</tr>
<tr>
<pre><code><td>**alpha.col,alpha.row**</td><td>controls the transparency of colors. The value can variate from 0 (total transparency) to 1 (no transparency). Default value is 1. Allowed values include also : "cos2", "contrib", "coord", "x" or "y" as for the arguments col.col and col.row..</td></tr></code></pre>
<tr>
<td>
<strong>select.col,select.row</strong>
</td>
<td>
<p>a selection of columns/rows to be drawn. Allowed values are NULL or a list containing the arguments name, cos2 or contrib:</p>
<ul>
<li>name: is a character vector containing columns/rows to be drawn</li>
<li>cos2: if cos2 is in [0, 1], ex: 0.6, then columns/rows with a cos2 > 0.6 are drawn. if cos2 > 1, ex: 5, then the top 5 columns/rows with the highest cos2 are drawn.</li>
<li>contrib: if contrib > 1, ex: 5, then the top 5 columns/rows with the highest cos2 are drawn
</td>
</tr></li>
</ul>
<tr>
<td>
<strong>arrows</strong>
</td>
<td>
Vector of two logicals specifying if the plot should contain points (FALSE, default) or arrows (TRUE). First value sets the rows and the second value sets the columns.
</td>
</tr>
<tr>
<td>
<strong>…</strong>
</td>
<td>
Optional arguments.
</td>
</tr>
</tbody>
</table>
</div>
<div id="details" class="section level1">
<h1>Details</h1>
<p>The default plot of CA is a “symmetric” plot in which both rows and columns are in principal coordinates. In this situation, it’s not possible to interpret the distance between row points and column points. To overcome this problem, the simplest way is to make an asymmetric plot. This means that, the column profiles must be presented in row space or vice-versa. The allowed options for the argument map are:</p>
<ul>
<li><p>“rowprincipal” or “colprincipal”: asymmetric plots with either rows in principal coordinates and columns in standard coordinates, or vice versa. These plots preserve row metric or column metric respectively.</p></li>
<li><p>“symbiplot”: Both rows and columns are scaled to have variances equal to the singular values (square roots of eigenvalues), which gives a symmetric biplot but does not preserve row or column metrics.</p></li>
<li><p>“rowgab” or “colgab”: Asymmetric maps, proposed by Gabriel &amp; Odoroff (1990), with rows (respectively, columns) in principal coordinates and columns (respectively, rows) in standard coordinates multiplied by the mass of the corresponding point.</p></li>
<li><p>“rowgreen” or “colgreen”: The so-called contribution biplots showing visually the most contributing points (Greenacre 2006b). These are similar to “rowgab” and “colgab” except that the points in standard coordinates are multiplied by the square root of the corresponding masses, giving reconstructions of the standardized residuals.</p></li>
</ul>
</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A <strong>ggplot2</strong> plot</p>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="correspondence-analysis" class="section level2">
<h2>Correspondence Analysis</h2>
<p><strong>Correspondence Analysis</strong> (CA) is performed using the function <strong>CA()</strong> [in <em>FactoMineR</em>] and <em>housetasks</em> data [in <em>factoextra</em>]:</p>
<pre class="r"><code># Install and load FactoMineR to compute CA
# install.packages("FactoMineR")
library("FactoMineR")
data(housetasks)
head(housetasks)</code></pre>
<pre><code>           Wife Alternating Husband Jointly
Laundry     156          14       2       4
Main_meal   124          20       5       4
Dinner       77          11       7      13
Breakfeast   82          36      15       7
Tidying      53          11       1      57
Dishes       32          24       4      53</code></pre>
<pre class="r"><code>res.ca <- CA(housetasks, graph=FALSE)</code></pre>
</div>
<div id="fviz_ca_row-graph-of-row-variables" class="section level2">
<h2>fviz_ca_row(): Graph of row variables</h2>
<pre class="r"><code># Default plot
fviz_ca_row(res.ca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-1.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change title and axis labels
fviz_ca_row(res.ca) +
 labs(title = "CA", x = "Dim.1", y ="Dim.2" )</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-2.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change axis limits by specifying the min and max
fviz_ca_row(res.ca) +
   xlim(-1.3, 1.7) + ylim (-1.5, 1)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-3.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use text only
fviz_ca_row(res.ca, geom = "text")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-4.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use points only
fviz_ca_row(res.ca, geom="point")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-5.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the size of points
fviz_ca_row(res.ca, geom="point", pointsize = 4)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-6.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change point color and theme
fviz_ca_row(res.ca, col.row = "violet")+
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-factoextra-data-mining-7.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of row points
# using the cos2 or the contributions
# cos2 = the quality of the rows on the factor map
fviz_ca_row(res.ca, col.row="cos2")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-colors-factoextra-data-mining-1.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Gradient color
fviz_ca_row(res.ca, col.row="cos2") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.5)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-colors-factoextra-data-mining-2.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change the theme and use only points
fviz_ca_row(res.ca, col.row="cos2", geom = "point") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=0.4)+ theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-colors-factoextra-data-mining-3.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Color by the contributions
fviz_ca_row(res.ca, col.row="contrib") +
      scale_color_gradient2(low="white", mid="blue",
      high="red", midpoint=10)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-colors-factoextra-data-mining-4.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of the color by the
# contributions
fviz_ca_row(res.ca, alpha.row="contrib") +
     theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-colors-factoextra-data-mining-5.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="480" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize rows with cos2 > 0.5
fviz_ca_row(res.ca, select.row = list(cos2 = 0.5))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-select-factoextra-data-mining-1.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 7 according to the cos2
fviz_ca_row(res.ca, select.row = list(cos2 = 7))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-select-factoextra-data-mining-2.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 7 contributing rows
fviz_ca_row(res.ca, select.row = list(contrib = 7))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-select-factoextra-data-mining-3.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_ca_row(res.ca,
select.row = list(name = c("Breakfeast", "Repairs", "Holidays")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-rows-select-factoextra-data-mining-4.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_ca_col-graph-of-column-categories" class="section level2">
<h2>fviz_ca_col(): Graph of column categories</h2>
<pre class="r"><code># Default plot
fviz_ca_col(res.ca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-1.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Change color and theme
fviz_ca_col(res.ca, col.col="steelblue")+
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-2.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control colors using their contributions
fviz_ca_col(res.ca, col.col = "contrib")+
 scale_color_gradient2(low = "white", mid = "blue",
           high = "red", midpoint = 25) +
 theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-3.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control the transparency of variables using their contributions
fviz_ca_col(res.ca, alpha.col = "contrib") +
   theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-4.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select and visualize columns with cos2 >= 0.4
fviz_ca_col(res.ca, select.col = list(cos2 = 0.4))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-5.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 3 contributing columns
fviz_ca_col(res.ca, select.col = list(contrib = 3))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-6.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select by names
fviz_ca_col(res.ca,
 select.col= list(name = c("Wife", "Husband", "Jointly")))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-columns-factoextra-data-mining-7.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="fviz_ca_biplot-biplot-of-rows-and-columns" class="section level2">
<h2>fviz_ca_biplot(): Biplot of rows and columns</h2>
<pre class="r"><code># Symetric Biplot of rows and columns
fviz_ca_biplot(res.ca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-1.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Asymetric biplot, use arrows for columns
fviz_ca_biplot(res.ca, map ="rowprincipal",
 arrow = c(FALSE, TRUE))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-2.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only the labels for row points
fviz_ca_biplot(res.ca, label ="row")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-3.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Keep only labels for column points
fviz_ca_biplot(res.ca, label ="col")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-4.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide row points
fviz_ca_biplot(res.ca, invisible ="row")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-5.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Hide column points
fviz_ca_biplot(res.ca, invisible ="col")</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-6.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Control automatically the color of rows using the cos2
fviz_ca_biplot(res.ca, col.row="cos2") +
       theme_minimal()</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-7.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Select the top 7 contributing rows
# And the top 3 columns
fviz_ca_biplot(res.ca,
               select.row = list(contrib = 7),
               select.col = list(contrib = 3))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/fviz_ca-correspondence-analysis-biplot-factoextra-data-mining-8.png" title="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" alt="Quick Correspondence Analysis data visualization using factoextra - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.2.1) and <strong>factoextra</strong> (ver. 1.0.3) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->



<!-- END HTML -->]]></description>
			<pubDate>Wed, 11 Nov 2015 14:44:28 +0100</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[facto_summarize - Subset and summarize the output of factor analyses - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/facto-summarize-subset-and-summarize-the-output-of-factor-analyses-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/facto-summarize-subset-and-summarize-the-output-of-factor-analyses-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">


<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#principal-component-analysis">Principal component analysis</a></li>
<li><a href="#correspondence-analysis">Correspondence Analysis</a></li>
<li><a href="#multiple-correspondence-analysis">Multiple Correspondence Analysis</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Subset and summarize the results of <strong>Principal Component Analysis</strong> (PCA), <strong>Correspondence Analysis</strong> (CA) and <strong>Multiple Correspondence Analysis</strong> (MCA) functions from several packages.</p>
<p>The function <strong>facto_summarize()</strong> [in <em>factoextra</em> package] is used.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
devtools::install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code>facto_summarize(X, element, result = c("coord", "cos2", "contrib"),
                axes = 1:2, select = NULL)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
  <thead>
    <tr><th>
Argument
</th><th>
Description
</th></tr>
  </thead>
  
<tbody>
  <tr>
    <td>
<strong>X</strong>
</td>
    <td>
an object of class PCA, CA and MCA [FactoMineR]; prcomp and princomp [stats]; dudi, pca, coa and acm [ade4]; ca [ca package].
</td>
  </tr>
  
<tr>
    <td>
<strong>element</strong>
</td>
    <td>
allowed values are “row” and “col” for CA; “var” and “ind” for PCA or MCA.
</td>
  </tr>
  
<tr>
    <td>
<strong>result</strong>
</td>
    <td>
the result to be extracted for the element. Possible values are the combination of c(“cos2”, “contrib”, “coord”).
</td>
  </tr>
  
<tr>
    <td>
<strong>axes</strong>
</td>
    <td>
a numeric vector specifying the axes of interest. Default values are 1:2 for axes 1 and 2.
</td>
  </tr>
  
<tr>
    <td>
<strong>select</strong>
</td>
    <td>
<p>a selection of variables. Allowed values are NULL or a list containing the arguments name, cos2 or contrib. Default is list(name = NULL, cos2 = NULL, contrib = NULL):</p>
<ul>
<li><strong>name</strong>: is a character vector containing variable names to be selected</li>
<li><strong>cos2</strong>: if cos2 is in [0, 1], ex: 0.6, then variables with a cos2 > 0.6 are selected. if cos2 > 1, ex: 5, then the top 5 variables with the highest cos2 are selected</li>
<li><strong>contrib</strong>: if contrib > 1, ex: 5, then the top 5 variables with the highest contrib are selected.
</td>
  </tr>
</li>
</ul>
</tbody> 
</table>
     

</div>
<div id="details" class="section level1">
<h1>Details</h1>
<p>If length(axes) > 1, then the columns contrib and cos2 correspond to the total contributions and total cos2 of the axes. In this case, the column coord is calculated as x^2 + y^2 + …+; x, y, … are the coordinates of the points on the specified axes.</p>
</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A data frame containing the (total) coord, cos2 and the contribution for the axes.</p>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="principal-component-analysis" class="section level2">
<h2>Principal component analysis</h2>
<p>A <strong>principal component analysis</strong> (PCA) is performed using the built-in R function <strong>prcomp()</strong> and the <em>decathlon2</em> [in <em>factoextra</em>] data</p>
<pre class="r"><code>data(decathlon2)
decathlon2.active <- decathlon2[1:23, 1:10]
res.pca <- prcomp(decathlon2.active,  scale = TRUE)
# Summarize variables on axes 1:2
facto_summarize(res.pca, "var", axes = 1:2)[,-1]</code></pre>
<pre><code>                    Dim.1       Dim.2     coord      cos2  contrib
X100m        -0.850625692  0.17939806 0.7557477 0.7557477 75.57477
Long.jump     0.794180641 -0.28085695 0.7096035 0.7096035 70.96035
Shot.put      0.733912733 -0.08540412 0.5459218 0.5459218 54.59218
High.jump     0.610083985  0.46521415 0.5886267 0.5886267 58.86267
X400m        -0.701603377 -0.29017826 0.5764507 0.5764507 57.64507
X110m.hurdle -0.764125197  0.02474081 0.5844994 0.5844994 58.44994
Discus        0.743209016 -0.04966086 0.5548258 0.5548258 55.48258
Pole.vault   -0.217268042 -0.80745110 0.6991827 0.6991827 69.91827
Javeline      0.428226639 -0.38610928 0.3324584 0.3324584 33.24584
X1500m        0.004278487 -0.78448019 0.6154275 0.6154275 61.54275</code></pre>
<pre class="r"><code># Select the top 5 contributing variables
facto_summarize(res.pca, "var", axes = 1:2,
           select = list(contrib = 5))[,-1]</code></pre>
<pre><code>                  Dim.1      Dim.2     coord      cos2  contrib
X100m      -0.850625692  0.1793981 0.7557477 0.7557477 75.57477
Long.jump   0.794180641 -0.2808570 0.7096035 0.7096035 70.96035
Pole.vault -0.217268042 -0.8074511 0.6991827 0.6991827 69.91827
X1500m      0.004278487 -0.7844802 0.6154275 0.6154275 61.54275
High.jump   0.610083985  0.4652142 0.5886267 0.5886267 58.86267</code></pre>
<pre class="r"><code># Select variables with cos2 >= 0.6
facto_summarize(res.pca, "var", axes = 1:2,
           select = list(cos2 = 0.6))[,-1]</code></pre>
<pre><code>                  Dim.1      Dim.2     coord      cos2  contrib
X100m      -0.850625692  0.1793981 0.7557477 0.7557477 75.57477
Long.jump   0.794180641 -0.2808570 0.7096035 0.7096035 70.96035
Pole.vault -0.217268042 -0.8074511 0.6991827 0.6991827 69.91827
X1500m      0.004278487 -0.7844802 0.6154275 0.6154275 61.54275</code></pre>
<pre class="r"><code># Select by names
facto_summarize(res.pca, "var", axes = 1:2,
     select = list(name = c("X100m", "Discus", "Javeline")))[,-1]</code></pre>
<pre><code>              Dim.1       Dim.2     coord      cos2  contrib
X100m    -0.8506257  0.17939806 0.7557477 0.7557477 75.57477
Discus    0.7432090 -0.04966086 0.5548258 0.5548258 55.48258
Javeline  0.4282266 -0.38610928 0.3324584 0.3324584 33.24584</code></pre>
<pre class="r"><code># Summarize individuals on axes 1:2
facto_summarize(res.pca, "ind", axes = 1:2)[,-1]</code></pre>
<pre><code>                 Dim.1      Dim.2      coord      cos2   contrib
SEBRLE       0.1912074 -1.5541282  2.4518746 0.5050034 10.660324
CLAY         0.7901217 -2.4204156  6.4827039 0.5057178 28.185669
BERNARD     -1.3292592 -1.6118687  4.3650507 0.4871654 18.978481
YURKOV      -0.8694134  0.4328779  0.9432630 0.1199355  4.101143
ZSIVOCZKY   -0.1057450  2.0233632  4.1051806 0.5779938 17.848611
McMULLEN     0.1185550  0.9916237  0.9973729 0.1543704  4.336404
MARTINEAU   -2.3923532  1.2849234  7.3743818 0.5205607 32.062530
HERNU       -1.8910497 -1.1784614  4.9648401 0.5543447 21.586261
BARRAS      -1.7744575  0.4125321  3.3188820 0.6495490 14.429922
NOOL        -2.7770058  1.5726757 10.1850700 0.6469840 44.282913
BOURGUIGNON -4.4137335 -1.2635770 21.0776704 0.9301572 91.642045
Sebrle       3.4514485 -1.2169193 13.3933893 0.7593400 58.232127
Clay         3.3162243 -1.6232908 13.6324164 0.8523470 59.271375
Karpov       4.0703560  0.7983510 17.2051623 0.8138146 74.805053
Macey        1.8484623  2.0638828  7.6764252 0.8165181 33.375762
Warners      1.3873514 -0.2819083  2.0042163 0.2662078  8.713984
Zsivoczky    0.4715533  0.9267436  1.0812163 0.2190667  4.700940
Hernu        0.2763118  1.1657260  1.4352654 0.4666709  6.240284
Bernard      1.3672590  1.4780354  4.0539857 0.6274807 17.626025
Schwarzl    -0.7102777 -0.6584251  0.9380181 0.2170229  4.078340
Pogorelov   -0.2143524 -0.8610557  0.7873639 0.1337231  3.423321
Schoenbeck  -0.4953166 -1.3000530  1.9354762 0.5291161  8.415114
Barras      -0.3158867  0.8193681  0.7711485 0.1466237  3.352820</code></pre>
</div>
<div id="correspondence-analysis" class="section level2">
<h2>Correspondence Analysis</h2>
<p>The function <strong>CA()</strong> in <strong>FactoMineR</strong> package is used:</p>
<pre class="r"><code># Install and load FactoMineR to compute CA
# install.packages("FactoMineR")
library("FactoMineR")
data("housetasks")
res.ca <- CA(housetasks, graph = FALSE)
# Summarize row variables on axes 1:2
facto_summarize(res.ca, "row", axes = 1:2)[,-1]</code></pre>
<pre><code>                Dim.1      Dim.2     coord      cos2   contrib
Laundry    -0.9918368  0.4953220 1.2290841 0.9245395 12.403601
Main_meal  -0.8755855  0.4901092 1.0068569 0.9739621  8.833091
Dinner     -0.6925740  0.3081043 0.5745869 0.9303433  3.558222
Breakfeast -0.5086002  0.4528038 0.4637054 0.9051733  3.722406
Tidying    -0.3938084 -0.4343444 0.3437401 0.9748275  2.404604
Dishes     -0.1889641 -0.4419662 0.2310416 0.7642703  1.497001
Shopping   -0.1176813 -0.4033171 0.1765136 0.8113088  1.214543
Official    0.2266324  0.2536132 0.1156819 0.1194711  0.636781
Driving     0.7417696  0.6534143 0.9771724 0.7672477  7.788243
Finances    0.2707669 -0.6178684 0.4550760 0.9973464  2.948600
Insurance   0.6470759 -0.4737832 0.6431778 0.8848140  5.126245
Repairs     1.5287787  0.8642647 3.0841176 0.9326072 29.178865
Holidays    0.2524863 -1.4350066 2.1229933 0.9921522 19.477003</code></pre>
<pre class="r"><code># Summarize column variables on axes 1:2
facto_summarize(res.ca, "col", axes = 1:2)[,-1]</code></pre>
<pre><code>                  Dim.1      Dim.2      coord      cos2  contrib
Wife        -0.83762154  0.3652207 0.83499601 0.9543242 28.72693
Alternating -0.06218462  0.2915938 0.08889388 0.1098815  1.29467
Husband      1.16091847  0.6019199 1.71003929 0.9795683 37.35808
Jointly      0.14942609 -1.0265791 1.07619274 0.9979998 31.40952</code></pre>
</div>
<div id="multiple-correspondence-analysis" class="section level2">
<h2>Multiple Correspondence Analysis</h2>
<p>The function <strong>MCA()</strong> in <strong>FactoMineR</strong> package is used:</p>
<pre class="r"><code>library(FactoMineR)
data(poison)
res.mca <- MCA(poison, quanti.sup = 1:2,
              quali.sup = 3:4, graph=FALSE)
# Summarize variables on axes 1:2
res <- facto_summarize(res.mca, "var", axes = 1:2)
head(res)</code></pre>
<pre><code>             name      Dim.1       Dim.2      coord      cos2   contrib
Nausea_n Nausea_n  0.2673909  0.12139029 0.08623348 0.3090033 0.6128991
Nausea_y Nausea_y -0.9581506 -0.43498187 1.10726185 0.3090033 2.1962218
Vomit_n   Vomit_n  0.4790279 -0.40919465 0.39690803 0.5953620 2.1649529
Vomit_y   Vomit_y -0.7185419  0.61379197 0.89304306 0.5953620 3.2474293
Abdo_n     Abdo_n  1.3180221 -0.03574501 1.73845988 0.8457372 5.1722773
Abdo_y     Abdo_y -0.6411999  0.01738946 0.41143974 0.8457372 2.5162430</code></pre>
<pre class="r"><code># Summarize individuals on axes 1:2
res <- facto_summarize(res.mca, "ind", axes = 1:2)
head(res)</code></pre>
<pre><code>  name      Dim.1       Dim.2     coord       cos2   contrib
1    1 -0.4525811 -0.26415072 0.2746052 0.46457063 0.4992822
2    2  0.8361700 -0.03193457 0.7002000 0.55670644 1.2730909
3    3 -0.4481892  0.13538726 0.2192032 0.59815656 0.3985513
4    4  0.8803694 -0.08536230 0.7823370 0.75476958 1.4224310
5    5 -0.4481892  0.13538726 0.2192032 0.59815656 0.3985513
6    6 -0.3594324 -0.43604390 0.3193260 0.06143111 0.5805927</code></pre>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.1.2) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Wed, 11 Nov 2015 13:02:54 +0100</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[factoextra: Reduce overplotting of points and labels - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/factoextra-reduce-overplotting-of-points-and-labels-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/factoextra-reduce-overplotting-of-points-and-labels-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->


  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#install-required-packages">Install required packages</a></li>
<li><a href="#load-factominer-and-factoextra">Load FactoMineR and factoextra</a></li>
<li><a href="#multiple-correspondence-analysis-mca">Multiple Correspondence Analysis (MCA)</a></li>
<li><a href="#simple-correspondence-analysis-ca">Simple Correspondence Analysis (CA)</a></li>
<li><a href="#principal-componet-analysis-pca">Principal Componet Analysis (PCA)</a></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<p>To reduce overplotting, the argument <strong>jitter</strong> is used in the functions <a href="https://www.sthda.com/english/english/wiki/fviz-pca-quick-principal-component-analysis-data-visualization-r-software-and-data-mining"><strong>fviz_pca_xx()</strong></a>, <a href="https://www.sthda.com/english/english/wiki/fviz-ca-quick-correspondence-analysis-data-visualization-using-factoextra-r-software-and-data-mining"><strong>fviz_ca_xx()</strong></a> and <a href="https://www.sthda.com/english/english/wiki/fviz-mca-quick-multiple-correspondence-analysis-data-visualization-r-software-and-data-mining"><strong>fviz_mca_xx()</strong></a> available in the R package <a href="https://www.sthda.com/english/english/wiki/factoextra-r-package-quick-multivariate-data-analysis-pca-ca-mca-and-visualization-r-software-and-data-mining"><strong>factoextra</strong></a>.</p>
<p>The argument <strong>jitter</strong> is a list containing the parameters <em>what</em>, <em>width</em> and <em>height</em> (i.e jitter = list(what, width, height)):</p>
<ul>
<li><strong>what</strong>: the element to be jittered. Possible values are “point” or “p”; “label” or “l”; “both” or “b”.</li>
<li><strong>width</strong>: degree of jitter in x direction</li>
<li><strong>height</strong>: degree of jitter in y direction</li>
</ul>
<p>Some examples of usage are described in the next sections.</p>
<div id="install-required-packages" class="section level1">
<h1>Install required packages</h1>
<ul>
<li><strong>FactoMineR</strong>: for computing PCA (Principal Component Analysis), CA (Correspondence Analysis) and MCA (Multiple Correspondence Analysis)</li>
<li><strong>factoextra</strong>: for the visualization of FactoMineR results</li>
</ul>
<p>FactoMineR and factoextra R packages can be installed as follow :</p>
<pre class="r"><code>install.packages("FactoMineR")

# install.packages("devtools")
devtools::install_github("kassambara/factoextra")</code></pre>
<p><span class="notice">Note that, for factoextra a version >= 1.0.3 is required for using the argument <strong>jitter</strong>. If it’s already installed on your computer, you should re-install it to have the most updated version.</span></p>
</div>
<div id="load-factominer-and-factoextra" class="section level1">
<h1>Load FactoMineR and factoextra</h1>
<pre class="r"><code>library("FactoMineR")
library("factoextra")</code></pre>
</div>
<div id="multiple-correspondence-analysis-mca" class="section level1">
<h1>Multiple Correspondence Analysis (MCA)</h1>
<pre class="r"><code># Load data
data(poison)
poison.active <- poison[1:55, 5:15]
# Compute MCA
res.mca <- MCA(poison.active, graph = FALSE)
# Default plot
fviz_mca_ind(res.mca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-multiple-correspondence-analysis-1.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use jitter to reduce overplotting.
# Only labels are jittered
fviz_mca_ind(res.mca, jitter = list(what = "label",
                                    width = 0.1, height = 0.15))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-multiple-correspondence-analysis-2.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Jitter both points and labels
fviz_mca_ind(res.mca, jitter = list(what = "both", 
                                    width = 0.1, height = 0.15))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-multiple-correspondence-analysis-3.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="simple-correspondence-analysis-ca" class="section level1">
<h1>Simple Correspondence Analysis (CA)</h1>
<pre class="r"><code># Load data
data("housetasks")
# Compute CA
res.ca <- CA(housetasks, graph = FALSE)
# Default biplot
fviz_ca_biplot(res.ca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-correspondence-analysis-1.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Jitter in y direction
fviz_ca_biplot(res.ca, jitter = list(what = "label", 
                                     width = 0.4, height = 0.3))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-correspondence-analysis-2.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="principal-componet-analysis-pca" class="section level1">
<h1>Principal Componet Analysis (PCA)</h1>
<pre class="r"><code># Load data
data(decathlon2)
decathlon2.active <- decathlon2[1:23, 1:10]
# Compute PCA
res.pca <- PCA(decathlon2.active, graph = FALSE)
# Default biplot
fviz_pca_ind(res.pca)</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-principal-component-analysis-1.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
<pre class="r"><code># Use jitter in x and y direction
fviz_pca_ind(res.pca, jitter = list(what = "label", 
                                    width = 0.6, height = 0.6))</code></pre>
<p><img src="https://www.sthda.com/english/sthda/RDoc/figure/factoextra/reduce-overplotting-principal-component-analysis-2.png" title="Reduce overplotting - R software and data mining" alt="Reduce overplotting - R software and data mining" width="432" style="margin-bottom:10px;" /></p>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.2.1), <strong>FactoMineR</strong> (ver. 1.30) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Wed, 08 Jul 2015 22:05:08 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[Explore the outputs of a principal component analysis - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/explore-the-outputs-of-a-principal-component-analysis-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/explore-the-outputs-of-a-principal-component-analysis-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#principal-component-analysis">Principal component analysis</a></li>
<li><a href="#extract-the-eigenvaluesvariances">Extract the eigenvalues/variances</a></li>
<li><a href="#extract-the-results-for-variables">Extract the results for variables</a></li>
<li><a href="#extract-the-results-for-individuals">Extract the results for individuals</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>The functions <strong>get_eig()</strong>, <strong>get_pca_ind()</strong> and <strong>get_pca_var()</strong> can be used to explore the outputs of several PCA functions : the function PCA() from FactoMineR package; prcomp() and princomp() from stats package; dudi.pca() from ade4 package.</p>
<p>These 3 functions are included in the R package <strong>factoextra</strong>.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code>get_eig(X)

get_pca_var(res.pca)

get_pca_ind(res.pca)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<ul>
<li><strong>X, res.pca</strong> : an object of class PCA (FactoMineR); prcomp and princomp (stats); dudi and pca (ade4).</li>
</ul>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="principal-component-analysis" class="section level2">
<h2>Principal component analysis</h2>
<p>A principal component analysis (PCA) is performed using the built-in R function <strong>prcomp()</strong> and <em>iris</em> data :</p>
<pre class="r"><code>data(iris)
head(iris)</code></pre>
<pre><code>  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa</code></pre>
<pre class="r"><code># The variable Species (index = 5) is removed
# before PCA analysis
res.pca <- prcomp(iris[, -5],  scale = TRUE)</code></pre>
</div>
<div id="extract-the-eigenvaluesvariances" class="section level2">
<h2>Extract the eigenvalues/variances</h2>
<pre class="r"><code>eig <- get_eig(res.pca)
eig</code></pre>
<pre><code>      eigenvalue variance.percent cumulative.variance.percent
Dim.1 2.91849782       72.9624454                    72.96245
Dim.2 0.91403047       22.8507618                    95.81321
Dim.3 0.14675688        3.6689219                    99.48213
Dim.4 0.02071484        0.5178709                   100.00000</code></pre>
</div>
<div id="extract-the-results-for-variables" class="section level2">
<h2>Extract the results for variables</h2>
<p><span class="success"> The function <strong>get_pca_var()</strong> provides a list of matrices containing all the results for the active variables (coordinates, correlation between variables and axes, square cosine and contributions)</span></p>
<pre class="r"><code>var <- get_pca_var(res.pca)
names(var)</code></pre>
<pre><code>[1] "coord"   "cor"     "cos2"    "contrib"</code></pre>
<pre class="r"><code># Coordinates of variables
head(var$coord)</code></pre>
<pre><code>                  Dim.1       Dim.2       Dim.3       Dim.4
Sepal.Length  0.8901688 -0.36082989  0.27565767  0.03760602
Sepal.Width  -0.4601427 -0.88271627 -0.09361987 -0.01777631
Petal.Length  0.9915552 -0.02341519 -0.05444699 -0.11534978
Petal.Width   0.9649790 -0.06399985 -0.24298265  0.07535950</code></pre>
<pre class="r"><code># Cos2 of variables
head(var$cos2)</code></pre>
<pre><code>                 Dim.1       Dim.2       Dim.3        Dim.4
Sepal.Length 0.7924004 0.130198208 0.075987149 0.0014142127
Sepal.Width  0.2117313 0.779188012 0.008764681 0.0003159971
Petal.Length 0.9831817 0.000548271 0.002964475 0.0133055723
Petal.Width  0.9311844 0.004095980 0.059040571 0.0056790544</code></pre>
<pre class="r"><code># Contribution of variables
head(var$contrib)</code></pre>
<pre><code>                 Dim.1       Dim.2     Dim.3     Dim.4
Sepal.Length 27.150969 14.24440565 51.777574  6.827052
Sepal.Width   7.254804 85.24748749  5.972245  1.525463
Petal.Length 33.687936  0.05998389  2.019990 64.232089
Petal.Width  31.906291  0.44812296 40.230191 27.415396</code></pre>
</div>
<div id="extract-the-results-for-individuals" class="section level2">
<h2>Extract the results for individuals</h2>
<p><span class="success"> The function <strong>get_pca_ind()</strong> provides a list of matrices containing all the results for the active individuals (coordinates, correlation between variables and axes, square cosine and contributions)</span></p>
<pre class="r"><code>ind <- get_pca_ind(res.pca)
names(ind)</code></pre>
<pre><code>[1] "coord"   "cos2"    "contrib"</code></pre>
<pre class="r"><code># Coordinates of individuals
head(ind$coord)</code></pre>
<pre><code>      Dim.1      Dim.2       Dim.3        Dim.4
1 -2.257141 -0.4784238  0.12727962  0.024087508
2 -2.074013  0.6718827  0.23382552  0.102662845
3 -2.356335  0.3407664 -0.04405390  0.028282305
4 -2.291707  0.5953999 -0.09098530 -0.065735340
5 -2.381863 -0.6446757 -0.01568565 -0.035802870
6 -2.068701 -1.4842053 -0.02687825  0.006586116</code></pre>
<pre class="r"><code># Cos2 of individuals
head(ind$cos2)</code></pre>
<pre><code>      Dim.1      Dim.2        Dim.3        Dim.4
1 0.9539975 0.04286032 0.0030335249 1.086460e-04
2 0.8927725 0.09369248 0.0113475382 2.187482e-03
3 0.9790410 0.02047578 0.0003422122 1.410446e-04
4 0.9346682 0.06308947 0.0014732682 7.690193e-04
5 0.9315095 0.06823959 0.0000403979 2.104697e-04
6 0.6600989 0.33978301 0.0001114335 6.690714e-06</code></pre>
<pre class="r"><code># Contribution of individuals
head(ind$contrib)</code></pre>
<pre><code>      Dim.1      Dim.2       Dim.3       Dim.4
1 1.1637691 0.16694510 0.073591567 0.018672867
2 0.9825900 0.32925696 0.248367113 0.339198420
3 1.2683043 0.08469576 0.008816151 0.025742863
4 1.1996857 0.25856249 0.037605617 0.139067312
5 1.2959338 0.30313118 0.001117674 0.041253702
6 0.9775628 1.60670454 0.003281801 0.001396002</code></pre>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.1.2) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Mon, 25 May 2015 08:42:28 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[get_pca: Extract the results for individuals/variables in Principal Component Analysis - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/get-pca-extract-the-results-for-individuals-variables-in-principal-component-analysis-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/get-pca-extract-the-results-for-individuals-variables-in-principal-component-analysis-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->

  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#principal-component-analysis">Principal component analysis</a></li>
<li><a href="#extract-the-results-for-variables">Extract the results for variables</a></li>
<li><a href="#extract-the-results-for-individuals">Extract the results for individuals</a></li>
<li><a href="#get_pca">get_pca</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Extract all the results (coordinates, squared cosine, contributions) for the active individuals/variables from <strong>Principal Component Analysis</strong> (PCA) outputs.</p>
<ul>
<li><strong>get_pca()</strong>: Extract the results for variables and individuals</li>
<li><strong>get_pca_ind()</strong>: Extract the results for individuals only</li>
<li><strong>get_pca_var()</strong>: Extract the results for variables only</li>
</ul>
<p>These functions are included in <strong>factoextra</strong> package.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Extract the results for variables and individuals
get_pca(res.pca, element = c("var", "ind"))

# Extract the results for individuals only
get_pca_ind(res.pca, ...)

# Extract the results for variables only
get_pca_var(res.pca)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
  <thead>
    <tr><th>
Argument
</th><th>
Description
</th></tr>
  </thead>
  
<tbody>
  <tr>
    <td>
<strong>res.pca</strong>
</td>
    <td>
an object of class PCA [FactoMineR]; prcomp and princomp [stats]; pca, dudi [adea4].
</td>
  </tr>
  
<tr>
    <td>
<strong>element</strong>
</td>
    <td>
the element to subset from the output. Allowed values are “var” (for active variables) or “ind” (for active individuals).
</td>
  </tr>
  
<tr>
    <td>
<strong>…</strong>
</td>
    <td>
not used
</td>
  </tr>
</tbody> 
</table>
   

</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A list of matrices containing all the results for the active individuals/variables including:</p>
<ul>
<li><strong>coord</strong>: coordinates for the individuals/variables</li>
<li><strong>cos2</strong>: cos2 for the individuals/variables</li>
<li><strong>contrib</strong>: contributions of the individuals/variables</li>
</ul>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="principal-component-analysis" class="section level2">
<h2>Principal component analysis</h2>
<p>A principal component analysis (PCA) is performed using the built-in R function <strong>prcomp()</strong> and <em>iris</em> data:</p>
<pre class="r"><code>data(iris)
head(iris)</code></pre>
<pre><code>  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
2          4.9         3.0          1.4         0.2  setosa
3          4.7         3.2          1.3         0.2  setosa
4          4.6         3.1          1.5         0.2  setosa
5          5.0         3.6          1.4         0.2  setosa
6          5.4         3.9          1.7         0.4  setosa</code></pre>
<pre class="r"><code># The variable Species (index = 5) is removed
# before PCA analysis
res.pca <- prcomp(iris[, -5],  scale = TRUE)</code></pre>
</div>
<div id="extract-the-results-for-variables" class="section level2">
<h2>Extract the results for variables</h2>
<pre class="r"><code>var <- get_pca_var(res.pca)
var</code></pre>
<pre><code>Principal Component Analysis Results for variables
 ===================================================
  Name       Description                                    
1 "$coord"   "Coordinates for the variables"                
2 "$cor"     "Correlations between variables and dimensions"
3 "$cos2"    "Cos2 for the variables"                       
4 "$contrib" "contributions of the variables"               </code></pre>
<pre class="r"><code># Coordinates of variables
head(var$coord)</code></pre>
<pre><code>                  Dim.1       Dim.2       Dim.3       Dim.4
Sepal.Length  0.8901688 -0.36082989  0.27565767  0.03760602
Sepal.Width  -0.4601427 -0.88271627 -0.09361987 -0.01777631
Petal.Length  0.9915552 -0.02341519 -0.05444699 -0.11534978
Petal.Width   0.9649790 -0.06399985 -0.24298265  0.07535950</code></pre>
<pre class="r"><code># Cos2 of variables
head(var$cos2)</code></pre>
<pre><code>                 Dim.1       Dim.2       Dim.3        Dim.4
Sepal.Length 0.7924004 0.130198208 0.075987149 0.0014142127
Sepal.Width  0.2117313 0.779188012 0.008764681 0.0003159971
Petal.Length 0.9831817 0.000548271 0.002964475 0.0133055723
Petal.Width  0.9311844 0.004095980 0.059040571 0.0056790544</code></pre>
<pre class="r"><code># Contribution of variables
head(var$contrib)</code></pre>
<pre><code>                 Dim.1       Dim.2     Dim.3     Dim.4
Sepal.Length 27.150969 14.24440565 51.777574  6.827052
Sepal.Width   7.254804 85.24748749  5.972245  1.525463
Petal.Length 33.687936  0.05998389  2.019990 64.232089
Petal.Width  31.906291  0.44812296 40.230191 27.415396</code></pre>
</div>
<div id="extract-the-results-for-individuals" class="section level2">
<h2>Extract the results for individuals</h2>
<pre class="r"><code>ind <- get_pca_ind(res.pca)
ind</code></pre>
<pre><code>Principal Component Analysis Results for individuals
 ===================================================
  Name       Description                       
1 "$coord"   "Coordinates for the individuals" 
2 "$cos2"    "Cos2 for the individuals"        
3 "$contrib" "contributions of the individuals"</code></pre>
<pre class="r"><code># Coordinates of individuals
head(ind$coord)</code></pre>
<pre><code>      Dim.1      Dim.2       Dim.3        Dim.4
1 -2.257141 -0.4784238  0.12727962  0.024087508
2 -2.074013  0.6718827  0.23382552  0.102662845
3 -2.356335  0.3407664 -0.04405390  0.028282305
4 -2.291707  0.5953999 -0.09098530 -0.065735340
5 -2.381863 -0.6446757 -0.01568565 -0.035802870
6 -2.068701 -1.4842053 -0.02687825  0.006586116</code></pre>
<pre class="r"><code># Cos2 of individuals
head(ind$cos2)</code></pre>
<pre><code>      Dim.1      Dim.2        Dim.3        Dim.4
1 0.9539975 0.04286032 0.0030335249 1.086460e-04
2 0.8927725 0.09369248 0.0113475382 2.187482e-03
3 0.9790410 0.02047578 0.0003422122 1.410446e-04
4 0.9346682 0.06308947 0.0014732682 7.690193e-04
5 0.9315095 0.06823959 0.0000403979 2.104697e-04
6 0.6600989 0.33978301 0.0001114335 6.690714e-06</code></pre>
<pre class="r"><code># Contribution of individuals
head(ind$contrib)</code></pre>
<pre><code>      Dim.1      Dim.2       Dim.3       Dim.4
1 1.1637691 0.16694510 0.073591567 0.018672867
2 0.9825900 0.32925696 0.248367113 0.339198420
3 1.2683043 0.08469576 0.008816151 0.025742863
4 1.1996857 0.25856249 0.037605617 0.139067312
5 1.2959338 0.30313118 0.001117674 0.041253702
6 0.9775628 1.60670454 0.003281801 0.001396002</code></pre>
</div>
<div id="get_pca" class="section level2">
<h2>get_pca</h2>
<pre class="r"><code># You can also use the function get_pca()
get_pca(res.pca, "ind") # Results for individuals</code></pre>
<pre><code>Principal Component Analysis Results for individuals
 ===================================================
  Name       Description                       
1 "$coord"   "Coordinates for the individuals" 
2 "$cos2"    "Cos2 for the individuals"        
3 "$contrib" "contributions of the individuals"</code></pre>
<pre class="r"><code>get_pca(res.pca, "var") # Results for variable categories</code></pre>
<pre><code>Principal Component Analysis Results for variables
 ===================================================
  Name       Description                                    
1 "$coord"   "Coordinates for the variables"                
2 "$cor"     "Correlations between variables and dimensions"
3 "$cos2"    "Cos2 for the variables"                       
4 "$contrib" "contributions of the variables"               </code></pre>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.1.2) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->


<!-- END HTML -->]]></description>
			<pubDate>Sat, 23 May 2015 10:08:22 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[get_mca: Extract the results for individuals/variables in Multiple Correspondence Analysis]]></title>
			<link>https://www.sthda.com/english/wiki/get-mca-extract-the-results-for-individuals-variables-in-multiple-correspondence-analysis</link>
			<guid>https://www.sthda.com/english/wiki/get-mca-extract-the-results-for-individuals-variables-in-multiple-correspondence-analysis</guid>
			<description><![CDATA[<!-- START HTML -->
       
  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#multiple-correspondence-analysis">Multiple Correspondence Analysis</a></li>
<li><a href="#extract-the-results-for-variables">Extract the results for variables</a></li>
<li><a href="#extract-the-results-for-individuals">Extract the results for individuals</a></li>
<li><a href="#get_mca-extract-the-results-for-both-individuals-and-variables">get_mca: Extract the results for both individuals and variables</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Extract all the results (coordinates, squared cosine and contributions) for the active individuals/variable categories from <strong>Multiple Correspondence Analysis</strong> (MCA) outputs.</p>
<ul>
<li><strong>get_mca()</strong>: Extract the results for variables and individuals</li>
<li><strong>get_mca_ind()</strong>: Extract the results for individuals only</li>
<li><strong>get_mca_var()</strong>: Extract the results for variables only</li>
</ul>
<p>These functions are included in <strong>factoextra</strong> package.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Extract the results for variables and individuals
get_mca(res.mca, element = c("var", "ind"))

# Extract the results for individuals only
get_mca_var(res.mca)

# Extract the results for variables only
get_mca_ind(res.mca)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
  <thead>
    <tr><th>
Argument
</th><th>
Description
</th></tr>
  </thead>
  
<tbody>
  <tr>
    <td>
<strong>res.mca</strong>
</td>
    <td>
an object of class MCA [FactoMineR], acm [ade4].
</td>
  </tr>
  
<tr>
    <td>
<strong>element</strong>
</td>
    <td>
the element to subset from the output. Allowed values are “var” (for active variables) or “ind” (for active individuals).
</td>
  </tr>
  </tr>
</tbody> 
</table>
   

</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A list of matrices containing all the results for the active individuals/variables including:</p>
<ul>
<li><strong>coord</strong>: coordinates for the individuals/variables</li>
<li><strong>cos2</strong>: cos2 for the individuals/variables</li>
<li><strong>contrib</strong>: contributions of the individuals/variables</li>
</ul>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="multiple-correspondence-analysis" class="section level2">
<h2>Multiple Correspondence Analysis</h2>
<p>A <strong>Multiple Correspondence Analysis</strong> (MCA) is performed using the function <strong>MCA()</strong> [in <em>FactoMineR</em>] and <em>poison</em> data [in <em>FactoMineR</em>]:</p>
<pre class="r"><code># Multiple Correspondence Analysis
# ++++++++++++++++++++++++++++++
# Install and load FactoMineR to compute MCA
# install.packages("FactoMineR")
library("FactoMineR")
data(poison)
poison.active <- poison[1:55, 5:15]
head(poison.active[, 1:6])</code></pre>
<pre><code>    Nausea Vomiting Abdominals   Fever   Diarrhae   Potato
1 Nausea_y  Vomit_n     Abdo_y Fever_y Diarrhea_y Potato_y
2 Nausea_n  Vomit_n     Abdo_n Fever_n Diarrhea_n Potato_y
3 Nausea_n  Vomit_y     Abdo_y Fever_y Diarrhea_y Potato_y
4 Nausea_n  Vomit_n     Abdo_n Fever_n Diarrhea_n Potato_y
5 Nausea_n  Vomit_y     Abdo_y Fever_y Diarrhea_y Potato_y
6 Nausea_n  Vomit_n     Abdo_y Fever_y Diarrhea_y Potato_y</code></pre>
<pre class="r"><code>res.mca <- MCA(poison.active, graph=FALSE)</code></pre>
</div>
<div id="extract-the-results-for-variables" class="section level2">
<h2>Extract the results for variables</h2>
<pre class="r"><code># Extract the results for variable categories
var <- get_mca_var(res.mca)
print(var)</code></pre>
<pre><code>Multiple Correspondence Analysis Results for variables
 ===================================================
  Name       Description                  
1 "$coord"   "Coordinates for categories" 
2 "$cos2"    "Cos2 for categories"        
3 "$contrib" "contributions of categories"</code></pre>
<pre class="r"><code>head(var$coord) # coordinates of variables</code></pre>
<pre><code>              Dim 1       Dim 2        Dim 3       Dim 4       Dim 5
Nausea_n  0.2673909  0.12139029 -0.265583253  0.03376130  0.07370500
Nausea_y -0.9581506 -0.43498187  0.951673323 -0.12097801 -0.26410958
Vomit_n   0.4790279 -0.40919465  0.084492799  0.27361142  0.05245250
Vomit_y  -0.7185419  0.61379197 -0.126739198 -0.41041713 -0.07867876
Abdo_n    1.3180221 -0.03574501 -0.005094243 -0.15360951 -0.06986987
Abdo_y   -0.6411999  0.01738946  0.002478280  0.07472895  0.03399075</code></pre>
<pre class="r"><code>head(var$cos2) # cos2 of variables</code></pre>
<pre><code>             Dim 1        Dim 2        Dim 3       Dim 4       Dim 5
Nausea_n 0.2562007 0.0528025759 2.527485e-01 0.004084375 0.019466197
Nausea_y 0.2562007 0.0528025759 2.527485e-01 0.004084375 0.019466197
Vomit_n  0.3442016 0.2511603912 1.070855e-02 0.112294813 0.004126898
Vomit_y  0.3442016 0.2511603912 1.070855e-02 0.112294813 0.004126898
Abdo_n   0.8451157 0.0006215864 1.262496e-05 0.011479077 0.002374929
Abdo_y   0.8451157 0.0006215864 1.262496e-05 0.011479077 0.002374929</code></pre>
<pre class="r"><code>head(var$contrib) # contributions of variables</code></pre>
<pre><code>             Dim 1       Dim 2        Dim 3      Dim 4      Dim 5
Nausea_n  1.515869  0.81100008 4.670018e+00 0.08449397 0.48977906
Nausea_y  5.431862  2.90608363 1.673423e+01 0.30277007 1.75504164
Vomit_n   3.733667  7.07226253 3.627455e-01 4.25893721 0.19036376
Vomit_y   5.600500 10.60839380 5.441183e-01 6.38840581 0.28554563
Abdo_n   15.417637  0.02943661 7.192511e-04 0.73219636 0.18424268
Abdo_y    7.500472  0.01432051 3.499060e-04 0.35620363 0.08963157</code></pre>
</div>
<div id="extract-the-results-for-individuals" class="section level2">
<h2>Extract the results for individuals</h2>
<pre class="r"><code># Extract the results for individuals
ind <- get_mca_ind(res.mca)
print(ind)</code></pre>
<pre><code>Multiple Correspondence Analysis Results for individuals
 ===================================================
  Name       Description                       
1 "$coord"   "Coordinates for the individuals" 
2 "$cos2"    "Cos2 for the individuals"        
3 "$contrib" "contributions of the individuals"</code></pre>
<pre class="r"><code>head(ind$coord) # coordinates of individuals</code></pre>
<pre><code>       Dim 1       Dim 2       Dim 3       Dim 4       Dim 5
1 -0.4525811 -0.26415072  0.17151614  0.01369348 -0.11696806
2  0.8361700 -0.03193457 -0.07208249 -0.08550351  0.51978710
3 -0.4481892  0.13538726 -0.22484048 -0.14170168 -0.05004753
4  0.8803694 -0.08536230 -0.02052044 -0.07275873 -0.22935022
5 -0.4481892  0.13538726 -0.22484048 -0.14170168 -0.05004753
6 -0.3594324 -0.43604390 -1.20932223  1.72464616  0.04348157</code></pre>
<pre class="r"><code>head(ind$cos2) # cos2 of individuals</code></pre>
<pre><code>       Dim 1        Dim 2        Dim 3        Dim 4        Dim 5
1 0.34652591 0.1180447167 0.0497683175 0.0003172275 0.0231460846
2 0.55589562 0.0008108236 0.0041310808 0.0058126211 0.2148103098
3 0.54813888 0.0500176790 0.1379484860 0.0547920948 0.0068349171
4 0.74773962 0.0070299584 0.0004062504 0.0051072923 0.0507479873
5 0.54813888 0.0500176790 0.1379484860 0.0547920948 0.0068349171
6 0.02485357 0.0365775483 0.2813443706 0.5722083217 0.0003637178</code></pre>
<pre class="r"><code>head(ind$contrib) # contributions of individuals</code></pre>
<pre><code>     Dim 1      Dim 2        Dim 3        Dim 4      Dim 5
1 1.110927 0.98238297  0.498254685  0.003555817 0.31554778
2 3.792117 0.01435818  0.088003703  0.138637089 6.23134138
3 1.089470 0.25806722  0.856229950  0.380768961 0.05776914
4 4.203611 0.10259105  0.007132055  0.100387990 1.21319013
5 1.089470 0.25806722  0.856229950  0.380768961 0.05776914
6 0.700692 2.67693398 24.769968729 56.404214518 0.04360547</code></pre>
</div>
<div id="get_mca-extract-the-results-for-both-individuals-and-variables" class="section level2">
<h2>get_mca: Extract the results for both individuals and variables</h2>
<pre class="r"><code># You can also use the function get_mca()
get_mca(res.mca, "ind") # Results for individuals</code></pre>
<pre><code>Multiple Correspondence Analysis Results for individuals
 ===================================================
  Name       Description                       
1 "$coord"   "Coordinates for the individuals" 
2 "$cos2"    "Cos2 for the individuals"        
3 "$contrib" "contributions of the individuals"</code></pre>
<pre class="r"><code>get_mca(res.mca, "var") # Results for variable categories</code></pre>
<pre><code>Multiple Correspondence Analysis Results for variables
 ===================================================
  Name       Description                  
1 "$coord"   "Coordinates for categories" 
2 "$cos2"    "Cos2 for categories"        
3 "$contrib" "contributions of categories"</code></pre>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.1.2) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->



<!-- END HTML -->]]></description>
			<pubDate>Sat, 23 May 2015 10:03:52 +0200</pubDate>
			
		</item>
		
		<item>
			<title><![CDATA[get_ca: Extract the results for rows/columns in Correspondence Analysis - R software and data mining]]></title>
			<link>https://www.sthda.com/english/wiki/get-ca-extract-the-results-for-rows-columns-in-correspondence-analysis-r-software-and-data-mining</link>
			<guid>https://www.sthda.com/english/wiki/get-ca-extract-the-results-for-rows-columns-in-correspondence-analysis-r-software-and-data-mining</guid>
			<description><![CDATA[<!-- START HTML -->
 
  <!--====================== start from here when you copy to sthda================-->  
  <div id="rdoc">

<div id="TOC">
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#install-and-load-factoextra">Install and load factoextra</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#examples">Examples</a><ul>
<li><a href="#correspondence-analysis">Correspondence Analysis</a></li>
<li><a href="#extract-the-results-for-column-variables">Extract the results for column variables</a></li>
<li><a href="#extract-the-results-for-row-variables">Extract the results for row variables</a></li>
<li><a href="#get_ca-extract-the-results-for-both-rows-and-columns">get_ca: extract the results for both rows and columns</a></li>
</ul></li>
<li><a href="#infos">Infos</a></li>
</ul>
</div>

<p><br/></p>
<div id="description" class="section level1">
<h1>Description</h1>
<p>Extract all the results (coordinates, squared cosine, contributions and inertia) for the active row/column variables from <strong>Correspondence Analysis</strong> (CA) outputs.</p>
<ul>
<li><strong>get_ca()</strong>: Extract the results for rows and columns</li>
<li><strong>get_ca_row()</strong>: Extract the results for rows only</li>
<li><strong>get_ca_col()</strong>: Extract the results for columns only</li>
</ul>
<p>These functions are included in <strong>factoextra</strong> package.</p>
</div>
<div id="install-and-load-factoextra" class="section level1">
<h1>Install and load factoextra</h1>
<p><span class="warning">The package <em>devtools</em> is required for the installation as <em>factoextra</em> is hosted on github.</span></p>
<pre class="r"><code># install.packages("devtools")
library("devtools")
install_github("kassambara/factoextra")</code></pre>
<p>Load factoextra :</p>
<pre class="r"><code>library("factoextra")</code></pre>
</div>
<div id="usage" class="section level1">
<h1>Usage</h1>
<pre class="r"><code># Extract the results for rows and columns
get_ca(res.ca, element = c("row", "col"))

# Extract the results for rows only
get_ca_col(res.ca)

# Extract the results for columns only
get_ca_row(res.ca)</code></pre>
</div>
<div id="arguments" class="section level1">
<h1>Arguments</h1>
<table>
  <thead>
    <tr><th>
Argument
</th><th>
Description
</th></tr>
  </thead>
  
<tbody>
  <tr>
    <td>
<strong>res.ca</strong>
</td>
    <td>
an object of class CA [FactoMineR], ca [ca], coa [ade4]; correspondence [MASS].
</td>
  </tr>
  
<tr>
    <td>
<strong>element</strong>
</td>
    <td>
the element to subset from the output. Possible values are “row” or “col”.
</td>
  </tr>
  </tr>
</tbody> 
</table>
   

</div>
<div id="value" class="section level1">
<h1>Value</h1>
<p>A list of matrices containing all the results for the active rows/columns including:</p>
<ul>
<li><strong>coord</strong>: coordinates for the rows/columns</li>
<li><strong>cos2</strong>: cos2 for the rows/columns</li>
<li><strong>contrib</strong>: contributions of the rows/columns</li>
</ul>
</div>
<div id="examples" class="section level1">
<h1>Examples</h1>
<div id="correspondence-analysis" class="section level2">
<h2>Correspondence Analysis</h2>
<p>A <strong>Correspondence Analysis</strong> (CA) is performed using the function <strong>CA()</strong> [in <em>FactoMineR</em>] and <em>housetasks</em> data [in <em>factoextra</em>]:</p>
<pre class="r"><code># Install and load FactoMineR to compute CA
# install.packages("FactoMineR")
 library("FactoMineR")
 data("housetasks")
 res.ca <- CA(housetasks, graph = FALSE)</code></pre>
</div>
<div id="extract-the-results-for-column-variables" class="section level2">
<h2>Extract the results for column variables</h2>
<pre class="r"><code># Result for column variables
col <- get_ca_col(res.ca)
col # print</code></pre>
<pre><code>Correspondence Analysis - Results for columns
 ===================================================
  Name       Description                   
1 "$coord"   "Coordinates for the columns" 
2 "$cos2"    "Cos2 for the columns"        
3 "$contrib" "contributions of the columns"
4 "$inertia" "Inertia of the columns"      </code></pre>
<pre class="r"><code>head(col$coord) # column coordinates</code></pre>
<pre><code>                  Dim 1      Dim 2       Dim 3
Wife        -0.83762154  0.3652207 -0.19991139
Alternating -0.06218462  0.2915938  0.84858939
Husband      1.16091847  0.6019199 -0.18885924
Jointly      0.14942609 -1.0265791 -0.04644302</code></pre>
<pre class="r"><code>head(col$cos2) # column cos2</code></pre>
<pre><code>                  Dim 1     Dim 2       Dim 3
Wife        0.801875947 0.1524482 0.045675847
Alternating 0.004779897 0.1051016 0.890118521
Husband     0.772026244 0.2075420 0.020431728
Jointly     0.020705858 0.9772939 0.002000236</code></pre>
<pre class="r"><code>head(col$contrib) # column contributions</code></pre>
<pre><code>                Dim 1     Dim 2      Dim 3
Wife        44.462018 10.312237 10.8220753
Alternating  0.103739  2.782794 82.5492464
Husband     54.233879 17.786612  6.1331792
Jointly      1.200364 69.118357  0.4954991</code></pre>
</div>
<div id="extract-the-results-for-row-variables" class="section level2">
<h2>Extract the results for row variables</h2>
<pre class="r"><code># Result for row variables
row <- get_ca_row(res.ca)
row # print</code></pre>
<pre><code>Correspondence Analysis - Results for rows
 ===================================================
  Name       Description                
1 "$coord"   "Coordinates for the rows" 
2 "$cos2"    "Cos2 for the rows"        
3 "$contrib" "contributions of the rows"
4 "$inertia" "Inertia of the rows"      </code></pre>
<pre class="r"><code>head(row$coord) # row coordinates</code></pre>
<pre><code>                Dim 1      Dim 2       Dim 3
Laundry    -0.9918368  0.4953220 -0.31672897
Main_meal  -0.8755855  0.4901092 -0.16406487
Dinner     -0.6925740  0.3081043 -0.20741377
Breakfeast -0.5086002  0.4528038  0.22040453
Tidying    -0.3938084 -0.4343444 -0.09421375
Dishes     -0.1889641 -0.4419662  0.26694926</code></pre>
<pre class="r"><code>head(row$cos2) # row cos2</code></pre>
<pre><code>               Dim 1     Dim 2      Dim 3
Laundry    0.7399874 0.1845521 0.07546047
Main_meal  0.7416028 0.2323593 0.02603787
Dinner     0.7766401 0.1537032 0.06965666
Breakfeast 0.5049433 0.4002300 0.09482670
Tidying    0.4398124 0.5350151 0.02517249
Dishes     0.1181178 0.6461525 0.23572969</code></pre>
<pre class="r"><code>head(row$contrib) # row contributions</code></pre>
<pre><code>                Dim 1    Dim 2    Dim 3
Laundry    18.2867003 5.563891 7.968424
Main_meal  12.3888433 4.735523 1.858689
Dinner      5.4713982 1.321022 2.096926
Breakfeast  3.8249284 3.698613 3.069399
Tidying     1.9983518 2.965644 0.488734
Dishes      0.4261663 2.844117 3.634294</code></pre>
</div>
<div id="get_ca-extract-the-results-for-both-rows-and-columns" class="section level2">
<h2>get_ca: extract the results for both rows and columns</h2>
<pre class="r"><code> # You can also use the function get_ca()
 get_ca(res.ca, "row") # Results for rows</code></pre>
<pre><code>Correspondence Analysis - Results for rows
 ===================================================
  Name       Description                
1 "$coord"   "Coordinates for the rows" 
2 "$cos2"    "Cos2 for the rows"        
3 "$contrib" "contributions of the rows"
4 "$inertia" "Inertia of the rows"      </code></pre>
<pre class="r"><code> get_ca(res.ca, "col") # Results for columns</code></pre>
<pre><code>Correspondence Analysis - Results for columns
 ===================================================
  Name       Description                   
1 "$coord"   "Coordinates for the columns" 
2 "$cos2"    "Cos2 for the columns"        
3 "$contrib" "contributions of the columns"
4 "$inertia" "Inertia of the columns"      </code></pre>
</div>
</div>
<div id="infos" class="section level1">
<h1>Infos</h1>
<p><span class="warning"> This analysis has been performed using <strong>R software</strong> (ver. 3.1.2) and <strong>factoextra</strong> (ver. 1.0.2) </span></p>
</div>

<script>jQuery(document).ready(function () {
    jQuery('h1').addClass('wiki_paragraph1');
    jQuery('h2').addClass('wiki_paragraph2');
    jQuery('h3').addClass('wiki_paragraph3');
    jQuery('h4').addClass('wiki_paragraph4');
    });//add phpboost class to header</script>
<style>.content{padding:0px;}</style>
</div><!--end rdoc-->
<!--====================== stop here when you copy to sthda================-->



<!-- END HTML -->]]></description>
			<pubDate>Sat, 23 May 2015 09:56:46 +0200</pubDate>
			
		</item>
		
	</channel>
</rss>
