Correlation
Correlation plots show the correlation coefficients between continuous variables. Following is a description of how to do this using PlotAll.
Load mtcars dataset from ‘load data from app’ under ‘Load Data’. A preview of the data is shown below.
Brand | mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb |
Mazda RX4 | 21 | 6 | 160 | 110 | 3.9 | 2.62 | 16.46 | 0 | 1 | 4 | 4 |
Mazda RX4 Wag | 21 | 6 | 160 | 110 | 3.9 | 2.875 | 17.02 | 0 | 1 | 4 | 4 |
Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.32 | 18.61 | 1 | 1 | 4 | 1 |
Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1 |
Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.44 | 17.02 | 0 | 0 | 3 | 2 |
Valiant | 18.1 | 6 | 225 | 105 | 2.76 | 3.46 | 20.22 | 1 | 0 | 3 | 1 |
Duster 360 | 14.3 | 8 | 360 | 245 | 3.21 | 3.57 | 15.84 | 0 | 0 | 3 | 4 |
Merc 240D | 24.4 | 4 | 146.7 | 62 | 3.69 | 3.19 | 20 | 1 | 0 | 4 | 2 |
Merc 230 | 22.8 | 4 | 140.8 | 95 | 3.92 | 3.15 | 22.9 | 1 | 0 | 4 | 2 |
Select ‘mpg’ as ‘x variable’ and ‘hp’ as ‘y variable’ under ‘Plot Variables’. Design points under ‘Design Objects’. In ‘Design Overlay’, check ‘Add Trend’, select ‘Linear Model’ in ‘smoothing methods’. Click ‘Submit’. A negative correlation between the two variables can be observed in the plot.
However in this example, we’d like to see the correlations between all continuous variables in the dataset. To do that, check ‘Correlation’ in the very right of the window. Click ‘Submit’. This will show the correlations in a matrix. If numeric discrete variables present, they will be considered as continuous and will be included in correlation matrix. Correlation between mpg and hp is shown at the bottom as -0.8.
If we like to see the correlations between specific columns, we need to subset columns. Check ‘Subset Column’ at the very left bottom of window. Select columns ‘mpg’, ‘hp’, ‘wt’ and ‘qsec’. Click ‘Submit’.
This will plot correlations between selected columns only.
Let’s try your own. Create correlation matrix with PlotAll.