Learn R Programming

ks (version 1.5.10)

plot.kda.kde: Kernel discriminant analysis plot for 1- to 3-dimensional data

Description

Kernel discriminant analysis plot for 1- to 3-dimensional data.

Usage

## univariate
## S3 method for class 'kda.kde':
plot(x, y, y.group, prior.prob=NULL, xlim, ylim,
    xlab="x", ylab="Weighted density function", drawpoints=FALSE,
    col, ptcol, jitter=TRUE, ...)

## bivariate ## S3 method for class 'kda.kde': plot(x, y, y.group, prior.prob=NULL, cont=c(25,50,75), abs.cont, xlim, ylim, xlab, ylab, drawpoints=FALSE, drawlabels=TRUE, col, partcol, ptcol, ...)

## trivariate ## S3 method for class 'kda.kde': plot(x, y, y.group, prior.prob=NULL, cont=c(25,50,75), abs.cont, colors, alphavec, xlab, ylab, zlab, drawpoints=FALSE, size=3, ptcol="blue", ...)

Arguments

Value

  • Plot of 1-d and 2-d density estimates for discriminant analysis is sent to graphics window. Plot for 3-d is sent to RGL window.

synopsis

## S3 method for class 'kda.kde': plot(x, y, y.group, drawpoints=FALSE, ...)

Details

-- For 1-d plots: The partition induced by the discriminant analysis is plotted as rug plot (with the ticks inside the axes). If drawpoints=TRUE then the data points are plotted as a rug plot with the ticks outside the axes, their colour is controlled by ptcol. -- For 2-d plots: The partition classes are displayed using the colours in partcol. The default contours of the density estimate are 25%, 50%, 75% or cont=c(25,50,75) for highest density regions. See plot.kde for more details. -- For 3-d plots: Default contours are cont=c(25,50,75) for highest density regions. See plot.kde for more details. The colour of each group is colors. The transparency of each contour (within each group) is alphavec. Default range is 0.1 to 0.5.

-- If prior.prob is set to a particular value then this is used. The default is NULL which means that the sample proportions are used.

If y and y.group are missing then the training data points are plotted. Otherwise, the test data y are plotted.

References

Bowman, A.W. & Azzalini, A. (1997) Applied Smoothing Techniques for Data Analysis. Clarendon Press. Oxford. Simonoff, J. S., (1996) Smoothing Methods in Statistics. Springer-Verlag. New York.

See Also

kda.kde, kda

Examples

Run this code
library(MASS)
data(iris)

## univariate example
ir <- iris[,1]
ir.gr <- iris[,5]
hs <- hkda(x=ir, x.gr=ir.gr)
kda.fhat <- kda.kde(ir, ir.gr, hs=hs, xmin=3, xmax=9)
plot(kda.fhat, xlab="Sepal length")

## bivariate example
ir <- iris[,1:2]
ir.gr <- iris[,5]
H <- Hkda(ir, ir.gr, bw="plugin", pre="scale")
kda.fhat <- kda.kde(ir, ir.gr, Hs=H)
plot(kda.fhat, cont=0, partcol=4:6)
plot(kda.fhat, drawlabels=FALSE, drawpoints=TRUE)

## trivariate example
## colour indicates species, transparency indicates density heights

ir <- iris[,1:3]
ir.gr <- iris[,5] 
H <- Hkda(ir, ir.gr, bw="plugin", pre="scale")
kda.fhat <- kda.kde(ir, ir.gr, Hs=H)
plot(kda.fhat)

Run the code above in your browser using DataLab