## Point process simulation

Point processes are mathematical objects that can represent a collection of randomly located points on some underlying space. There is a rich range of these random objects, and, depending on the type of points process, there are various steps and methods used to sample, simulate or generate them on computers. (I use these three terms somewhat interchangeably.) This is the first of a series of posts in which I will describe how to simulate some of the more tractable point processes defined on bounded regions of two-dimensional Euclidean space.

### Finite point processes

A general family of point processes are the finite point processes, which are, as the name suggests, simply point processes with the property that the total number of points is finite with probability one. Usually it is assumed that both the number of points and the positions of these points are random. These two properties give a natural way to describe and to study point processes mathematically, while also giving an intuitive way to simulate them on computers.

If the number and locations of points can be simulated sequentially, such that the number of points is naturally generated first followed by the placing of the points, then the simulation process is usually easier. Such a point process is a good place to start for an example.

### Simple example — Binomial point process

The binomial point process is arguably the simplest point process. The number of points is non-random number $$n$$, so we do not need to generate it as it is given. For a binomial point process, the $$n$$ points are uniformly and independently located in some bounded region. This means that all the points can be positioned in parallel.

For example, to simulate $$n$$ points of a binomial point process on the unit square $$[0,1]\times[0,1]$$, we just need to independently sample the $$x$$ and $$y$$ coordinates of the points from a uniform distribution on the unit interval $$[0,1]$$. In other words, we randomly generate or sample two sets of $$n$$ uniform random variables corresponding to the $$x$$ and $$y$$ of the $$n$$ points.

To sample on a general $$w \times h$$ rectangle, we just need need to multiple the random $$x$$ and $$y$$ values by the respective dimensions of the rectangle $$w$$ and $$h$$. Of course the rectangle can also be shifted up or down by adding or subtracting $$x$$ and $$y$$ values appropriately.

Essentially every programming language has a function for generating uniform random numbers because it is the default random number generator, which all the other random number generators build off, by employing various techniques like applying transformations. In MATLAB, R and Python, it is respectively rand, runif and scipy.stats.uniform, which all generate uniform points on the open interval $$(0,1)$$.

### Code

Here are some pieces of code that illustrates how to simulate a binomial point process on the unit square.

MATLAB

n=10; %number of points

%Simulate binomial point process
xx=rand(n,1);%x coordinates of binomial points
yy=rand(n,1);%y coordinates of binomial points

%Plotting
scatter(xx,yy);
xlabel('x');ylabel('y');


R

n=10; #number of points
#Simulate Binomial point process
xx=runif(n);#x coordinates of binomial points
yy=runif(n);#y coordinates of binomial points

#Plotting
plot(xx,yy,'p',xlab='x',ylab='y',col='blue');


Python

import numpy as np
import scipy
import matplotlib.pyplot as plt

n=10; #number of points

#Simulate binomial point process
xx = scipy.stats.uniform.rvs(0,1,((n,1)))#x coordinates of binomial points
yy = scipy.stats.uniform.rvs(0,1,((n,1)))#y coordinates of binomial points

#Plotting
plt.scatter(xx,yy, edgecolor='b', facecolor='none', alpha=0.5 )
plt.xlabel(&amp;quot;x&amp;quot;);plt.ylabel(&amp;quot;y&amp;quot;)


### More complicated point processes

The binomial point process is very simple. One way to have a more complicated point process is to have a random number of points. The binomial point process is obtained from conditioning on the number of points of a homogeneous Poisson point process, implying its simulation builds directly off the binomial point process. The homogeneous Poisson point process is arguably the most used point process, and it is then in turned used to construct even more complicated points processes. This suggests that the homogeneous Poisson point process is the next point process we should try to simulate.