# [R] density estimates for fixed points

geir geirdb at hotmail.com
Tue Feb 16 12:36:17 CET 2010

```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)

The equally spaced vectors x and y returned are:

x = [1] 0.0000000 0.1111111 0.2222222
0.3333333 0.4444444 0.5555556 0.6666667
[8] 0.7777778 0.8888889 1.0000000
y = [1] 0.0000000 0.1111111 0.2222222
0.3333333 0.4444444 0.5555556 0.6666667
[8] 0.7777778 0.8888889 1.0000000

and the corresponding density estimates for any combination  of these
coordinates is a 10 x 10 matrix z.

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
combination of these coordinates). So that the output is f(0.7,0.3),
f(0.1,0.2), ... ,f(0.5,0.9), where "f" is the kernel estimator based on a
and b.

Geir

--
View this message in context: http://n4.nabble.com/density-estimates-for-fixed-points-tp1556081p1557231.html
Sent from the R help mailing list archive at Nabble.com.

```