Learn R Programming

ks (version 1.8.11)

kda.kde: Kernel density estimate for discriminant analysis for multivariate data

Description

Kernel density estimate for discriminant analysis for 1- to 6-dimensional data.

Usage

kda.kde(x, x.group, Hs, hs, prior.prob=NULL, gridsize, xmin, xmax,
    supp=3.7, eval.points=NULL, binned=FALSE, bgridsize, w,
    compute.cont=FALSE, approx.cont=TRUE)

Arguments

x
matrix of data values
x.group
vector of group labels
Hs
bandwidth matrix(ces)
hs
scalar bandwidth(s)
prior.prob
vector of prior probabilities
gridsize
vector of number of grid points
xmin
vector of minimum values for grid
xmax
vector of maximum values for grid
supp
effective support for standard normal.
eval.points
points at which density estimate is evaluated
binned
flag for binned estimation. Default is FALSE.
bgridsize
vector of binning grid sizes
w
vector of weights (non-negative and sum is equal to sample size). Default is a vector of all ones.
compute.cont
flag for computing probability contour levels from 1% to 99%. Default is FALSE.
approx.cont
flag for computing approximate probability contour levels. Default is TRUE.

Value

  • A density estimate for discriminant analysis is an object of class kda.kde:
  • xdata points - same as input
  • x.groupgroup labels - same as input
  • eval.pointspoints that density estimate is evaluated at
  • estimatedensity estimate at eval.points
  • prior.probprior probabilities
  • Hbandwidth matrices (>1-d only) or
  • hbandwidths (1-d only)
  • contprobability contour levels
  • wweights

Details

If you have prior probabilities then set prior.prob to these. Otherwise the default is prior.prob=NULL i.e. use the sample proportions as estimates of the prior probabilities. For details of the other parameters, see kde.

See Also

plot.kda.kde

Examples

Run this code
## trivariate example
## colour indicates species, transparency indicates density heights
library(MASS)
data(iris)
ir <- iris[,1:3]
ir.gr <- iris[,5] 
H <- Hkda(ir, ir.gr, bw="plugin", pilot="dscalar")
kda.fhat <- kda.kde(ir, ir.gr, Hs=H)
plot(kda.fhat)

Run the code above in your browser using DataLab