Wolfram Language

Extended Probability & Statistics

Sample from a Poisson Point Process

A Poisson point process is a generalization of the one-dimensional Poisson process to a multidimensional case. A homogeneous Poisson point process in geometric regions can be sampled by using RandomPoint.

Create a country polygon.

In[1]:=
Click for copyable input
region = DiscretizeGraphics[CountryData["Mexico", "Polygon"], ImageSize -> Medium]
Out[1]=

Define a function that does the sampling of the Poisson point process with three arguments: region, intensity, and number of realizations.

In[2]:=
Click for copyable input
ppp[region_, intensity_, n_] := Module[{nlist, pts}, nlist = RandomVariate[PoissonDistribution[intensity RegionMeasure[region]], n]; pts = RandomPoint[region, Total[nlist]]; nlist = Accumulate[nlist]; nlist = Transpose[{Prepend[Most[nlist] + 1, 1], nlist}]; Table[Take[pts, ind], {ind, nlist}] ]

Generate a realization of the Poisson point process in the country polygon with intensity 0.5 and visualize it with Graphics.

In[3]:=
Click for copyable input
intensity = 0.5; sample = ppp[region, intensity, 1];
In[4]:=
Click for copyable input
Show[region, Graphics[{Black, Point @@ sample}]]
Out[4]=

Generate 104 samples from the same process. The total number of points in each sample satisfies PoissonDistribution, with the mean equal to intensity times the area of the region.

In[5]:=
Click for copyable input
samples = ppp[region, intensity, 10^4]; counts = Length /@ samples;
In[6]:=
Click for copyable input
htd = PearsonChiSquareTest[counts, PoissonDistribution[intensity RegionMeasure[region]], "HypothesisTestData"];
In[7]:=
Click for copyable input
htd["TestDataTable"]
Out[7]=
In[8]:=
Click for copyable input
htd["TestConclusion"]
Out[8]=

The number of points in any subregion is also Poisson distributed. Here, this is examined with a disk that lies within the polygon, and the number of points in it is counted.

In[9]:=
Click for copyable input
disk1 = Disk[{-107, 28}, 1.5]; Show[region, Graphics[{Red, disk1}]]
Out[9]=
In[10]:=
Click for copyable input
memberfun1 = RegionMember[disk1]; counts1 = Table[Total[Boole[memberfun1[pts]]], {pts, samples}];

Perform PearsonChiSquareTest on the number of counts with a Poisson distribution.

In[11]:=
Click for copyable input
htd = PearsonChiSquareTest[counts1, PoissonDistribution[intensity RegionMeasure[disk1]], "HypothesisTestData"];
In[12]:=
Click for copyable input
htd["TestDataTable"]
Out[12]=
In[13]:=
Click for copyable input
htd["TestConclusion"]
Out[13]=

The number of points in any disjoint subregions is independent. Here, the number of points in two disjoint disks is counted, and the SpearmanRankTest is performed.

In[14]:=
Click for copyable input
disk2 = Disk[{-100, 20}, 1.3]; Show[region, Graphics[{Red, disk1, Blue, disk2}]]
Out[14]=
In[15]:=
Click for copyable input
memberfun2 = RegionMember[disk2]; counts2 = Table[Total[Boole[memberfun2[pts]]], {pts, samples}];
In[16]:=
Click for copyable input
htd = SpearmanRankTest[counts1, counts2, "HypothesisTestData"];
In[17]:=
Click for copyable input
htd["TestDataTable"]
Out[17]=
In[18]:=
Click for copyable input
htd["TestConclusion"]
Out[18]=

Related Examples

de es fr ja ko pt-br ru zh