I have a data set comprising of three columns:

Column A: Position in $x$ direction ($x_p$)

Column B: Position in $y$ direction ($y_p$)

Column C: Mass ($m_p$) at position $(x_p,y_p)$

I am trying to represent this data in terms of PDF calculated via kernel density estimation. So far, I have been able to calculate the PDF using only two variables (i.e, position in $x$ and position in $y$) through the smooth kernel distribution functionality. The resulting PDF looks like this:


I would now like to include the third column into this PDF. So, mathematically I am interested in computing the following:

$$m(x,y)=\frac1{h^2}\sum_{p=1}^n m_p(x_p,y_p)K\left(\frac{x-x_p}{h},\frac{y-y_p}{h}\right)$$

where $p$ refers to the number of samples, $h$ is the bandwidth and $K$ is the smoothing kernel.

Could anyone please let me know if it possible to calculate such a PDF (or mass density here) using the SmoothKernelDensity functionality?

Any help would be much appreciated. Thank you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.