[R] How to get the number of modes using kde2d

Patrick Wang pwang at berkeley.edu
Thu Jun 7 17:18:40 CEST 2007


Hi,

The silverman's paper introduction offer how to find a mode for one
dimensional data based
on software

http://www.stanford.edu/~kasparr/software/silverman.r,

for two dimensional data I use kde2d to smooth it out first,  then I get a
matrix of densities for all the X(one dimension) cross Y(another
dimension).


I sort X and Y first before I pass the values to kde2d(x, y, c(hx, hy)),
the persp shape changes

Does anyone know how to get the modes out of the two dimensional data
programmatically.

Also if I want to get the minumum of X, Y with modes =2, is the solution
unique?

Thanks
pat



More information about the R-help mailing list