I have two observations: observed_a
and observed_data
. Both are guassian distributions, as shown in the figure. The two observations are interrelated.How to get the distribution of the parameter eps_1
given the two observations?
with pm.Model() as model:
eps_0 = pm.Uniform('eps_0', lower=3.0, upper=10.0, shape=1)
eps_1 = pm.Uniform('eps_1', lower=3.0, upper=10.0, shape=1)
eps_2 = pm.Uniform('eps_2', lower=3.0, upper=10.0, shape=1)
loss_0 = pm.Uniform('loss_0', lower=0.0001, upper=0.001, shape=1)
loss_1 = pm.Uniform('loss_1', lower=0.001, upper=0.1, shape=1)
loss_2 = pm.Uniform('loss_2', lower=0.001, upper=0.1, shape=1)
d1 = pm.Uniform('d1', lower=0.1, upper=5, shape=1)
eps = pt.as_tensor_variable([eps_0, eps_1, eps_2])
loss = pt.as_tensor_variable([loss_0, loss_1, loss_2])
thickness = pt.as_tensor_variable([d1, const_a*observed_a / pt.sqrt(eps_1)])
simulated_data = pm.Deterministic('simulated_data', simulator_op(eps, loss, thickness))
likelihood = pm.Normal('likelihood', mu=simulated_data, sigma=1, observed=observed_data)
trace = pm.sample(10000, tune=2000, progressbar=True, return_inferencedata=True)
pm.traceplot(trace, var_names=['eps_1'])
pm.summary(trace, var_names=['eps_1'])
PyMC v5.16.2
simulator_op
is my defined Op class that performs simulation with the parameters eps
, loss
, and thickness
. const_a
is a constant. You can see that observed_a
is correlated with parameter eps_1. I know the code thickness = pt.as_tensor_variable([d1, const_a*observed_a / pt.sqrt(eps_1)])
is erroneous, but how to correctly infer the specific parameter eps_1