Learn R Programming

bayesm (version 3.1-6)

plot.bayesm.nmix: Plot Method for MCMC Draws of Normal Mixtures

Description

plot.bayesm.nmix is an S3 method to plot aspects of the fitted density from a list of MCMC draws of normal mixture components. Plots of marginal univariate and bivariate densities are produced.

Usage

# S3 method for bayesm.nmix
plot(x, names, burnin, Grid, bi.sel, nstd, marg, Data, ngrid, ndraw, ...)

Arguments

x

An object of S3 class bayesm.nmix

names

optional character vector of names for each of the dimensions

burnin

number of draws to discard for burn-in (def: \(0.1*nrow(X)\))

Grid

matrix of grid points for densities, def: mean +/- nstd std deviations (if Data no supplied), range of Data if supplied)

bi.sel

list of vectors, each giving pairs for bivariate distributions (def: list(c(1,2)))

nstd

number of standard deviations for default Grid (def: 2)

marg

logical, if TRUE display marginals (def: TRUE)

Data

matrix of data points, used to paint histograms on marginals and for grid

ngrid

number of grid points for density estimates (def: 50)

ndraw

number of draws to average Mcmc estimates over (def: 200)

...

standard graphics parameters

Author

Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.

Details

Typically, plot.bayesm.nmix will be invoked by a call to the generic plot function as in plot(object) where object is of class bayesm.nmix. These objects are lists of three components. The first component is an array of draws of mixture component probabilties. The second component is not used. The third is a lists of lists of lists with draws of each of the normal components.

plot.bayesm.nmix can also be used as a standard function, as in plot.bayesm.nmix(list).

See Also

rnmixGibbs, rhierMnlRwMixture, rhierLinearMixture, rDPGibbs

Examples

Run this code
## not run
# out = rnmixGibbs(Data, Prior, Mcmc)

## plot bivariate distributions for dimension 1,2; 3,4; and 1,3
# plot(out,bi.sel=list(c(1,2),c(3,4),c(1,3)))

Run the code above in your browser using DataLab