Learn R Programming

mcmcplots (version 0.2)

parcorplot: Correlation Plot for Posterior Draws of Model Parameters

Description

This is a wrapper function for corplot. The function uses the arguments parms, regex, and random to allow the user to easily select parameters from an MCMC simulation to use for computing correlations and plotting with corplot.

Usage

parcorplot(mcmcout, parms = NULL, regex = NULL, random = NULL, col = gray(11:0/11), ...)

Arguments

mcmcout
posterior draws. This argument will be coerced to an mcmc object.
parms
character vector specifying which subsets of parameters to plot. If NULL and regex=NULL, mcmcplot will plot all parameters. Regular expressions are used to strip all numbers and punctuation out of the parameter name
regex
character vector of regular expressions denoting groups of parameters to plot.
random
integer specifying how many parameters from each group will be randomly selected for plotting. This argument is useful when mcmcout has a large number of parameters (e.g., from a hierarchical model). If NULL, mcmcplot
col
colors to be used in the plot.
...
further arguments that are passed to the corplot function.

Value

  • Creates a plot.

Details

None.

References

None.

See Also

corplot

Examples

Run this code
Rho1 <- outer(1:10, 1:10, function(i, j) 0.5^(abs(i-j)))
Rho2 <- outer(1:5, 1:5, function(i, j) 0.25^(i!=j))
dat1 <- t(apply(matrix(rnorm(10*1000), 1000, 10), 1, function(z, Rho1) t(Rho1)%*%z, Rho1))
dat2 <- t(apply(matrix(rnorm(5*1000), 1000, 5), 1, function(z, Rho2) t(Rho2)%*%z, Rho2))
colnames(dat1) <- paste("theta[", 1:10, "]", sep="")
colnames(dat2) <- paste("alpha[", 1:5, "]", sep="")
dat <- cbind(dat1, dat2)
parcorplot(dat, "theta", col=gray(31:0/31), cex.axis=0.75)
parcorplot(dat, col=heat.colors(31), cex.axis=0.75)
parcorplot(dat, col=topo.colors(31), cex.axis=0.75)
parcorplot(dat, col=terrain.colors(31), cex.axis=0.75)
parcorplot(dat, col=cm.colors(31), cex.axis=0.75)

Run the code above in your browser using DataLab