MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Multivariate Probability Distributions in R

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Calculate the correlation matrix 
cor.wine <- ___

# Round the matrix to two decimal places 
___

# Plot the correlations 
corrplot(___, method = "ellipse")
Edit dan Jalankan Kode