Sunday, December 22, 2013

2.6 Showing correlations in R

Showing correlations in R

With correlations you could find the level of cohesion between two variables. A correlation of 1 is a perfect positive cohesion, a correlation of -1 a perfect negative cohesion and 0 means no cohesion. The value of the correlation does not have to mean anything. Values of correlations require the right interpretation and explanation.

Calculating a correlation

You can make R calculate a correlation between two variable with the command cor(*variable1*,*variable2*). In the example of Figure 21 you see that the correlations are shown between different variables of the dataset Projects.csv

Interpretation of a correlation


Figure 21 shows that the variables HoursProject (UrenProject) and SatisfactionCustomer (TevredenheidKlant) have quite a negative correlation. With the given value of -0.4452513 it is remarkable that the number of hours a project takes is associated negatively with the satisfaction of a customer. The satisfaction of the customer decreases when the number of hours the project takes increases. 

This way you can find correlations between different variables to see which variables have a high or low correlation.

Figure 21: Showing the correlations between different variables in R
Figure 21: Showing the correlations between different variables in R

Overview of all correlations of the dataset

You can let R give an overview of correlations between variables in all combinations. This could be done by excuting the command cor(*name of the variable of the dataset*).

Figure 22 shows that the command cor(Projects) is used to give an overview of correlations between all variables. This will save you a lot of time when you want to have a quick insight in all correlations.

Figure 22 shows that the variables HoursProject ( UrenProject) and Profit (Winst) have a strong correlation.

Figure 22: Showing all correlations between variables with one command
Figure 22: Showing all correlations between variables with one command


No comments:

Post a Comment