Closed henrytdsimmons closed 11 months ago
Notebook title: A Primer on Bayesian Methods for Multilevel Modeling Notebook url: https://www.pymc.io/projects/examples/en/latest/case_studies/multilevel_modeling.html
Under the text "Let’s now turn our attention to the unpooled model, and see how it fares in comparison." there is the code block:
coords = {"county": mn_counties} with pm.Model(coords=coords) as unpooled_model: floor_idx = pm.MutableData("floor_ind", floor_measure, dims="obs_id") alpha = pm.Normal("alpha", 0, sigma=10, dims="county") beta = pm.Normal("beta", 0, sigma=10) sigma = pm.Exponential("sigma", 1) theta = alpha[county] + beta * floor_ind y = pm.Normal("y", theta, sigma=sigma, observed=log_radon, dims="obs_id")
Here, floor index is assigned to floor_idx but then when calculating theta, we use floor_ind not floor_idx
floor_idx
theta
floor_ind
floor_ind was previously defined in an higher up code block and is identical so there are no errors introduced, but it's still a mistake.
Rename floor_ind to floor_idx:
theta = alpha[county] + beta * floor_ind to theta = alpha[county] + beta * floor_idx
theta = alpha[county] + beta * floor_ind
theta = alpha[county] + beta * floor_idx
Good catch, want to do a PR?
Yep
https://github.com/pymc-devs/pymc-examples/pull/562
Closed by #562.
Notebook title: A Primer on Bayesian Methods for Multilevel Modeling
Notebook url: https://www.pymc.io/projects/examples/en/latest/case_studies/multilevel_modeling.html
Issue description
Under the text "Let’s now turn our attention to the unpooled model, and see how it fares in comparison." there is the code block:
Here, floor index is assigned to
floor_idx
but then when calculatingtheta
, we usefloor_ind
notfloor_idx
floor_ind
was previously defined in an higher up code block and is identical so there are no errors introduced, but it's still a mistake.Proposed solution
Rename
floor_ind
tofloor_idx
:theta = alpha[county] + beta * floor_ind
totheta = alpha[county] + beta * floor_idx