I have a (integer) random variable that looks like this : enter image description here

So as you can see, has a regular behaviour for most of the time, but at some point a peak appears, and after a while this effect disappear and the variable goes down to his regular behaviour.

My question is how can I model this, using Bayesian Analysis tools like PYMC3 ?

So far I tried to describe de model like this:

Before some point $\tau1$ , the variable follows a Poisson distribution with some $\lambda1$. for a period of time $\tau2$ the variable is the sum of two Poisson distribution, characterized with $\lambda1$ and $\lambda2$ . $\lambda2$ is the "effect" of the external event that modify the variable. Then after a time $\tau1 + \tau2$ the variable goes down to the regular behaviour with $\lambda1$

From this model I want to know the values of $\tau1$ and $\tau2$ . And by fitting this model with the MCMC method it does converge to certain values. The point $\tau1$ is found by the model almost perfectly ( it corresponds to a know event ) but the duration of this effect ( and that is the thing of my interest ) does not seems to have much sense, as the model give it a value ( the mean of samples for $\tau2$ ) of 2 , but if you take a closer look it seem to last longer, something like six minutes.

So, there is a better way to model this kind of events, to quantify the duration of that external event ?


You can try variational inference with PyMC or with Edward. While I'm not sure of your description exactly, it sounds like MCMC is not converging. Variational Inference has gotten to the point where you can have arbitrary variational posteriors and arbitrary likelihood calculations. Edward has this with Likelihood Implicit Variational Inference which will do both of those things. This will work better if you have enough data. If you don't have enough data you might need to hand engineer more information about the prior or posterior.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.