0
$\begingroup$

So, I have a scenario where I want to model the probability distribution / density of random displacement using kernel density, but having trouble finding resources on how the math works. I'm working in R, but, this is probably agnostic to platform. Thanks in advance for any help! I did search on stackoverflow for answers - but couldn't find anything. Hopefully it's not just poor searching skills.

Essentially - for a given (single) point, there is displacement at a random angle for a uniform random distance between 0 and 5 kilometers. This means that the number of points displaced between 0 and 1km would be equal to the number of points displaced between 4 and 5km. However, density is higher as you get closer to the center, and is truncated at 5000 meters.

This results in a pattern like the one below (although this example truncated at boundaries). I'm looking to create a raster map where the value of each pixel would be proportional to the probability of a point landing in that spot. This seems like a calculus issue, but my calc is a little rusty.

Which kernel would I use for this? Is this Gaussian, triangular, something else/custom?

Visualization of density

Ultimately, I want to calculate a kernel density that looks something like this. This uses a triangular kernel, but that doesn't seem quite right, mathematically. Feels like 2pi r should be in the kernel density formula somewhere.

kernel example

$\endgroup$
5
  • $\begingroup$ It's not quite clear what problem you are trying to solve. KDE is used to estimate an unknown distr. from samples, but you claim to know what the distribution is exactly, already. Or do you want to to assume that some real data is a mixture of these 10km-wide radii uniform distributions? $\endgroup$
    – jwimberley
    Commented Jun 13, 2022 at 3:02
  • $\begingroup$ Would you explain how the points are obtained? For estimating a bivariate probability distribution usually a random sample from that distribution is required. My limited understanding of "displacement" is that one starts on a regular grid and then displaces the grid point by some function (which may include a random component). It appears that you want a smooth surface that approximates the density of the sample points (points per square kilometer) as opposed to estimating a probability density function (which would require points being selected by some random process). $\endgroup$
    – JimB
    Commented Jun 13, 2022 at 4:22
  • $\begingroup$ Thanks @JimB and jwimberley for taking the time to look at this! JimB, that is correct - I would like a smooth surface that is calculated based on the probability that cell will contain a displaced point. I start with a random point. The algorithm for displacement of points is random angle between 0 & 360 degrees, and random distance between 0 and 5 kilometers. This seems like something I should be able to calculate, rather than simulate - and I think I can make that calculation pretty efficient compared to the simulation. $\endgroup$ Commented Jun 13, 2022 at 4:27
  • $\begingroup$ OK. You talk about a single random point. How do you get the zillion points shown in the figure? Oh, wait. You start with a single location and then generate the zillion points by the algorithm you describe? $\endgroup$
    – JimB
    Commented Jun 13, 2022 at 4:34
  • $\begingroup$ Yeah! That's right, start with a point, and the cloud is generated around it. For some (unecessary) context, I'm working with survey data that is randomly displaced according to this algorithm, and I intend to run some analysis based on the probability of where the 'true' point is. Since the displacement is symmetric, I'm pretty sure that the density of the probability of getting to the true point from the displaced location would be the same as getting from the displaced location to the true location. $\endgroup$ Commented Jun 13, 2022 at 4:46

1 Answer 1

1
$\begingroup$

I think I now understand how you generate the sample points in a simulation. However, it seems that all parameters are known except possibly the location of the center point. So I'm not understanding how a particular center point is chosen nor can I envision any real data that might follow such a distribution. (But maybe that's just me.)

In any event, if the center point is at (0,0) (in rectangular coordinates), the radius has a uniform distribution on (0,5) and the random angle has a uniform distribution on (0, 2*Pi), then the joint probability density in rectangular coordinates is

$$f(x,y)=\frac{1}{10 \pi \sqrt{x^2+y^2}}$$

when $x^2+y^2\leq 5^2$ and zero otherwise. No need to estimate the joint distribution from a sample using a kernel density estimate (other than as a check on the above formula).

Joint probability density function

So if you had a random sample (i.e., real-live data) from such a joint distribution (which, again, I'm just not seeing is possible), the only parameters to be estimated are the center points.

Requested applications:

  1. 95% of the time a displaced point will be no farther than 4.75 km. That number is simply 0.95*5. Therefore, a 95% confidence region is a circle around the observed location with radius 4.75 km. (A 95% confidence region will in repeated sampling contain the original point 95% of the time. That is not a probability as any particular confidence region either will or won't contain the original point.)

  2. The probability of a displaced point being in a dx-by-dy rectangle centered at (x0, y0) is found by integrating the pdf over that rectangle. That almost certainly needs to be done numerically. Using Mathematica here is an example:

     x0 = 1;
     y0 = 3;
     dx = 50/1000;
     dy = 50/1000;
    
     NIntegrate[Boole[Abs[x - x0] < dx/2 && Abs[y - y0] < dy/2] 1/(10 Pi Sqrt[x^2 + y^2]),
       {x, y} \[Element] Region[Disk[{0, 0}, 5]]]
     (* 0.000640804 *)
    

If (x0, y0) isn't too close to (0,0), and dx and dy are much smaller than 5 km, then the following gives a reasonable approximation:

(dx dy)/(10 Pi Sqrt[x0^2 + y0^2])
$\endgroup$
8
  • $\begingroup$ This is awesome, that shape looks right! Thanks! I'm guessing the 10 in the bottom is 2* the radius? So to answer your question about a real-life scenario... I'll give a quick description. Basically, there is a massive household survey called the Demographic and Health Survey done in about 80 countries. They collect GPS data of household clusters, but displace them according to that formula to maintain anonymity. I have an interest in determining both the effect of the displacement on spatial estimates, and on estimating the probability of the true location given the displaced location $\endgroup$ Commented Jun 14, 2022 at 20:44
  • $\begingroup$ Which, because this distribution is symmetric, I believe the probability of getting from the true location to the false location should be the same as getting from the false location to the true location. $\endgroup$ Commented Jun 14, 2022 at 20:47
  • $\begingroup$ Although it ends up being the same $10\pi$ in the denominator, the pdf for the radius is $1/5$ and the pdf for the angle is $1/(2\pi)$ which means the constant in the denominator becomes $5 \times 2\pi=10\pi$. But there is an issue with your use of the term "probability". The function given is the probability density function and NOT a probability. If you want a "probability" then we need to find the volume of that function under a particular area (whether that be a circular area or a rectangular area). $\endgroup$
    – JimB
    Commented Jun 14, 2022 at 23:02
  • $\begingroup$ Appreciate it, thanks! $\endgroup$ Commented Jun 14, 2022 at 23:31
  • $\begingroup$ I do ultimately want to find the probability (using the pdf), but I may see how far I can get on it. $\endgroup$ Commented Jun 14, 2022 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.