What's a good strategy to get a decent overview of big correlation matrices or pairs?

后端 未结 5 799
后悔当初
后悔当初 2020-12-23 14:10

Often some data.frame contains 20+ variables and you want to get a first overview (of the correlation structure). Even on a 30\" screen you run quickly out of s

5条回答
  •  悲哀的现实
    2020-12-23 14:58

    What about doing a PCA on the correlation matrix? Then the angle between variables show their correlation.

    library(HSAUR)
    heptathlon
    round(cor(heptathlon[,-8]),2)   # correlations [without score]
    
    require(vegan)
    PCA <-  rda(heptathlon[,-8], scale=TRUE)   # run a PCA
    biplot(PCA, display = "species")   # correlation biplot
    #  The angles between descriptors in the biplot reflect their correlations
    

    enter image description here

提交回复
热议问题