Re: [R] density estimates for fixed points

2010-02-16 Thread geir
But since you don't, why not calculate the density directly for each point (e.g., in a loop). The formula is simple enough: mean(dnorm(x-gx,sd=h1)*dnorm(y-gy,sd=h2)) yes, this was my initial thought, and it works. (But i was hoping kde2d or some similar function could do it faster). I'l try

Re: [R] density estimates for fixed points

2010-02-16 Thread Karl Ove Hufthammer
On Tue, 16 Feb 2010 03:36:17 -0800 (PST) geir wrote: > I want the density estimates for the points in a k x 2 matrix like for > example > > A=[(0,7,0.3),(0.1,0.2),...,(0.5,0.9)]^T > > which is not equally spaced, (and i do not need the density of every > combin

Re: [R] density estimates for fixed points

2010-02-16 Thread geir
Trafim Vanishek posted a similar problem: "Joint density approximation?" (without any solution for kde2d). Here is an example to illustrate my problem. Originally data is for example: a=runif(10) (yes, the number of data should be larger) b=runif(10) c=kde2d(a,b,n=10,lims=c(0,1,0,1)) attach(c

Re: [R] density estimates for fixed points

2010-02-15 Thread David Winsemius
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

Re: [R] density estimates for fixed points

2010-02-15 Thread geir
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

Re: [R] density estimates for fixed points

2010-02-15 Thread David Winsemius
On Feb 15, 2010, at 8:08 AM, geir wrote: Problem: Based on a n x 2 data matrix i want a kernel estimate of the bivariate density. However, i also wish to specify wich points the density should be calculated at. I can offcourse just write the full kernel density estimate as a R- code, but

[R] density estimates for fixed points

2010-02-15 Thread geir
Problem: Based on a n x 2 data matrix i want a kernel estimate of the bivariate density. However, i also wish to specify wich points the density should be calculated at. I can offcourse just write the full kernel density estimate as a R-code, but surely there must already exist some package for