Learn R Programming

ks (version 1.3.4)

compare, compare.kda.diag.cv, compare.kda.cv, compare.pda.cv: Comparisons for kernel and parametric discriminant analysis

Description

Comparisons for kernel and parametric discriminant analysis.

Usage

compare(x.group, est.group)
compare.kda.cv(x, x.group, bw="plugin", prior.prob=NULL, Hstart, ...)
compare.kda.diag.cv(x, x.group, bw="plugin", prior.prob=NULL, ...)
compare.pda.cv(x, x.group, type="quad", prior.prob=NULL)

Arguments

x
matrix of training data values
x.group
vector of group labels for training data
est.group
vector of estimated group labels
bw
"plugin" = plug-in, "lscv" = LSCV, "scv" = SCV
Hstart
(stacked) matrix of initial bandwidth matrices
prior.prob
vector of prior probabilities
type
"line" = linear discriminant, "quad" = quadratic discriminant
...
other optional parameters for bandwidth selection, see Hpi, Hlscv, Hscv

Value

  • The function compare creates a comparison between the true group labels x.group and the estimated ones est.group. It returns a list with fields
  • crosscross-classification table with the rows indicating the true group and the columns the estimated group
  • errormisclassification rate (MR)
  • In the case where we have test data that is independent of the training data, then $$\textrm{MR} = \frac{\textrm{number of points wrongly classified}}{\textrm{total number of points}}$$ In the case where we don't have independent test data e.g. we are classifying the training data set, then the cross validated estimate is more appropriate. See Silverman (1986). These are implemented as for kernel discriminant analysis as compare.kda.cv (full bandwidth selectors) and compare.kda.diag.cv (for diagonal bandwidth selectors), and compare.pda.cv for parametric discriminant analysis.

Details

If you have prior probabilities then set prior.prob to these. Otherwise the default is to use the sample proportions as estimates of the prior probabilities.

The parametric discriminant analysers use the code from the MASS library namely lda and qda for linear and quadratic discriminants.

References

Silverman, B. W. (1986) Data Analysis for Statistics and Data Analysis. Chapman & Hall. London. Simonoff, J. S. (1996) Smoothing Methods in Statistics. Springer-Verlag. New York

Venables, W.N. & Ripley, B.D. (1997) Modern Applied Statistics with S-PLUS. Springer-Verlag. New York.

See Also

kda.kde, pda.pde

Examples

Run this code
### bivariate example - restricted iris dataset  
library(MASS)
data(iris)
ir <- iris[,c(1,2)]
ir.gr <- iris[,5]

compare.kda.cv(ir, ir.gr, bw="plug-in", pilot="samse")
compare.pda.cv(ir, ir.gr, type="line")
compare.pda.cv(ir, ir.gr, type="quad")

Run the code above in your browser using DataLab