Use the default set “iris” for the following experiment.
names(iris)
## [1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
## [5] "Species"
plot(iris)
cor(iris[1:4])
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411
## Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259
## Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654
## Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000
cor(iris[1:4], method="kendall")
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Sepal.Length 1.00000000 -0.07699679 0.7185159 0.6553086
## Sepal.Width -0.07699679 1.00000000 -0.1859944 -0.1571257
## Petal.Length 0.71851593 -0.18599442 1.0000000 0.8068907
## Petal.Width 0.65530856 -0.15712566 0.8068907 1.0000000
cor(iris[1:4], method="spearman")
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Sepal.Length 1.0000000 -0.1667777 0.8818981 0.8342888
## Sepal.Width -0.1667777 1.0000000 -0.3096351 -0.2890317
## Petal.Length 0.8818981 -0.3096351 1.0000000 0.9376668
## Petal.Width 0.8342888 -0.2890317 0.9376668 1.0000000
cor(iris[1:2])
## Sepal.Length Sepal.Width
## Sepal.Length 1.0000000 -0.1175698
## Sepal.Width -0.1175698 1.0000000
cr <- cor(iris[1:4])
library(corrplot)
## corrplot 0.84 loaded
corrplot(cr)
corrplot(cr,method="pie")
corrplot(cr,method="color")
corrplot(cr,method="number")
They are symmetrical in matrix form. They are both uppper and lower triangular form since they relfect on the diagonal axis.
pairs(iris[1:4])
library(psych)
pairs.panels(iris[1:4], hist.col="purple")
pairs.panels(iris[1:4], hist.col="#00CED1" )