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

后端 未结 5 795
后悔当初
后悔当初 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 15:00

    Well I just have to post about my own package here:)

    You can use qgraph to visualize a correlation matrix as a network. This will plot variables as nodes and correlations as edges connecting the nodes. Green edges indicate positive correlations and red edges indicate negative correlations. The wider and more saturated the edges the stronger the absolute correlation.

    For example (this is the first example from the help page), the following code will plot the correlation matrix of a 240 variable dataset.

    library("qgraph")
    data(big5)
    data(big5groups)
    qgraph(cor(big5),minimum=0.25,cut=0.4,vsize=2,groups=big5groups,legend=TRUE,borders=FALSE)
    title("Big 5 correlations",line=-2,cex.main=2)
    

    enter image description here

    You can also cluster strongly correlated nodes together (uses Fruchterman-Reingold) which creates quite a clear image of what the structure of your correlation matrix actually looks like:

    enter image description here

    And alot more. For some more examples take a look at my site:

    http://sachaepskamp.com/?page_id=73

提交回复
热议问题