开始使用免费开始使用

Calculating the correlation matrix

A correlation matrix is a generalization of the concept of correlation between two variables. If you are looking at a large number of variables, it can also be useful to visualize the correlation matrix to understand the dependence of the variables on each other.

本练习是课程的一部分

Multivariate Probability Distributions in R

查看课程

练习说明

  • Find the correlation matrix of the Alcohol, Malic, Ash, and Alcalinity variables from the wine data.
  • Round the values of the correlation matrix to two decimal places.
  • Use the corrplot() function to visualize the correlation matrix.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Calculate the correlation matrix 
cor.wine <- ___

# Round the matrix to two decimal places 
___

# Plot the correlations 
corrplot(___, method = "ellipse")
编辑并运行代码