Base R

Enter the data from Table 4 into R.

Age <- c(25, 25, 28, 32, 32, 32, 38, 42, 48, 51, 51, 58, 62, 65)
Fat <- c(19,28,19,16,24,20,31,20,26,24,32,21,21,30)
Cholesterol <- c(180, 195, 186, 180, 210, 197, 239, 183, 204, 221, 243, 208, 228, 269)
Table4 <- data.frame('Age'=Age, 'Fat'=Fat,'Cholesterol'=Cholesterol)
head(Table4)
##   Age Fat Cholesterol
## 1  25  19         180
## 2  25  28         195
## 3  28  19         186
## 4  32  16         180
## 5  32  24         210
## 6  32  20         197

To find the correlation matrix, use the cor() command.

cor(Table4)
##                   Age       Fat Cholesterol
## Age         1.0000000 0.3241428   0.7178106
## Fat         0.3241428 1.0000000   0.7778371
## Cholesterol 0.7178106 0.7778371   1.0000000

The linear correlation between total cholesterol and Age is 0.718. The linear correlation between total cholesterol and saturated fat is 0.778. Because the linear correlation between age and saturated fat (the 2 explanatory variables) is only 0.324, we are not concerned with multicollinearity.

Mosaic

As with base R, enter the data in Table 4 as shown above. Mosaic also uses the cor() command to find the correlation matrix.