Hi everyone,
a very newbie question:
I’m looking to model time between events with a relatively large range (~1-6000 seconds). The empirical data is well described by an exponential distribution, eg:
with pm.Model() as model0:
a = pm.Gamma("a", mu=0.1, sigma=0.5)
sec = pm.Exponential("sec", a, observed=d0.tdeltas)
trace0 = pm.sample(1000, tune=1000)
I run into issues when I want to model additional effects. For example, an effect of time. I have ~10000 sequential observations, which I turn into a ‘time’ variable as follows (I realize this can be done more accurately later by using actual time between events):
time = np.arange( len(d0) )
time = (time - time.mean()) / time.std()
As the effect of time could be positive or negative, I wanted to use a Gaussian:
with pm.Model() as model0:
a = pm.Gamma("a", mu=0.1, sigma=0.5)
b = pm.Normal("b", mu=0, sd=1)
lam = pm.Deterministic("lam", a + b*time)
sec = pm.Exponential("sec", lam, observed=d0.tdeltas)
trace0 = pm.sample(1000, tune=1000)
This results in zero divison errors and “initial evaluation errors” like so:
SamplingError: Initial evaluation of model at starting point failed!
Starting values:
{'a_log__': array(-1.620602, dtype=float32), 'b': array(0.9321959, dtype=float32)}
Initial evaluation results:
a_log__ -3.38
b -1.35
sec -inf
Name: Log-probability of test_point, dtype: float32
I assume this has to do with the fact that some samples could result in negative (and thus invalid) values for lam? I haven’t found a solution yet going through the documentation/forums and would be very thankful for any pointers!