I have two vectors S and V, and using the function kde2d
, I get the following plot of their joint density:
Using this data, is it possible to obtain an empirical estimate of the joint probability, in the form P(S[i],V[j]) ?
In the question How to find/estimate probability density function from density function in R it is suggested we use approxfun
to get the height of a value in a 1D KDE plot. Is there a way to extend this idea to 2 dimensions?
One approach would be to use bilinear interpolation of the grid returned by
kde2d
:Data: