You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -142,7 +142,7 @@ Technically, we don't need to supply `coords`, but providing this (a list of obs
142
142
coords = {"observation": data.index.values}
143
143
144
144
with pm.Model(coords=coords) as binomial_regression_model:
145
-
x = pm.ConstantData("x", data["x"], dims="observation")
145
+
x = pm.Data("x", data["x"], dims="observation")
146
146
# priors
147
147
beta0 = pm.Normal("beta0", mu=0, sigma=1)
148
148
beta1 = pm.Normal("beta1", mu=0, sigma=1)
@@ -165,7 +165,7 @@ with binomial_regression_model:
165
165
Confirm no inference issues by visual inspection of chain. We've got no warnings about divergences, $\hat{R}$, or effective sample size. Everything looks good.
The left panel shows the posterior mean (solid line) and 95% credible intervals (shaded region). Because we are working with simulated data, we know what the true model is, so we can see that the posterior mean compares favourably with the true data generating model.
193
+
The top panel shows the posterior mean (solid line) and 95% credible intervals (shaded region). Because we are working with simulated data, we know what the true model is, so we can see that the posterior mean compares favourably with the true data generating model.
224
194
225
-
This is also shown by the posterior distribution over parameter space (right panel), which does well when comparing to the true data generating parameters.
195
+
This is also shown by the posterior distribution over parameter space (bottom panel), which does well when comparing to the true data generating parameters.
226
196
227
197
Using binomial regression in real data analysis situations would probably involve more predictor variables, and correspondingly more model parameters, but hopefully this example has demonstrated the logic behind binomial regression.
228
198
@@ -235,6 +205,7 @@ A good introduction to generalized linear models is provided by {cite:t}`roback2
235
205
- Updated by [Benjamin T. Vincent](https://github.com/drbenvincent) in February 2022
236
206
- Updated by Benjamin T. Vincent in February 2023 to run on PyMC v5
237
207
- Updated to use `az.extract` by [Benjamin T. Vincent](https://github.com/drbenvincent) in February 2023, ([pymc-examples#522](https://github.com/pymc-devs/pymc-examples/pull/522))
0 commit comments