psych (version 1.0-97)

cor.plot: Create an image plot for a correlation or factor matrix

Description

Correlation matrices may be shown graphically by using the image function to emphasize structure. This is a particularly useful tool for showing the structure of small correlation matrices with a clear structure. Meant for the pedagogical value of the graphic for teaching or discussing factor analysis and other multivariate techniques.

Usage

cor.plot(r,colors=FALSE, n=10,main=NULL,zlim=c(-1,1),show.legend=TRUE,labels=NULL,...)

Arguments

r
A correlation matrix or the output of factor.pa, factor.minres or omega.
colors
Defaults to FALSE (grey), but colors=TRUE will use topo.colors
n
The number of levels of shading to use. Defaults to 10
main
A title. Defaults to ``correlation plot"
zlim
The range of values to color -- defaults to -1 to 1
show.legend
A legend (key) to the colors is shown on the right hand side
labels
if NULL, use column and row names, otherwise use labels
...
Other parameters for axis (e.g., cex.axis to change the font size)

Details

When teaching about factor analysis or cluster analysis, it is useful to graphically display the structure of correlation matrices. This is a simple graphical display using the image function.

The difference of mat.plot with a regular image plot is that the primary diagonal goes from the top left to the lower right.

The zlim parameter defaults to 0 to 1. This means that negative correlations are treated as zero. This is advantageous when showing general factor structures, because it makes the 0 white.

The default shows a legend for the color coding on the right hand side of the figure.

Inspired, in part, by a paper by S. Dray (2008) on the number of components problem.

References

Dray, Stephane (2008) On the number of principal components: A test of dimensionality based on measurements of similarity between matrices. Computational Statistics & Data Analysis. 52, 4, 2228-2237.

See Also

fa, mat.sort

Examples

Run this code
data(bifactor)
cor.plot(Thurstone,TRUE, zlim=c(0,1),main="9 cognitive variables from Thurstone")
cor.plot(mat.sort(Thurstone),TRUE,zlim=c(0,1), main="9 cognitive variables from Thurstone (sorted by factor loading) ")
simp <- sim.circ(24)
cor.plot(cor(simp),colors=TRUE,,main="24 variables in a circumplex")

Run the code above in your browser using DataLab