Modeling a random variable with a sudden peak

Hi PyMC Community!

I have a question regarding how to fit or model the behavior of a random variable that is suddenly affected by an external event, making it go up . My data looks like this:

First i tried a model like this.

the change occurs at some fixed point, before that point the variable behaves like a Poisson distribution( lambda1) .
After the change point and for a while ( tau ) the variable is a the sum of two Poisson distributions( lambda1 + lambda2).
and finally it goes down to ~ Poisson( lambda1)

It kind of works, and the model is able to find the change point. But the variable of my most interest is the time tau
Adn this model doesn’t work for this ( as it give me values of around 2 ( minutes ) and one can see by eye, that is more like 6 or 7 minutes.

So my question is, what other kind of model could be used for this kind of data?

Thanks in advance.


I tried following the ideas in this but i was unable to make it work.

Any ideas are really welcome.


Is the x-axis in a unit of the minute? If so I think it is reasonable you get an estimation around 2 minutes, as in your data there is two points that are much higher than the baseline.
To be sure, you should simulate some data with different parameters (e.g., tau=2 minutes compare to tau=6~7 minutes), and compare the simulation with the actual data.

Agreed. There are only three (and possibly a fourth at 828) data points above 30, and only two above 40.