[R] density estimates for fixed points

David Winsemius dwinsemius at comcast.net
Mon Feb 15 17:44:01 CET 2010

On Feb 15, 2010, at 10:02 AM, geir wrote:

> Sorry, i did indeed mean function - not package.
> kde2d lets you determine the grid - you choose "n" and "lims", which  
> gives
> you and n x n matrix for which the density is estimated (Seems like  
> the
> output is meant for graphical purposes). But i have a matrix  
> consisting of
> points (x,y) where i want the corresponding density estimates f(x,y).

Exactly the sort of data situation that kde2d expects.

> i cant
> see how i can do this using "n" and "lims".

As far as I can tell kde2D does exactly what you asked. (And there  
were 150+ other citations that might be worth looking at with my  
second suggestion, if I have have misunderstood your request.)

My suggestion would be to work through the examples on the kde2d help  
page, examine the objects created (since "x" and "y" will then have  
two meanings in their respective objects) and then come back if you  
are still confused.  When you do come back, you should bring with you  
a sample dataset for testing purposes and show an example of how you  
think your output should look.

> I have tried to search for simil problems, but so fare i havent  
> found any
> (may be because its too trivial?).
> -- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list