Learn R Programming

rebmix (version 2.6.1)

plot.REBMIX: Plots Univariate or Multivariate REBMIX Output

Description

Takes an object of class REBMIX and plots empirical and predictive univariate $d = 1$ mixture densities or pairs of empirical and predictive bivariate marginal mixture densities for $d > 1$. The empirical densities follow the histogram, Parzen window or k-nearest neighbour approach.

Usage

## S3 method for class 'REBMIX':
plot(x, pos = 1, what = c("density"),
     nrow = 1, ncol = 1, npts = 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, ...)

Arguments

x
an object of class REBMIX.
pos
a desired row number in x$summary to be ploted. The default value is 1.
what
a character vector, giving the plot types. One of "density", "marginal", "c", "IC", "logL", "D" or "distribution". The default value is "density".
nrow
a desired number of rows in which the empirical and predictive densities are to be ploted. The default value is 1.
ncol
a desired number of columns in which the empirical and predictive densities are to be ploted. The default value is 1.
npts
a number of points at which the predictive densities are to be ploted. 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
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 string 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

  • par is returned in an invisible named list. Such a list can be passed as an argument to par to restore the parameter values.

References

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

Examples

Run this code
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.

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

## Number of classes or nearest neighbours to be processed.

N <- as.integer(log(v[2] / (v[1] + 1)) / log(1 + 1 / v[1]))

K <- c(v[1], as.integer((v[1] + 1) * (1 + 1 / v[1])^(0:N)), v[2])

wineest <- REBMIX(Dataset = list(wine = wine), 
  Preprocessing = "Parzen window", 
  Criterion = "ICL-BIC", 
  Variables = rep("continuous", d),
  pdf = rep("normal", d), 
  K = K)

## Plot finite mixture.

plot(wineest, what = c("density", "marginal", "c", "IC", "logL", "D", 
  "distribution"), nrow = 4, ncol = 5, npts = 500, pty = "s")

Run the code above in your browser using DataLab