How do a perform a weighted, 2d kernel density estimation in R?
I would like to produce a kernel density estimation in R, and am somewhat bamboozled by all the different packages. I need to be able to:
- Specify weights
- Specify bandwidth size
- Specify bin size
How would you go about this? Bonus points for a code snippet开发者_运维技巧.
See also the ks package and the nice picture in Multivariate kernel density estimation.
Off course there's a number of packages. You should first decide which 2D kernel estimate you want. In the fields package you have a function smooth.2d, and you have the wonderful package of Brian Ripley, KernSmooth. The extra points for the code snippets you can give to the help files, I ain't going to copy them.
For these kind of questions, also try www.rseek.org.
精彩评论