<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/sensographics-and-mapping-consumer-perceptions-using-pca-and-factominer/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://methodmatters.blogspot.com/2017/09/sensographics-and-mapping-consumer.html"> Method Matters</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In the <a rel="nofollow" href="http://methodmatters.blogspot.com/2017/08/showing-some-respect-for-data-munging.html" target="_blank">last post</a>, we focused on the preparation of a tidy dataset describing consumer perceptions of beverages. In this post, I’ll describe some analyses I’ve been doing of these data, in order to better understand how consumers perceive the beverage category. This type of analysis is often used in sensographics- companies who produce food products (chocolate, sauces, etc.) conduct research to understand the “product space,” e.g. the way in which consumers understand the organization of a product category according to relevant perceptive dimensions, and the place that different products occupy within that space.</p>
<p>In order to accomplish this goal, we will use PCA (principal components analysis) to analyze the beverage dataset produced in the previous post. Principal components analysis is a technique that tries to reduce a set of variables into a smaller dimensional space. In the current case, we have variables describing a number of consumer perceptive dimensions (e.g. happy, relaxed, etc.). PCA allows us to find a smaller number of independent components that describe the variation in these variables. Within this reduced-dimensional space, we will be able to better understand the relationship among the variables (e.g. the factors that underlie or group the consumer perceptions), and the attributes of the beverages (e.g. where the beverages lie within this lower-dimensional space).</p>
<p>For an excellent introduction to PCA, I highly recommend these <a rel="nofollow" href="https://www.youtube.com/watch?v=ipyxSYXgzjQ" target="_blank">wonderfully clear</a> <a rel="nofollow" href="https://www.youtube.com/watch?v=dbuSGWCgdzw" target="_blank">videos</a> from the Hastie and Tibshirani “Introduction to Statistical Learning” online course. François Husson, a developer of the R package we’ll use to do the PCA, has a great <a rel="nofollow" href="https://www.youtube.com/playlist?list=PLnZgp6epRBbQiG5UBFU2eflRKFX8hszRf" target="_blank">open course about sensographics</a> on YouTube (in French only), and some <a rel="nofollow" href="https://www.youtube.com/watch?v=tmApJUWWnyI" target="_blank">interesting</a> <a rel="nofollow" href="https://www.youtube.com/watch?v=CTSbxU6KLbM" target="_blank">tutorials</a> about PCA in English.*</p>
<div><b>The Data</b></div>
<p>For a detailed description of the creation of this dataset, please see the <a rel="nofollow" href="http://methodmatters.blogspot.be/2017/08/showing-some-respect-for-data-munging.html" target="_blank">previous post</a> which describes the process in detail. In sum, we have a dataset with 1 row per beverage. For each beverage, we have information on the following consumer perceptions: Creative, Energetic, Joyous, Focused, Happy, Relaxed, Tired and Excited. We also have columns representing the category that each beverage falls into (there are 3 categories of beverages in these data), the drink name, the overall rating score, and the number of consumers who rated each beverage. </p>
<p>For this analysis, I have selected all of the beverages (rows) in the dataset that had more than 100 consumer ratings. This was an analytical choice, made with the goal of only analyzing beverages for which we have a fair amount of consumer evaluations. </p>
<p>The head of the dataset, which is called “feelings,” looks like this:</p>

<p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Category</th>
<th>Rating</th>
<th>Num_Obs</th>
<th>Creative</th>
<th>Energetic</th>
<th>Joyous</th>
<th>Focused</th>
<th>Happy</th>
<th>Relaxed</th>
<th>Tired</th>
<th>Excited</th>
</tr>
</thead>
<tbody>
<tr>
<td>Drink 268</td>
<td>Category 2</td>
<td>6.71</td>
<td>383</td>
<td>0.40</td>
<td>0.22</td>
<td>0.49</td>
<td>0.22</td>
<td>0.35</td>
<td>0.03</td>
<td>0.11</td>
<td>0.38</td>
</tr>
<tr>
<td>Drink 483</td>
<td>Category 2</td>
<td>8.42</td>
<td>105</td>
<td>0.31</td>
<td>0.30</td>
<td>0.50</td>
<td>0.30</td>
<td>0.58</td>
<td>0.57</td>
<td>0.16</td>
<td>0.49</td>
</tr>
<tr>
<td>Drink 327</td>
<td>Category 2</td>
<td>8.19</td>
<td>159</td>
<td>0.52</td>
<td>0.37</td>
<td>0.50</td>
<td>0.29</td>
<td>0.50</td>
<td>0.30</td>
<td>0.18</td>
<td>0.50</td>
</tr>
<tr>
<td>Drink 79</td>
<td>Category 3</td>
<td>6.24</td>
<td>119</td>
<td>0.39</td>
<td>0.18</td>
<td>0.43</td>
<td>0.18</td>
<td>0.34</td>
<td>0.01</td>
<td>0.26</td>
<td>0.26</td>
</tr>
<tr>
<td>Drink 419</td>
<td>Category 1</td>
<td>8.14</td>
<td>173</td>
<td>0.45</td>
<td>0.34</td>
<td>0.54</td>
<td>0.24</td>
<td>0.57</td>
<td>0.31</td>
<td>0.12</td>
<td>0.55</td>
</tr>
<tr>
<td>Drink 698</td>
<td>Category 2</td>
<td>8.33</td>
<td>124</td>
<td>0.15</td>
<td>0.23</td>
<td>0.23</td>
<td>0.44</td>
<td>0.33</td>
<td>0.73</td>
<td>0.09</td>
<td>0.34</td>
</tr>
</tbody>
</table>
<p>As mentioned in the previous post, the consumer perceptive dimensions here represent the percentage of consumer reviews that flagged a given attribute as present. As an example, 40% of consumers said that Drink 268 (the first row in our dataset) makes them feel “creative.” </p>
<div><b>PCA </b></div>
<p>We will use the <b><a rel="nofollow" href="http://factominer.free.fr/" target="_blank">FactoMineR</a> </b>package to compute the PCA. FactoMineR is a really great package for exploratory data analysis, and it provides a great deal of output that we can use to visualize the results of the PCA.</p>
<p>Before we begin, let’s go over the distinction between two important terms for the PCA implementation in FactoMineR. The first is the <i>variables</i>. These are the measured dimensions that we have information on; in the current example, the perceptive dimensions (e.g. happy, relaxed) are our <i>variables</i>, and they are contained in the <i>columns </i>of our dataframe. The second is the <i>individuals</i>. These are the observations, or the units for which we have measured the information contained in the variables; in the current example, the beverages (e.g. Drink 1, Drink 2, etc.) are the <i>individuals</i>, and they are contained in the <i>rows </i>of our dataframe.</p>
<p><i>The PCA Code</i></p>
<p>We first make the beverage names the row names of our dataframe. (This is useful if we want to plot the names of the beverages in the built-in FactoMineR graphs.) We specify that we want to standardize (or scale) our variables; it’s important to do this in PCA because the size of the variation of the variables (directly influenced by their scaling) heavily influences their contribution to the analysis. By standardizing our variables prior to analysis, we ensure that the PCA is not dominated by variables purely because of the size of their variation. We specify that we want 5 principal components (via the <i>ncp </i>command, which stands for “<i>nombre de composantes principales</i>” – the package developers are French <img alt="😀" src="https://s.w.org/images/core/emoji/2/72x72/1f600.png" class="wp-smiley">). Finally, I indicate the “Category” variable as a supplementary variable. In FactoMineR, supplementary variables are not used in the analysis itself, but rather are used to interpret the results of the analysis. We store the results of our PCA in an object called “PCA_feelings.”</p>
<pre><span># make the row names of conditions the beverage names</span><br><span># useful if you want to plot the beverage names</span><br><span># on the PCA plot</span><br>rownames(<span>feelings</span>) <span>&lt;-</span> <span>feelings</span><span>$</span><span>Name</span><br><br><span># load the FactoMineR package</span><br>library(<span>FactoMineR</span>)<br><br><span># compute the PCA analysis</span><br><span># we scale the variables and indicate</span><br><span># the &quot;Category&quot; variable as a &quot;supplementary&quot;</span><br><span># variable. </span><br><span>PCA_feelings</span> <span>&lt;-</span> PCA(<span>feelings</span>[, c(<span>2</span>, <span>5</span><span>:</span>ncol(<span>feelings</span>))], <br>                    <span>scale.unit</span> <span>=</span> <span>TRUE</span>, <span>ncp</span> <span>=</span> <span>5</span>,<br>                    <span>quali.sup</span> <span>=</span> <span>1</span>, <span>graph</span> <span>=</span> <span>FALSE</span>, <span>axes</span> <span>=</span> c(<span>1</span>,<span>2</span>))<br><br></pre>
<p>The FactoMineR package will produce plots of the variables and the individuals automatically with the option “graph = TRUE,” but I’ve turned that off here. The FactoMineR plots are nice for exploration, but I find them difficult to customize to my tastes, and so below we will produce some graphs using the FactoMineR output, but plotting with the <b>ggplot2 </b>package.</p>
<div><b>How Many Principal Components to Retain?</b> </div>
<p>Let’s first try to get a sense of the results of the PCA. We started with a number of variables and we are trying to reduce them to a smaller-dimensional space. How can we decide how many principal components are sufficient to explain the variation in our data?</p>
<p>One common way to make this choice is to examine what is called a “<b>scree plot</b>.” A scree plot shows the variation in the data explained by the different principal components. By definition, the first principal component will explain the most variation in the data, and each subsequent component will explain less than the previous one. Based on the scree plot, we can see if there is a “bend” or an “elbow” in the plot; e.g. a point at which the variance explained by the principal components drops sharply. One rule-of-thumb is to only retain principal components which appear before the “bend”- those components are considered sufficient for explaining the variation in the data.</p>
<p>We will plot the <i>eigenvalues </i>(a measure of the amount of variation in the data accounted for by each factor) for each principal component in our scree plot. A principal component with larger (smaller) eigenvalues explains a greater (lesser) amount of variation in the data, and so we are most interested in principal components with larger eigenvalues. Another common rule-of-thumb is to retain the principal components which have eigenvalues greater than 1.</p>
<p>It is relatively straightforward to extract the eigenvalues from the model results object and to plot them using the base R plotting system. I draw a horizontal line on the chart at 1; according to one of the rules-of-thumb mentioned above, we can consider retaining any principal component with eigenvalues above this threshold.</p>
<pre><span># plot the eigenvalues from the PCA analysis</span><br><span># using the base plotting system</span><br>barplot(<span>PCA_feelings</span><span>$</span><span>eig</span><span>$</span><span>eigenvalue</span>, <span>names.arg</span>=<span>1</span><span>:</span>nrow(<span>PCA_feelings</span><span>$</span><span>eig</span>), <br>        <span>main</span> <span>=</span> <span>&quot;Scree Plot&quot;</span>,<br>        <span>xlab</span> <span>=</span> <span>&quot;Principal Component&quot;</span>,<br>        <span>ylab</span> <span>=</span> <span>&quot;Eigenvalue&quot;</span>,<br>        <span>col</span> <span>=</span> <span>&quot;steelblue&quot;</span>)<br>abline(<span>h</span>=<span>1</span>,<span>lty</span>=<span>2</span>,<span>col</span>=<span>&quot;red&quot;</span>)<br><br></pre>
<p>Which yields the following plot:</p>
<div><a rel="nofollow" href="https://i0.wp.com/4.bp.blogspot.com/-KTzYHtMM_PQ/WQgkgAIjNII/AAAAAAAAAVY/C2Hn9wt65FcXIhpSyrrnaqrEFC-hFngugCLcB/s1600/scree_plot.png?ssl=1" target="_blank"><img border="0" src="https://i0.wp.com/4.bp.blogspot.com/-KTzYHtMM_PQ/WQgkgAIjNII/AAAAAAAAAVY/C2Hn9wt65FcXIhpSyrrnaqrEFC-hFngugCLcB/s1600/scree_plot.png?w=456&ssl=1" data-recalc-dims="1"></a></div>
<p>It is clear that the first principal component explains the lion’s share of the variation in our data. Based on the “bend” or “elbow” rule-of-thumb, we would only retain the first principal component. However, based on the “eigenvalues-greater-than-one” rule-of-thumb, we would consider also retaining the second principal component.</p>
<p>As we are interested in plotting the results of the PCA in a two-dimensional space (called a bi-plot), we will consider the first two principal components as we proceed further with our analysis.</p>
<div><b>Bi-Plot 1: Examining the Variables (Perceptive Dimensions)</b></div>
<p>We will first produce a bi-plot of the variables (e.g. the perceptive dimensions). This plot shows the variables in the two-dimensional space defined by the first two principal components.</p>
<p>Note that the code below is somewhat involved, and if you’re just looking for a basic plot, you need go no further than those produced by the FactoMineR package by default. I’m hugely indebted to this wonderful <a rel="nofollow" href="http://stackoverflow.com/questions/10252639/pca-factominer-plot-data" target="_blank">StackOverflow response</a> for describing very clearly how to create such plots using ggplot2. In essence, we first create a dataframe with the coordinates of the variables, extracted from the PCA results object. We then set up the plot of these data using a number of different ggplot2 options.</p>
<pre><span># bi-plot for variables using ggplot2</span><br><span># adapted from:</span><br><span># http://stackoverflow.com/questions/10252639/pca-factominer-plot-data </span><br><br><span># first, create the dataset for the variables</span><br><span>vPC1</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>var</span><span>$</span><span>coord</span>[,<span>1</span>]<br><span>vPC2</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>var</span><span>$</span><span>coord</span>[,<span>2</span>]<br><span>vlabs</span> <span>&lt;-</span> rownames(<span>PCA_feelings</span><span>$</span><span>var</span><span>$</span><span>coord</span>)<br><span>vPCs</span> <span>&lt;-</span> data.frame(cbind(<span>vPC1</span>, <span>vPC2</span>))<br>rownames(<span>vPCs</span>) <span>&lt;-</span> <span>vlabs</span><br>colnames(<span>vPCs</span>) <span>&lt;-</span> c(<span>'PC1'</span>, <span>'PC2'</span>)<br><br><span># now make the bi-plot</span><br>library(<span>ggplot2</span>)<br><br><span># set up theme for plot</span><br><span>pv</span> <span>&lt;-</span> ggplot() <span>+</span> theme(<span>aspect.ratio</span>=<span>1</span>) <span>+</span> theme_bw(<span>base_size</span> <span>=</span> <span>20</span>) <br><span># put a faint circle there, as is customary</span><br><span>angle</span> <span>&lt;-</span> seq(<span>-</span>pi, pi, <span>length</span> <span>=</span> <span>50</span>) <br><span>df</span> <span>&lt;-</span> data.frame(<span>x</span> <span>=</span> sin(<span>angle</span>), <span>y</span> <span>=</span> cos(<span>angle</span>)) <br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> geom_path(aes(<span>x</span>, <span>y</span>), <span>data</span> <span>=</span> <span>df</span>, <span>colour</span>=<span>&quot;grey70&quot;</span>) <br><span># add on arrows and variable labels</span><br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> geom_text(<span>data</span> <span>=</span> <span>vPCs</span>, aes_string(<span>x</span> <span>=</span> <span>vPC1</span>, <span>y</span> <span>=</span> <span>vPC2</span>),<br>              <span>label</span>=rownames(<span>vPCs</span>), <span>cex</span>= <span>2</span>) <span>+</span> xlab(<span>'PC1 (62.49%)'</span>) <span>+</span> <br>              ylab(<span>'PC2 (13.61%)'</span>)<br><span># define end points for arrows </span><br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> geom_segment(<span>data</span>=<span>vPCs</span>, aes_string(<span>x</span> <span>=</span> <span>0</span>, <span>y</span> <span>=</span> <span>0</span>, <span>xend</span> <span>=</span> <span>vPC1</span><span>*</span><span>0.9</span>, <br>              <span>yend</span> <span>=</span> <span>vPC2</span><span>*</span><span>0.9</span>), <span>arrow</span> <span>=</span> arrow(<span>length</span> <span>=</span> unit(<span>1</span><span>/</span><span>2</span>, <span>'picas'</span>)), <br>              <span>color</span> <span>=</span> <span>&quot;grey30&quot;</span>)<br><span># specify format for the axis titles and text</span><br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> theme(<span>axis.title.y</span> <span>=</span> element_text(<span>size</span> <span>=</span> rel(.<span>65</span>), <span>angle</span> <span>=</span> <span>90</span>))<br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> theme(<span>axis.title.x</span> <span>=</span> element_text(<span>size</span> <span>=</span> rel(.<span>65</span>), <span>angle</span> <span>=</span> <span>00</span>))<br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> theme(<span>axis.text.y</span> <span>=</span> element_text(<span>angle</span> <span>=</span> <span>90</span>, <span>size</span>=<span>13</span>))<br><span>pv</span> <span>&lt;-</span> <span>pv</span> <span>+</span> theme(<span>axis.text.x</span> <span>=</span> element_text(<span>angle</span> <span>=</span> <span>00</span>, <span>size</span>=<span>13</span>))<br><span># show plot</span><br><span>pv</span> <br><br></pre>
<p>Which yields the following plot:</p>
<div></div>
<p>
<div><a rel="nofollow" href="https://i1.wp.com/4.bp.blogspot.com/-iN_XLhO-USI/WQg4SufGCoI/AAAAAAAAAV0/EcUvek9C9sAZhDfLmxcTpsbzieX5jXqgACEw/s1600/variables_blog.png?ssl=1" target="_blank"><img border="0" src="https://i1.wp.com/4.bp.blogspot.com/-iN_XLhO-USI/WQg4SufGCoI/AAAAAAAAAV0/EcUvek9C9sAZhDfLmxcTpsbzieX5jXqgACEw/s1600/variables_blog.png?w=456&ssl=1" data-recalc-dims="1"></a></div>
<div></div>
<p>The biplot shows the variables and their inter-relations in the space represented by the first two principal components. The closeness of the arrows representing the variables gives us an indication of their correlation. In other words, variables with arrows that are closer together are more highly correlated. The bi-plot therefore indicates that our 8 perceptive dimensions cluster into 3 groups: relaxed feelings (<i>tired </i>and <i>relaxed</i>), positive emotions (<i>joyous </i>and <i>happy</i>) and excited feelings (<i>excited</i>, <i>creative</i>, <i>energetic </i>and <i>focused</i>). </p>
<p>The bi-plot also shows how the variables are situated in relation to the first and second principal components, which define the x and y axes, respectively. We can see that the first principal component is very clearly defined by two poles of variables, represented on the left by <i>tired </i>and <i>relaxed</i>, and on the right by <i>excited</i>, <i>creative</i>, <i>energetic </i>and (to a lesser extent) <i>focused</i>. This first principal component dominates the analysis (as we saw in the scree plot) and it explains 62.49% of the variance in the perception data. In other words, if we want to understand the primary dimension on which the beverages differ, it would be the dimension of the first principal component, contrasting tired and relaxed feelings vs. energetic feelings.</p>
<p>In contrast, the second principal component explains a much smaller percentage of the variance in the data (13.61%). This dimension seems to indicate positive emotion, and is defined by <i>joyous </i>and <i>happy</i>, and to a lesser extent <i>relaxed</i>.</p>
<p>The <i>dimdesc </i>function in the FactoMineR package computes the correlations between the variables and the principal components; variables that have large positive or negative correlations best define the PC’s.</p>
<pre><span># display the correlations between</span><br><span># the variables and the principal components</span><br>dimdesc(<span>PCA_feelings</span>)<br><br></pre>
<p>Which yields the following table for the first principal component:</p>

<p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Correlation</th>
<th>p-value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Energetic</td>
<td>0.94</td>
<td>4.10E-96</td>
</tr>
<tr>
<td>Excited</td>
<td>0.93</td>
<td>1.90E-90</td>
</tr>
<tr>
<td>Creative</td>
<td>0.91</td>
<td>1.10E-76</td>
</tr>
<tr>
<td>Focused</td>
<td>0.77</td>
<td>6.23E-40</td>
</tr>
<tr>
<td>Happy</td>
<td>0.60</td>
<td>2.11E-21</td>
</tr>
<tr>
<td>Joyous</td>
<td>0.50</td>
<td>5.12E-14</td>
</tr>
<tr>
<td>Relaxed</td>
<td>-0.60</td>
<td>2.08E-21</td>
</tr>
<tr>
<td>Tired</td>
<td>-0.92</td>
<td>3.75E-85</td>
</tr>
</tbody>
</table>
<p>And this table for the second principal component:</p>

<p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Correlation</th>
<th>p-value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Joyous</td>
<td>0.62</td>
<td>1.45E-22</td>
</tr>
<tr>
<td>Happy</td>
<td>0.61</td>
<td>8.87E-22</td>
</tr>
<tr>
<td>Relaxed</td>
<td>0.43</td>
<td>3.14E-10</td>
</tr>
<tr>
<td>Energetic</td>
<td>-0.17</td>
<td>1.57E-02</td>
</tr>
<tr>
<td>Focused</td>
<td>-0.31</td>
<td>9.29E-06</td>
</tr>
</tbody>
</table>
<div></div>
<div><b>Bi-Plot 2: Examining the Individuals (Beverages) and the Qualitative Supplementary Variable</b></div>
<p>Next, we will plot the individuals (the beverages), on their coordinates in the two-dimensional space defined by the first two principal components. We will color each beverage according to its Category (1, 2, or 3). We will also plot the qualitative supplementary variable of category in this space.</p>
<p>The code is again somewhat involved, and if you’re not interested in customizing your plots, you can simply use the default plots provided by the FactoMineR package. We use the same approach as for the first bi-plot: creating dataframes with the coordinates from the PCA results object (for the beverages and for the quali supp variable of category), and then specifying the parameters for the plot with ggplot2.</p>
<p>The code to produce the data and the plot look like this:</p>
<pre><span># create the dataset for the individuals (beverages)</span><br><span>PC1</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>ind</span><span>$</span><span>coord</span>[,<span>1</span>]<br><span>PC2</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>ind</span><span>$</span><span>coord</span>[,<span>2</span>]<br><span>Category</span> <span>&lt;-</span> as.character(<span>feelings</span><span>$</span><span>Category</span>)<br><span>labs</span> <span>&lt;-</span> rownames(<span>PCA_feelings</span><span>$</span><span>ind</span><span>$</span><span>coord</span>)<br><span>PCs</span> <span>&lt;-</span> data.frame(cbind(<span>PC1</span>,<span>PC2</span>,<span>Category</span>))<br>rownames(<span>PCs</span>) <span>&lt;-</span> <span>labs</span><br><br><span># create the dataset for qualitative supplementary variables</span><br><span>cPC1</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>quali.sup</span><span>$</span><span>coor</span>[,<span>1</span>]<br><span>cPC2</span> <span>&lt;-</span> <span>PCA_feelings</span><span>$</span><span>quali.sup</span><span>$</span><span>coor</span>[,<span>2</span>]<br><span>clabs</span> <span>&lt;-</span> rownames(<span>PCA_feelings</span><span>$</span><span>quali.sup</span><span>$</span><span>coor</span>)<br><span>cPCs</span> <span>&lt;-</span> data.frame(cbind(<span>cPC1</span>,<span>cPC2</span>,<span>clabs</span>))<br>rownames(<span>cPCs</span>) <span>&lt;-</span> <span>clabs</span><br>colnames(<span>cPCs</span>) <span>&lt;-</span> c(<span>'PC1'</span>, <span>'PC2'</span>, <span>'Category'</span>)<br><br><span># plot the individuals (beverages)</span><br><span># and quali supp variable</span><br><br><span># define the plot basics - individuals</span><br><span>g</span> <span>&lt;-</span> ggplot(<span>PCs</span>, aes_string(<span>x</span> <span>=</span> <span>PC1</span>, <span>y</span> <span>=</span> <span>PC2</span>, <span>color</span> <span>=</span> <span>&quot;Category&quot;</span>)) <span>+</span> geom_point()<br><span># define the colors, axis limits &amp; labels</span><br><span>g</span> <span>&lt;-</span> <span>g</span> <span>+</span> scale_color_manual(<span>values</span>=c(<span>&quot;#8e7600&quot;</span>, <span>&quot;#8245cc&quot;</span>, <span>&quot;#018d69&quot;</span>)) <span>+</span> <br>  xlab(<span>'PC1 (62.49%)'</span>) <span>+</span> ylab(<span>'PC2 (13.61%)'</span>) <span>+</span><br>  coord_cartesian(<span>xlim</span> <span>=</span> c(<span>-</span><span>5.5</span>, <span>5</span>), <span>ylim</span> <span>=</span> c(<span>-</span><span>5</span>, <span>2.5</span>)) <br><span># add the quali supplemental variables</span><br><span>g</span> <span>&lt;-</span> <span>g</span> <span>+</span> geom_point(<span>data</span> <span>=</span> <span>cPCs</span>, aes(<span>x</span>=<span>cPC1</span>,<span>y</span>=<span>cPC2</span>), <span>size</span> <span>=</span> <span>8</span>)<br><span># show the plot</span><br><span>g</span><br><br></pre>
<p>Which yields the following plot: </p>
<div><a rel="nofollow" href="https://i0.wp.com/1.bp.blogspot.com/-tGhUqaGiHVE/WQhUd78y-xI/AAAAAAAAAWM/8OaBXFo0RhQSG0poBb-HNjpVaKLzhEPgQCLcB/s1600/drinks_no_labels_blog.png?ssl=1" target="_blank"><img border="0" src="https://i0.wp.com/1.bp.blogspot.com/-tGhUqaGiHVE/WQhUd78y-xI/AAAAAAAAAWM/8OaBXFo0RhQSG0poBb-HNjpVaKLzhEPgQCLcB/s1600/drinks_no_labels_blog.png?w=456&ssl=1" data-recalc-dims="1"></a></div>
<p>We have colored the points in the plot according to category. The small points represent the individual beverages, and the large points represent the “quali supp” variable, showing the centers for each category in the two-dimensional space defined by the first two principal components.</p>
<p>As is clear from examination of the points for the individual beverages and from the position of the qualitative supplementary variable, there is a definite ordering of the categories of beverages across the the first principal component (displayed on the x-axis). Beverages of Category 1 are higher on this component, indicating that they are more likely to provoke feelings of energy and excitement (think along the lines of energy drinks or coffee, for example). Beverages of Category 3 are lower on this component, indicating that they are more likely to provoke feelings of tiredness and relaxation (think along the lines of herbal teas, for example). Beverages of Category 2 in general fall in the middle, though note that there is some overlap in the ordering of the beverages of the different categories across the first principal component.</p>
<p>There is far less variation among the categories on the second principal component (displayed on the y-axis). The center for Category 1 is below zero, while those for Categories 2 and 3 are slightly above zero. However, the differences among the categories on the second principal component are far smaller than their differences on the first principal component. Note that while individual beverages from the various categories vary along the second principal component, the overall averages per category do not differ dramatically along this dimension.</p>
<p>
<div><b>Bringing It All Home: Mapping Consumer Perceptions of the Beverage Category</b></div>
<p>What have we learned from this exercise about how consumers perceive the beverage category?</p>
<p>First, the PCA analysis helped us to distill the information regarding our many variables (perceptive dimensions) into a smaller-dimensional space defined by two principal components. An examination of the variables bi-plot showed that some of the perceptive dimensions were highly correlated with one another. Specifically, we can spot 3 clusters of variables, corresponding to relaxed feelings (<i>tired </i>and <i>relaxed</i>), positive emotions (<i>joyous </i>and <i>happy</i>) and feelings of excitement (<i>excited</i>, <i>creative</i>, <i>energetic </i>and <i>focused</i>).</p>
<p>Second, our analysis of the principal components themselves revealed that the first PC explained most of the variation of the data. This principal component was defined by two opposing poles: on the one hand by feelings of <i>energy</i>, <i>excitement </i>and <i>creativity</i>, and on the other by feelings of <i>tiredness </i>and <i>relaxation</i>. Therefore, if we were to summarize how consumers perceive the beverage category in terms of our perceptive dimensions, we could simply say that consumers differentiate beverages according to how activated or energetic they make them feel, versus how tired and relaxed they make them feel.</p>
<p>Finally, an examination of the individuals (beverages) revealed a clear distinction among the categories of beverages according to the first principal component. Beverages from Category 1 were located on the “excitement” pole of the first principal component, indicating that they are much more likely to provoke energetic feelings. Beverages from Category 3 were located on the “tired/relaxation” pole of the first principal component, indicating that they are much more likely to provoke feelings of fatigue and calm.</p>
<p>Therefore, not only do we understand the basic underlying components of our perceptive dimensions, but we are also able to place our products and our product categories in the space defined by these dimensions. Such insight can help guide, for example, a marketing strategy wherein beverages from Category 1 are marketed as giving an energetic boost, promoting consumption of the drinks in the morning and afternoon, while beverages from Category 3 are marketed as helping one unwind at the end of the day.  </p>
<p>
<div><b>Conclusion </b></div>
<p>In sum, in this post we used PCA to understand how consumers perceive products in the beverage category. Our PCA allowed us to distill the information contained in our variables (consumer perceptive dimensions) into a smaller-dimensional space, providing insight into the structure of the product category and allowing us to place our beverages and beverage categories within this space. With this information, we can better understand the product and the product category, and use the information to help guide our business (for example, in communicating the benefits of our beverages to the public).</p>
<p><i>Coming Up Next</i></p>
<p>In my next post, I will use a type of deep learning, <a rel="nofollow" href="https://en.wikipedia.org/wiki/Word2vec" target="_blank">word2vec</a>, to make a vector space model with the text of wine descriptions. We will use this approach to understand word similarity in the wine texts. Stay tuned!</p>
<p>—</p>
<p>* I will mention that I met Professor Husson at the useR! conference in Brussels in June. He was very nice when I tried to explain a bit about this project to him in French.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://methodmatters.blogspot.com/2017/09/sensographics-and-mapping-consumer.html"> Method Matters</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/7LIIEmSUryI" height="1"></a></div>