Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"model_code": "models/stan/eight_schools_noncentered.stan",
"stan_version": ">=2.26.0"
},
"pymc3": {
"model_code": "models/pymc3/eight_schools_noncentered.py"
"pymc": {
"model_code": "models/pymc/eight_schools_noncentered.py",
"pymc_version": ">=5.16.2"
}
},
"added_by": "Mans Magnusson",
Expand Down
18 changes: 18 additions & 0 deletions posterior_database/models/pymc/eight_schools_noncentered.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np
import pymc as pm


def model(data):
y_obs = np.array(data["y"]) # estimated treatment
sigma = np.array(data["sigma"]) # std of estimated effect
coords = {"school": np.arange(data["J"])}
with pm.Model(coords=coords) as pymc_model:

mu = pm.Normal(
"mu", mu=0, sigma=5
) # hyper-parameter of mean, non-informative prior
tau = pm.HalfCauchy("tau", beta=5) # hyper-parameter of sigma
theta_trans = pm.Normal("theta_trans", mu=0, sigma=1, dims="school")
theta = mu + tau * theta_trans
y = pm.Normal("y", mu=theta, sigma=sigma, observed=y_obs)
return pymc_model
18 changes: 0 additions & 18 deletions posterior_database/models/pymc3/eight_schools_noncentered.py

This file was deleted.