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 space and it remains hard to grasp the message. Are there any established strategies to highlight what's important? I am aware this question is somewhat general, but I wondered over and over again and never had the panacea to cure it. And yup, I heard of summary
.
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.
A correlation matrix is simply a table which displays the correlation coefficients for different variables. The matrix depicts the correlation between all the possible pairs of values in a table. It is a powerful tool to summarize a large dataset and to identify and visualize patterns in the given data.
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)
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:
And alot more. For some more examples take a look at my site:
http://sachaepskamp.com/?page_id=73
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With