Description Usage Arguments Value Author(s) See Also Examples
Creates a plot of densities for specified parameters from an MCMC simulation in a single plot or plots densities for those parameters as indicated by the parms and regex.
| 1 2 3 4 5 | denplot(mcmcout, parms = NULL, regex = NULL, random = NULL,
leaf.marker="[\\[_]", ci = NULL, xlim = NULL,
ylim = NULL, auto.layout = TRUE, mar=c(2.0, 2.0, 1.5, 0.25) + 0.1, col =
NULL, lty = 1, xlab = "", ylab = "", plot.title = NULL, main = NULL,
greek = FALSE, collapse = FALSE, style=c("gray", "plain"), ...)
 | 
| mcmcout |  an object that can be coerced to an  | 
| parms |  a vector of character strings that identifies which variables in  | 
| regex |  a vector of character strings with regular expressions that identify which variables in  | 
| random |  an integer indicating the maximum number of parameters to randomly select for plotting from each group of parameters as specified by the  | 
| leaf.marker |  a regular expression with a character class that marks the beginning of the “leaf” portion of a parameter name.  The default character class includes  | 
| ci |  if non  | 
| xlim | limits of the x-axis. | 
| ylim | limits of the y-axis. | 
| auto.layout |  if  | 
| mar |  argument passed to  | 
| col | colors to be used in plotting the densities. | 
| lty | line types to be used in plotting. | 
| xlab | label for the x-axis. | 
| ylab | label for the y-axis. | 
| plot.title | title to put in the outer margin. Default is no title. | 
| main |  character vector of titles for each individual plot.  If  | 
| greek |  if  | 
| collapse |  if  | 
| style | if "gray", then the plotting region is printed with a gray background, otherwise the default plotting region is used. | 
| ... | further arguments to be passed to the plotting function. | 
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 23 24 25 26 27 28 29 30 31 32 33 | ## 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)))))
## Plot densities of the fake MCMC output
denplot(fakemcmc)
denplot(fakemcmc, style="plain")
denplot(fakemcmc, collapse=TRUE, greek=TRUE, ci=0.95)
denplot(fakemcmc, xlim=range(unlist(fakemcmc)),
        plot.title="Density plots of fake data. Yawn.")
denplot(fakemcmc, "gamma")
denplot(fakemcmc, "gamma", "alpha\\[[12]]$") # all gamma and alpha[1] and alpha[2]
## What happens with NULL varnames?
coda::varnames(fakemcmc) <- NULL
denplot(fakemcmc)
## Not run: 
## denplot works on bugs objects too
library(R2WinBUGS)
example("openbugs", "R2WinBUGS")
## from the help file for openbugs:
schools.sim <- bugs(data, inits, parameters, model.file,
                    n.chains = 3, n.iter = 5000,
                    program = "openbugs", working.directory = NULL)
denplot(schools.sim, "theta")
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.