Dear list,
this may be a mathematical question, but the 3d and 2d kernel density
values, estimated by kde3d(){misc3d} and kde2d(){MASS} shouldn't sum 1 when
multiplied by delta.x,delta.y,delta.z , as integral[kernel(x)*dx]=1?
I know the above question is true as another help mail've shown out:
v1=runif(50)
v2=runif(50)
v3=runif(50)
#1d kernel
k1d=density(v1)
sum(k1d$y*(k1d$x[2]-k1d$x[1])) #x,y and zstands for the coordinates of the
equally space points generated by density(). each point has its kernel
value calculated.
[1] 1.000798
But this should not continue to be true in kernels with 2 or 3 dimensions?
#2d kernel
k2d=kde2d(v1,v2)
sum(k2d$z*(k2d$x[2]-k2d$x[1])*(k2d$y[2]-k2d$y[1]))
0.7809078
#3d kernel
kernel=kde3d(x,y,z)
sum(kernel$d*(k2d$x[2]-k2d$x[1])*(k2d$y[2]-k2d$y[1])*(k2d$z[2]-k2d$z[1]))
[1] 0.6995786
I'm sure this is the lack of knowledge from my part, but how do i can
assure that the density values always sum 1 (so, i can move to the next
step, calculate the volume area that encompasses x% of the probability)
thanks in advance,
Jorge
[[alternative HTML version deleted]]