Description Usage Arguments Details Value Author(s) See Also Examples
Determines which parameters are in common from two different MCMC simulations and plots overlaying density estimates of the parameters in common.
1 2 3 4 5 |
mcmc1 |
object that can be coerced to an |
mcmc2 |
object that can be coerced to an |
parms |
character vector specifying which subsets of parameters to plot. If |
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 |
ci |
if non |
auto.layout |
logical specifying whether the |
legend |
if |
mar |
argument passed to |
col |
colors for plotting the densites. |
lty |
line types for plotting densities. Argument is recylced to be of length 2. |
plot.title |
title to put in the outer margin. Default is no title. |
main |
character vector of titles to put over each individual plot. If |
greek |
if |
style |
if "gray", then the plotting region is printed with a gray background, otherwise the default plotting region is used. |
... |
additional arguments passed to the |
This function can be used in debugging MCMC code by comparing distributions of parameters from the development MCMC code and a reference MCMC simulation.
Creates a plot.
S. McKay Curtis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Create fake MCMC output
nc <- 10; nr <- 1000
pnames <- c(paste("alpha[", 1:5, "]", sep=""), paste("gamma[", 1:5, "]", sep=""))
means <- rpois(10, 20)
fakemcmc <- coda::as.mcmc.list(
lapply(1:3,
function(i) coda::mcmc(matrix(rnorm(nc*nr, rep(means, each=nr)),
nrow=nr, dimnames=list(NULL,pnames)))))
fakemcmc2 <- coda::as.mcmc.list(
lapply(1:3,
function(i) coda::mcmc(matrix(rnorm(nc*nr, rep(means, each=nr)),
nrow=nr, dimnames=list(NULL,pnames)))))
## Plot the fake MCMC output
denoverplot(fakemcmc, fakemcmc2)
denoverplot(fakemcmc, fakemcmc2, style="plain",
col=mcmcplotsPalette(3, type="grayscale"),
ci=0.95, greek=TRUE)
denoverplot(fakemcmc, fakemcmc2,
plot.title="Comparison of densities of fake data")
denoverplot(fakemcmc, fakemcmc2,
plot.title="Comparison of densities of fake data", greek=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.