Solved – Testing for Poisson process

goodness of fitpoisson process

I have some discrete times of events and I would like to do a test to see if they are likely to have come from a homogeneous Poisson process.

From this pdf, I see:

REMARK 6.3 ( TESTING POISSON ) The above theorem may also be used to test the hypothesis that a given counting process is a Poisson process. This may be done by observing the process for a fixed time $t$. If in this time period we observed n occurrences and if the process is Poisson, then the unordered occurrence times would be independently and uniformly distributed on $(0, t]$. Hence, we may test if the process is Poisson by testing the hypothesis that the n occurrence times come from a uniform $(0, t]$ population. This may be done by standard statistical procedures such as the Kolmogorov-Smirov test.

However I don't quite understand what to do in practice. Say my times are

[1, 7, 18, 22, 41, 43, 66, 73, 86, 92]

and the time interval I chose was from $1$ to $100$. How exactly do I do the Kolmogorov-Smirov test in this example?

Best Answer

If you like Python / numpy / matplotlib, here is a small example demonstrating Remark 6.3:

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import scipy.stats
# interval between two events is distributed as an exponential
>>> delta_t = scipy.stats.expon.rvs(size=10000)
>>> t = np.cumsum(delta_t)
>>> plt.hist(t/t.max(), 200)
>>> plt.show() # see how much uniform it is
# perform the ks test (second value returned is the p-value)
>>> scipy.stats.kstest(t/t.max(), 'uniform')
Related Question