Hi all,

I’m relatively new to Pymc3 and would gladly appreciate any input the community can offer.

I am trying to implement a 2 step bayesian inference strategy based on the relationship time=distance/velocity. In both steps, time is the observed value.

In the first step, I intend to obtain an estimation of the velocity using training data (training location and training time)

x = training_location #list of training locations

V = pm.Uniform(‘V’,4e4, 6e4)

mu = distance (x)/V

sigma = pm.HalfNormal(‘sigma’,sigma = 0.5)

OBS = pm.Normal(‘obs’, mu = mu, sigma = sigma, observed = training_time)

In the second step, I intend to obtain an estimation of the x location using measured data (measured time) using the posterior distribution of V from step 1

x = pm.Uniform(‘x’,0,1000)

V = *fromposterior, need help here!*

mu = distance (x)/V

sigma = pm.HalfNormal(‘sigma’,sigma = 0.5)

OBS = pm.Normal(‘obs’, mu = mu, sigma = sigma, observed = measured_time)

I have looked at the example from updating priors using KDE and the posterior distribution is fed into the second stage as a prior. However, in my application, I would need parameter x to be the prior distribution (to be updated) and that the distribution of V to be kept unchanged (as part of the likelihood).

Thanks in advance!