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
In code 5.19, it feels like the effect of marriage on divorce should be captured as follows: mu = pm.Deterministic("mu", a + bA * age_shared + bM * marriage)
i.e., the variable marriage_shared should be replaced by marriage.
I am trying to understand how A->M->D relationship is captured when running 5.21 for the values of A specified in 5.20. In the current formulation, the variable marriage_shared is controlling the A->M-D relationship and my understanding is this is set equal to data["MedianAgeMarriage_std"].value. I believe this can have an effect on counterfactual plots (Figure 5.6 left) due to A->M->D dependence (if any).
The text was updated successfully, but these errors were encountered:
Jaskanwal
changed the title
Chapter 5 Code 5.19: Effect of marriage on Divorce
Chapter 5 Code 5.19: Effect of marriage on divorce A->M->D
Oct 24, 2021
I noticed the same issue, I tried to fix it by updating the code to look like this:
# With PyMC3 we have to simulate in each model separately
# Simulate the marriage rates at each age first
age_shared.set_value(A_seq)
with m5_3_A:
m5_3_M_marriage = pm.sample_posterior_predictive(m5_3_A_trace, samples=1)
marriage_shared.set_value(m5_3_M_marriage['marriage'].flatten())
m5_3_M_marriage = pm.sample_posterior_predictive(m5_3_A_trace)
It didn't seem to effect the plots but I could see that being the result of D being independent of M conditioned on A (or as a result of a mistake I made in attempting a fix)
In code 5.19, it feels like the effect of marriage on divorce should be captured as follows:
mu = pm.Deterministic("mu", a + bA * age_shared + bM * marriage)
i.e., the variable
marriage_shared
should be replaced bymarriage
.I am trying to understand how A->M->D relationship is captured when running 5.21 for the values of
A
specified in 5.20. In the current formulation, the variablemarriage_shared
is controlling the A->M-D relationship and my understanding is this is set equal todata["MedianAgeMarriage_std"].value
. I believe this can have an effect on counterfactual plots (Figure 5.6 left) due to A->M->D dependence (if any).The text was updated successfully, but these errors were encountered: