Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.kda

Plot for kernel discriminant analysis


Description

Plot for kernel discriminant analysis for 1- to 3-dimensional data.

Usage

## S3 method for class 'kda'
plot(x, y, y.group, ...)

Arguments

x

object of class kda (output from kda)

y

matrix of test data points

y.group

vector of group labels for test data points

...

other graphics parameters:

rugsize

height of rug-like plot for partition classes (1-d)

prior.prob

vector of prior probabilities

col.part

vector of colours for partition classes (1-d, 2-d)

and those used in plot.kde

Details

For kda objects, the function headers for the different dimensional data are

## univariate
  plot(x, y, y.group, prior.prob=NULL, xlim, ylim, xlab="x",
     ylab="Weighted density function", drawpoints=FALSE, col, col.part,
     col.pt, lty, jitter=TRUE, rugsize, ...)

  ## bivariate
  plot(x, y, y.group, prior.prob=NULL, cont=c(25,50,75), abs.cont, 
     approx.cont=FALSE, xlim, ylim, xlab, ylab, drawpoints=FALSE, 
     drawlabels=TRUE, col, col.part, col.pt, ...)

  ## trivariate
  plot(x, y, y.group, prior.prob=NULL, cont=c(25,50,75), abs.cont, 
     approx.cont=FALSE, colors, alphavec, xlab, ylab, zlab, 
     drawpoints=FALSE, size=3, col.pt="blue", ...)

Value

Plots for 1-d and 2-d are sent to graphics window. Plot for 3-d is sent to graphics/RGL window.

See Also

Examples

library(MASS)
data(iris)

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

## bivariate example
ir <- iris[,1:2]
ir.gr <- iris[,5]
kda.fhat <- kda(x=ir, x.group=ir.gr)
plot(kda.fhat)

## trivariate example
ir <- iris[,1:3]
ir.gr <- iris[,5]
kda.fhat <- kda(x=ir, x.group=ir.gr)
plot(kda.fhat, alpha=0.05) 
   ## colour=species, transparency=density heights

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.