I’m trying to use a hierarchical model.
As an example I’m trying to modify the code from the Partial pooling model#
For some of the child variables I have a measurement available (this is quite expensive, so is only available for a few of the child variables)- hence I’d like to make a different, much tighter prior than for the others.
I can do this via something like
measured_mus = {0: 0.5, 1: 0.5} # indexed on county_idx
with pm.Model(coords=coords) as partial_pooling_fixed_some_mus:
county_idx = pm.MutableData("county_idx", county, dims="obs_id")
mu_a = pm.Normal("mu_a", mu=0.0, sigma=10)
sigma_a = pm.Exponential("sigma_a", 1)
mus = [mu_a if i not in measured_mus else measured_mus[i] for i in range(len(coords['county']))]
# can do the same for the sigmas
alpha = pm.Normal("alpha", mu=mus, sigma=sigma_a, dims="county")
sigma_y = pm.Exponential("sigma_y", 1)
y_hat = alpha[county_idx]
y_like = pm.Normal("y_like", mu=y_hat, sigma=sigma_y, observed=log_radon, dims="obs_id")
This however doesn’t use the valuable measurments to tune the parent distribution for mu_a.
How could I do that?