4
$\begingroup$

I know there is an R spatstat function to generate a ppp (Poisson Point Process), but I'm working in python, and I am not clear what spatstat.ppp is doing behind the scenes.

If I generate a an array of ordered pairs of random x's and random y's (within the spatial extent), will that be (or how will it differ from) a ppp? Should the x's and y's be chosen based on a Poisson distribution (np.random.poisson)?

I've read the spatstat documentation on ppp and the wikipedia pages on Poisson point process and Poisson distribution, but I just have no knack for statistics. Is it the number of events that is random? Or where they fall in space?

Thanks for any help you can give.
(ps -- this problem is entirely spatial, there is no time dimension.)

$\endgroup$
  • $\begingroup$ I don't see a spatstat function in R. There's a package called "spatstat". It seems to have a function called ppp (spatstat::ppp), though (and a class called ppp). What other functions are you calling? Have you checked the spatstat vignettes or the code? $\endgroup$ – Glen_b -Reinstate Monica Feb 5 '14 at 0:19
  • $\begingroup$ Sorry, my bad grammar, using spatstat as an adjective. I meant it in the way one would say an R function. I guess I have read the vignette; how can one see the code? $\endgroup$ – J Kelly Feb 5 '14 at 3:12
  • $\begingroup$ stackoverflow.com/search?q=[r]+see+source+code -- several different ways for different things (it's a bit different for S3 and S4 classes for example); plus anything on CRAN should have the actual source code it was built from. Actually, here you go, I just went and found the tarball $\endgroup$ – Glen_b -Reinstate Monica Feb 5 '14 at 4:19
  • $\begingroup$ Wow, thanks, that is going to be interesting reading. I looked at ppp.R and it seems to have no random component at all. It seems to take any set of x,y you want to give it, even a perfectly regular grid. So why "Poisson"? <shrug> Maybe it doesn't matter how my random points are distributed. $\endgroup$ – J Kelly Feb 5 '14 at 18:58
  • $\begingroup$ I gather the point is that it's not simulation or any other form of creating data at all. It doesn't ever consider whether the data is Poisson. Its purpose is simply to take point-pattern data (however obtained) and turn it into a ppp-object (on which other functions in spatstat can then operate). It's no more responsible for what data you give it than data.frame is, and its purpose is analogous to a call to data.frame or any other function to turn data into an object of a particular class. $\endgroup$ – Glen_b -Reinstate Monica Feb 5 '14 at 23:23
1
$\begingroup$

The number of points in any given region is Poisson distributed, with mean equal to the integral of the rate function over that region. For example, if you have a homogeneous PP on the unit square, with rate function $\lambda(x,y)=\lambda$ (i.e. constant because it's homogeneous) then you could sample points as

  1. Sample $N \sim Poisson(\lambda) $
  2. Sample $N$ points uniformly on the unit square, i.e. $x,y \sim^{iid} U[0,1]$
$\endgroup$
  • $\begingroup$ Sorry, I don't understand your answer. I am not trying to be difficult or dense, but how is the "number of points in a given region Poisson distributed"? I mean, there is an infinite assortment of ways points can be in a region. My intuition says that some of those ways would be Poisson distributed and some wouldn't be. You could maybe help by explaining why we don't treat the points in, say, 2D space as bi-variate normally distributed, for example. $\endgroup$ – J Kelly Feb 5 '14 at 3:23
  • $\begingroup$ You could make it so the points are bivariate normal distributed by using a rate function proportion to the bivariate normal density. But how would you know how many of these points to sample? By first sampling that number from a Poisson with mean equal to the integral of your rate function. What rate function and spatial extent do you have? $\endgroup$ – daknowles Feb 6 '14 at 3:41
  • $\begingroup$ As an exercise, constant rate, though it's not. I have 1000 measured data points, clustered along rivers, so there is an underlying weighted surface. I'm trying to write a script like spatstat.Gest: compare a CDF of the nearest nbr distances with that of a random set of pts, but my "random" x,y's may not be random in the right (Poisson) way. I just can't locate the Poisson randomness; if x and y were Poisson distributed, wouldn't they cluster around the centroid? The distribution must be around the mean intensity at each pixel, but it's a slippery concept; I can't pin it down. $\endgroup$ – J Kelly Feb 6 '14 at 16:51

Your Answer

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

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