[R] k-Nearest Neighbour density estimation

Ralf.Kloessinger@student.fh-nuernberg.de Ralf.Kloessinger at student.fh-nuernberg.de
Wed Apr 17 01:51:53 CEST 2002


I search for a function which does a k-Nearest Neighbour density estimation.
I found the package class with the function knn, but this is only an classifier.

What i need is:
I have a file with one variable which is a score with the range between 0 and 100. The scores occur often, so that we have a histogram. The histogram has gaps, especially at the scores higher than 50. 
What i like to do is to remap the histogram to fill up the gaps. Than using the knn function: p(s)=(k-1)/N*V(x) to get the density.

score: histogram: remaped:
0      2345       2345
1      5678       5678
2      6789       6789
3      0          14 
4      0          9999  
5      9
6      5
7      9999

Thank you for your help and your time.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list