# Modelling a random variable that is mostly zero, but otherwise exponential (PyMC3)

I'm new to probabilistic programming, and have run into problems of this kind a few times now. Simply put: I often find myself wanting to model a random variable that mostly has some nice, continuous distribution, except that some of the time it falls on a particular fixed value, or is undefined.

Here is a toy example: We have a machine that predicts imminent tsunamis. For each actual tsunami we are interested in both whether or not a tsunami was predicted, as well as how far in advance it was predicted.

I could define a random variable $$T$$ which models the prediction lead time for any given tsunami. $$T=2$$ indicates that a tsunami was predicted two minutes in advance. If $$T=0$$, it means the tsunami was not predicted. I might use an exponentially distributed random variable to do this, but there will be a lot of weight at exactly zero that will break this model.

It seems like I'm after some kind of mixture, but it's not clear to me how to actually construct it either on paper, or in PyMC3. Should I be considering a completely different approach to modelling $$T$$?

• Is this really an exponential model? Or does it return integers only? If so, you can use a zero-inflated Poisson model. – user2974951 Aug 23 '19 at 7:57
• Sorry, that's wasn't clear from the examole. It really is an exponential model, or another continuous distribution more generally. – grge Aug 23 '19 at 8:02
• One solution could be to use a mixture model, comparable to one form of zero inflated poisson model. You have one component of the mixture which is "not detected" and another component of the mixture which is "detected" with detection times given by the exponential distribution. There are more complex answers available in the survival literature. – Paul Hewson Aug 23 '19 at 8:08