plot.blca {BayesLCA}R Documentation

Plot Parameter Summaries, Density Estimates and Model Diagnostics for Bayesian Latent Class Analysis

Description

Five plots are selectable: a plot summarising item and class probability, a mosaic plot representing classification uncertainty, item probability density estimates, conditional class probability density estimates, and a diagnostics plot. The default setting is for the first four plots to be displayed, with the exception of plot.blca.em, which cannot produce density plots and so only produces the first two plots by default.

Usage

## S3 method for class 'blca'
plot(x, which = 1L, main = "", col1 = heat.colors(12), ...)

Arguments

x

An object of class blca.

which

Which plots to select. May be any subset of 1:5, with some exceptions. See ‘Details’.

main

An overall title for the plot: see title.

col1

Specifies a list of colours to be used by the heat map plot used when which = 1.image. Uses heat.colors by default, but several other choices are available. See the help files of image.plot, image and palette for details.

...

Further arguments to be passed onto the plotting devices. When which = 1, the plotting device is image.plot, mosaicplot in the case of which=2, and when which=3:5, plot.

Details

Not all plots are available for some object classes. If the object is of class blca.em, density plots (which = 3:4) are unavailable, and a warning is returned. Similarly, diagnostic plots (which = 5) for blca.boot objects are unavailable.

The available diagnostic plots differ depending on the class of the object in question. For blca.em and blca.vb objects, the plot is intended as visual aid to check whether the respective algorithms have converged, i.e., that the log-posterior or lower bound have ceased increasing after successive iterations. The main aim of the diagnostic plot for blca.gibbs objects is to visually check diagnostic measures such as mixing and burn-in, and also to assess whether label-switching has occurred, or been corrected for satisfactorily.

Currently, the colors used in a plot can only be specified directly for which = 1. For classification uncertainty (which = 2) and density plots (which = 3:4), each group is colored by the palette function so that Group g takes color palette()[g+1]. For the default settings, Group 1 will then be colored red, Group 2 green, and so on.

Author(s)

Arthur White

References

Arthur White, Thomas Brendan Murphy (2014). BayesLCA: An R Package for Bayesian Latent Class Analysis." Journal of Statistical Software, 61(13), 1-28. URL: http://www.jstatsoft.org/v61/i13/.

See Also

image.plot, mosaicplot.

Examples

type1 <- c(0.8, 0.8, 0.2, 0.2)
type2 <- c(0.2, 0.2, 0.8, 0.8)
x<- rlca(1000, rbind(type1,type2), c(0.6,0.4))

fit <- blca.em(x, 2)
plot(fit, which = 1:2) ## Parameter summary and classification uncertainty plots.

palette(rainbow(6)) ## Change color scheme
plot(fit, which = 2) 
palette("default") ## Restore default color scheme

fit2<- blca.vb(x,2)
par(mfrow = c(3,4))
plot(fit2, which = 3) ## Approximate density plots for item probability parameters.
par(mfrow = c(1,1))

[Package BayesLCA version 1.9 Index]