Learn R Programming

mcmcplots (version 0.2)

parms2plot: Matches groups of parameters to plot in MCMC diagnostics plots.

Description

Utility function that finds the parameter names to plot in the mcmcplot function. Intended for internal use only.

Usage

parms2plot(parnames, parms, regex, random)

Arguments

parnames
parameter names from an MCMC run
parms
partial parameter names that will be used to determine which subset of parnames will be plotted.
regex
a vector of character strings containing regular expressions to match parameter names in the mcmc object.
random
an integer or NULL. If an integer is specified, the function will select only random number of plots from each parameter group for plotting. If NULL, all parameter names from groups specified in params

Value

  • A character vector with parameter names from parnames that match the partial parameter names in params.

Details

No details.

References

None.

See Also

mcmcplot, caterplot

Examples

Run this code
prm <- c(paste("gamma[", 1:30, "]", sep=""),paste("alpha[", 1:20, "]", sep=""))

parms2plot(prm, NULL, NULL, NULL)      # returns all
parms2plot(prm, NULL, NULL, 5)         # returns 5 randomly from each group
parms2plot(prm, NULL, NULL, c(5, 10))  # 5 from gamma, 10 from alpha
parms2plot(prm, NULL, NULL, c(10, NA)) # 10 from gamma, all from alpha
parms2plot(prm, "alpha", NULL, NULL)   # all alphas
parms2plot(prm, "gamma", NULL, NULL)   # all gamma
parms2plot(prm, NULL, "alpha\\[1[[:digit:]]\\]$", NULL)   # alpha[10]-alpha[19]
parms2plot(prm, "gamma", "alpha\\[1[[:digit:]]\\]$", NULL)  # all gamma and alpha[10]-alpha[19]

Run the code above in your browser using DataLab