Hi. I am trying to model a timeseries with a Poisson process as one of its drivers.
Let’s say that I have two thousand timepoints, and I want to model the occurrence of 0-1 events along this time span, using a Poisson process with a predefined rate. Suppose this rate is 0.02, so the mean expectation is 40 occurrences over the observed 2000-point trajectory.
If I call pm.Poisson.dist(mu=0.02).random(size=2000)
, it does exactly that creating an array shaped (2000,)
with about 40 ones
and zeros
for the rest. However, if I call it inside the model context, like so: pm.Poisson('events', mu=0,02, shape=len(data))
, the posterior trajectory always converges to an array of all zeros. In fact, if I set the rate to mu=10
, it will also be a flat line at the corresponding level (i.e., always 10 events at each time point).
What I’d like it to do is to randomly draw a trajectory of zeros and ones on each step, corresponding to a deterministic or a stochastic rate mu=lambda_, so it (hopefully) converges to a trajectory that actually matches the observed event pattern. Is there a specific way in which that is achieved? Shouldn’t that be the default behavior anyway? Or is the nature of my observed data is pushing it to converge to a flat line? Really confused by this, any explanation is most welcome. Thank you!