Learn R Programming

rebmix (version 2.10.2)

plot-methods: Plots RNGMIX, REBMIX, RCLRMIX and RCLSMIX Output

Description

Plots true clusters if x equals "RNGMIX". Plots the REBMIX output depending on what argument if x equals "REBMIX". Plots predictive clusters if x equals "RCLRMIX". Wrongly clustered observations are plotted only if x@Zt is available. Plots predictive classes and wrongly classified observations if x equals "RCLSMIX".

Usage

# S4 method for RNGMIX,missing
plot(x, y, pos = 1, nrow = 1, ncol = 1, cex = 0.8,
     fg = "black", lty = "solid", lwd = 1, pty = "m", tcl = 0.5, 
     plot.cex = 0.8, plot.pch = 19, ...) 
# S4 method for REBMIX,missing
plot(x, y, pos = 1, what = c("density"),
     nrow = 1, ncol = 1, npts = 200, n = 200, cex = 0.8, fg = "black",
     lty = "solid", lwd = 1, pty = "m", tcl = 0.5, 
     plot.cex = 0.8, plot.pch = 19, contour.drawlabels = FALSE, 
     contour.labcex = 0.8, contour.method = "flattest", 
     contour.nlevels = 12, ...)
# S4 method for RCLRMIX,missing
plot(x, y, s = expression(c), nrow = 1, ncol = 1, cex = 0.8,
     fg = "black", lty = "solid", lwd = 1, pty = "m", tcl = 0.5, 
     plot.cex = 0.8, plot.pch = 19, ...)        
# S4 method for RCLSMIX,missing
plot(x, y, nrow = 1, ncol = 1, cex = 0.8,
     fg = "black", lty = "solid", lwd = 1, pty = "m", tcl = 0.5, 
     plot.cex = 0.8, plot.pch = 19, ...)     
## ... and for other signatures

Arguments

x

see Methods section below.

y

currently not used.

pos

a desired row number in x@summary or a desired element number in x@Dataset to be plotted. The default value is 1.

s

a desired number of clusters to be plotted. The default value is expression(c).

what

a character vector giving the plot types. One of "density" for probability density function, "marginal" for marginal probability density function, "IC" for information criterion depending on numbers of components \(c\), "logL" for log likelihood, "D" for total of positive relative deviations, "distribution" for distribution function or "K" for information criterion depending on bins \(v\) or numbers of nearest neighbours \(k\). The default value is "density".

nrow

a desired number of rows in which the empirical and predictive densities are to be plotted. The default value is 1.

ncol

a desired number of columns in which the empirical and predictive densities are to be plotted. The default value is 1.

npts

a number of points at which the predictive densities are to be plotted. The default value is 200.

n

a number of observations to be plotted. The default value is 200.

cex

a numerical value giving the amount by which the plotting text and symbols should be magnified relative to the default, see also par. The default value is 0.8.

fg

a colour used for things like axes and boxes around plots, see also par. The default value is "black".

lty

a line type, see also par. The default value is "solid".

lwd

a line width, see also par. The default value is 1.

pty

a character specifying the type of the plot region to be used. One of "s" generating a square plotting region or "m" generating the maximal plotting region. The default value is "m".

tcl

a length of tick marks as a fraction of the height of a line of the text, see also par. The default value is 0.5.

plot.cex

a numerical vector giving the amount by which plotting characters and symbols should be scaled relative to the default. It works as a multiple of par("cex"). NULL and NA are equivalent to 1.0. Note that this does not affect annotation, see also plot.default. The default value is 0.8.

plot.pch

a vector of plotting characters or symbols, see also points. The default value is 19.

contour.drawlabels

logical. The contours are labelled if TRUE. The default value is FALSE.

contour.labcex

cex for contour labelling. The default value is 0.8. This is an absolute size, not a multiple of par("cex").

contour.method

a character specifying where the labels will be located. The possible values are "simple", "edge" and default "flattest", see also contour.

contour.nlevels

a number of desired contour levels. The default value is 12.

further arguments to par.

Value

Returns (invisibly) a list containing graphical parameters par. Such a list can be passed as an argument to par to restore the parameter values.

Methods

signature(x = "RNGMIX", y = "missing")

an object of class RNGMIX.

signature(x = "RNGMVNORM", y = "missing")

an object of class RNGMVNORM.

signature(x = "REBMIX", y = "missing")

an object of class REBMIX.

signature(x = "REBMVNORM", y = "missing")

an object of class REBMVNORM.

signature(x = "RCLRMIX", y = "missing")

an object of class RCLRMIX.

signature(x = "RCLRMVNORM", y = "missing")

an object of class RCLRMVNORM.

signature(x = "RCLSMIX", y = "missing")

an object of class RCLSMIX.

signature(x = "RCLSMVNORM", y = "missing")

an object of class RCLSMVNORM.

References

C. M. Bishop. Neural Networks for Pattern Recognition. Clarendon Press, Oxford, 1995.

Examples

Run this code
# NOT RUN {
devAskNewPage(ask = TRUE)

data("wine")

colnames(wine)

# Remove Cultivar column from wine dataset.

winecolnames <- !(colnames(wine) %in% "Cultivar")

wine <- wine[, winecolnames]

# Determine number of dimensions d and wine dataset size n.

d <- ncol(wine) 
n <- nrow(wine)

# Estimate number of components, component weights and component parameters.

Sturges <- as.integer(1 + log2(n)) # Minimum v follows Sturges rule.
RootN <- as.integer(2 * n^0.5) # Maximum v follows RootN rule.

K <- c(floor(Sturges^(1/13)), ceiling(RootN^(1/13)))

wineest <- REBMIX(model = "REBMVNORM",
  Dataset = list(wine = wine), 
  Preprocessing = "Parzen window", 
  Criterion = "ICL-BIC", 
  pdf = rep("normal", d), 
  K = K[1]:K[2])

# Plot finite mixture.

plot(wineest, what = c("density", "IC", "logL", "D"),
  nrow = 2, ncol = 2, pty = "s")
# }

Run the code above in your browser using DataLab