Plot a Correlation Matrix

Description

Creates an image plot of a correlation matrix where colors of different shades represent differing levels of correlation.

Usage

1
2
corplot(mat, col = mcmcplotsPalette(11, "sequential"), outline = TRUE,
greek = FALSE, legend.scale = 0.75, mar=c(5, 4, 1, 1) + 0.1, ...)

Arguments

mat

correlation matrix.

col

colors to be used in the plot.

outline

logical indicating whether outlines of image squares should be drawn.

greek

if TRUE, the names of greek letters in the labels will be displayed as greek characters on the plot.

legend.scale

scales the height of the legend with respect to the height of the plot. Default is 0.75 which makes the legend 3 quarters as tall as the plot.

mar

graphical parameter mar. See documentation for par.

...

further arguments passed to the plotting function.

Details

One possible use of this function is to plot the correlation between posterior draws of an MCMC run. Patterns in the plot can aid in constructing a more efficient blocking structure for an MCMC algorithm, where highly correlated parameters should be placed in the same MCMC update block. None.

Value

Creates a plot.

Author(s)

S. McKay Curtis

See Also

image

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Rho <- matrix(c(
 1.00,  0.35, -0.65, -0.66,  0.46,  0.42,
 0.35,  1.00, -0.69, -0.64,  0.40, -0.06,
-0.65, -0.69,  1.00,  0.70, -0.57, -0.11,
-0.66, -0.64,  0.70,  1.00, -0.15, -0.10,
 0.46,  0.40, -0.57, -0.15,  1.00,  0.18,
 0.42, -0.06, -0.11, -0.10,  0.18,  1.00), 6, 6)
dimnames(Rho) <- list(paste("rho[", 1:6, "]", sep=""), paste("rho[", 1:6, "]", sep=""))
corplot(Rho)
corplot(Rho, greek=TRUE)