# Count data fitting with Nonhomogeneous Poisson process

Following is count data needed to model with a nonhomogeneous Poisson process (NHPP).

For each row-wise e.g. 8:15-8:30, every 12 intervals of 15 minutes size and 15 days of data collected. I have already fitted each row-wise data with other distributions.

But now the problem is to fit the same data with NHPP. I tried fitting following data as,

data = {{4, 13, 23, 0, 1, 3, 10, 17, 26, 20, 3, 0, 30, 0, 2}, {27, 2, 18, 15,
24, 19, 3, 7, 13, 21, 14, 3, 6, 8, 22}, {28, 4, 23, 10, 26, 13, 3,
15, 9, 22, 16, 25, 5, 17, 21}, {24, 24, 26, 9, 25, 11, 23, 22, 11,
16, 19, 3, 17, 7, 17}, {3, 7, 26, 21, 29, 1, 0, 27, 11, 28, 22, 1,
27, 1, 14}, {10, 18, 13, 19, 18, 1, 27, 16, 28, 1, 29, 24, 10, 20,
15}, {25, 6, 5, 9, 21, 26, 25, 5, 14, 1, 28, 8, 28, 18, 18}, {7, 17,
9, 30, 26, 16, 21, 27, 12, 17, 20, 26, 30, 12, 24}, {14, 16, 3, 27,
19, 13, 8, 30, 8, 15, 4, 3, 20, 27, 0}, {23, 15, 28, 9, 29, 7, 30,
30, 21, 30, 27, 29, 23, 0, 19}, {4, 0, 9, 6, 18, 19, 1, 23, 1, 12,
12, 17, 6, 27, 29}, {22, 22, 9, 21, 1, 4, 25, 8, 30, 7, 20, 11, 14,
26, 22}}

1. First by estimating the arrival rate in each interval with
rate = Join[{0,Round[(Total@data[[#]]/(15*15))&/Range[12],0.01]}]//Flatten
2. Here i considering the interval into min form {0, 15, 30,...,180}, by int = Table[15*i, {i, 0, 12}]
3. Then I paired upper limit and rate in each interval as {{0,0}, {15,0.68},{30,0.9},...{180,1.08}}.
4. Such list is then partition into following list of sublists piecewise = Partition[Transpose[{time1, rate}], 2, 1]
5. LinearEqs = Simplify[InterpolatingPolynomial[piecewise[[#]], x]]&/@Range[Length[piecewise]] applied to get intensity function for each interval.
6. lower limit as ll = Table[15*i, {i, 0, 11}] and upper limit as ul = Table[15*i, {i, 1, 12}].
7. ExptdMean = Integrate[LinearEqs[[#]], {x, ll[[#]], ul[[#]]}] & /@ Range[12] for each interval.

But I have been told to do column-wise fitting over the time period (0,T] i.e. (8:00-11:00].

Now that put into me confusion whether it is from Day1 all the way from 8:00-11:00, then Day2's 8:00-11:00 and so on for 15 days.

If considering examples like below then I have count column as tot = Total /@ data set with ul as x and exposure as 15 mins.

But again I am not sure that 15 days of data can fit in such way.
I'm baffled about count data fitting with NHPP.

Please, if anyone can help me with the correct approach for fitting column-wise data to the NHPP model.

• You mention "the NHPP model" but you never state a specific model. One can't make inferences by just massaging the data in isolation of a specific model. While my answer to your question mathematica.stackexchange.com/questions/218618/… might be inadequate for your needs, it does at least indirectly state a model through the GeneralizedLinearModelFit function. (Note that your massaging of the data induces dependence among the massaged observations in which most models assume independence.)
• @JimB I'm learning about NHPP. It would be courteous if some procedures I can learn specifically using InhomogeneousPoissoProcess[] with testing on such sort of data or data available for the experiments. Certainly, your answer to the previous post has noticed :) Apr 8, 2020 at 12:59