0
$\begingroup$

I would like to know how to plot the following 30 observations on a graph, with 1 color for each country, using Kmeans or other methods on R. Each of the 40 independent variables can take value from 0 to 100 (100 means the data point shows strongly the attribute).

enter image description here

Thank you

$\endgroup$
  • $\begingroup$ See this question. $\endgroup$ – Ami Tavory Jul 9 '17 at 8:12
  • $\begingroup$ Aside from the 30 graphs of 40 boxplots which Ami suggest (which can be nice... if you have a very big screen) you may reduce the dimensionality a bit by exploiting the possible correlations (hoping that the variables are not completely independent) with principle component analysis (PCA). $\endgroup$ – Martijn Weterings Jul 9 '17 at 9:16
  • $\begingroup$ What do you mean by "using Kmeans"? Clustering first and then plotting the clusters? $\endgroup$ – xan Jul 10 '17 at 11:35
1
$\begingroup$

You would use a parallel coordinate plot for multivariate analysis. Combine it with the following additional aesthetics:

  1. Variables 1-40 on the x axis
  2. 0-100 on the y axis
  3. Line by Observation number
  4. color or trellis/facet by Country

Using PCA or k-means would be a good solution if all your variables had differing scales or different data types. But since the observations follow similar scales and are fewer groups (2 countries), the Parallel coordinate plot is pretty easy to read, so no need for dimensionality reduction.

You should use boxplots if it is important to compare the summary or overall behavior of country 1 to country 2 for all variables. PCP is better at giving you insights at the level of each individual point or observation.

Also side note on terminology: graph as a term is often interpreted as network data type of graph, you would get better search results if you use plot for relational data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.