Learn R Programming

mcmcplots (version 0.2)

corplot: Plot a Correlation Matrix

Description

Creates an image plot of a correlation matrix where colors of different shades represent differing levels of correlation. 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.

Usage

corplot(mat, col = mcmcplotsPalette(11, TRUE), outline = TRUE, 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 sqares should be drawn.
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.

Value

  • Creates a plot.

Details

None.

References

None.

See Also

image

Examples

Run this code
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("vec[", 1:6, "]", sep=""), paste("vec[", 1:6, "]", sep=""))
corplot(Rho)

Run the code above in your browser using DataLab