Okay @ricardoV94 and @cluhmann if you’re still there, this is my attempt to model this with an exponentiated linear model. I am still given bad initial energy errors, and this time the sampling never completes, error is thrown very early in the process. I know I’m probably still somehow asking the sampler to examine mathematical impossibilities…
xx = np.arange(1,3501,20)
yy_real = xx/(100+xx)
γ_mean = np.log(0.2)
δ_mean = -0.0004
a = lambda x: np.power(np.e, δ_mean*x + γ_mean)
ee = np.random.normal(0, a(xx))
yy = yy_real + ee
with pm.Model() as model_vv:
γ = pm.Gamma('γ', mu=-1.5, sigma = 0.5) ## analagous to initial spread of variance (take natural log)
δ = pm.Normal('δ', mu=-0.0004, sd=0.0002) ## slope, rate of tightening of variance
κ = pm.Normal('κ', mu=100, sigma = 10) ## same old k
μ = pm.Deterministic('μ', xx/(xx+κ))
ε = pm.Deterministic('ε', np.power(np.e, γ + δ*xx))
y_pred = pm.Normal('y_pred', mu=μ, sd=ε, observed=yy)
trace_g = pm.sample(2000, tune=1000)
The error thrown is:
Bad initial energy, check any log probabilities that are inf or -inf, nan or very small:
γ_log__ NaN
y_pred -inf
The toy data looks like this:
