Skip to content

Commit d938a2b

Browse files
committed
fixes
1 parent 034342e commit d938a2b

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

examples/generalized_linear_models/GLM-simpsons-paradox.ipynb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@
14421442
"source": [
14431443
"## Model 3: Partial pooling model\n",
14441444
"\n",
1445-
"Model 3 assumes the same causal DAG as model 2 (see above). However, we can go further and incorporate more knowledge about the structure of our data. Rather than treating each group as entirely independent, we can use our knowledge that these groups are drawn from a population-level distribution. We could formalise this as saying that the group-level slopes and intercepts are modeled as deflections from a population-level slopes and intercepts, respectively."
1445+
"Model 3 assumes the same causal DAG as model 2 (see above). However, we can go further and incorporate more knowledge about the structure of our data. Rather than treating each group as entirely independent, we can use our knowledge that these groups are drawn from a population-level distribution. We could formalise this as saying that the group-level slopes and intercepts are modeled as deflections from a population-level slope and intercept, respectively."
14461446
]
14471447
},
14481448
{
@@ -1452,17 +1452,6 @@
14521452
"And we could describe this model mathematically as:\n",
14531453
"\n",
14541454
"$$\n",
1455-
"% \\begin{aligned}\n",
1456-
"% \\beta_0 &\\sim \\text{Normal}(0, 1) \\\\\n",
1457-
"% \\beta_1 &\\sim \\text{Normal}(0, 1) \\\\\n",
1458-
"% p_{0\\sigma}, p_{1\\sigma} &\\sim \\text{Gamma}(2, 2) \\\\\n",
1459-
"% \\vec{u_0} &\\sim \\text{Normal}(0, p_{0\\sigma}) \\\\ \n",
1460-
"% \\vec{u_1} &\\sim \\text{Normal}(0, p_{1\\sigma}) \\\\ \n",
1461-
"% \\sigma &\\sim \\text{Gamma}(2, 2) \\\\\n",
1462-
"% \\mu_i &= \\overbrace{\\Big( \\underbrace{\\beta_0}_{\\text{pop}} + \\underbrace{\\vec{u_0}[g_i]}_{\\text{group}} \\Big)}^{\\text{intercept}} \n",
1463-
"% + \\overbrace{\\Big( \\underbrace{\\beta_1[g_i] \\cdot x_i}_{\\text{pop}} + \\underbrace{\\vec{u_1}[g_i] \\cdot u_i }_{\\text{group}}\\Big) }^{\\text{slope}}\\\\\n",
1464-
"% y_i &\\sim \\text{Normal}(\\mu_i, \\sigma)\n",
1465-
"% \\end{aligned}\n",
14661455
"\\begin{aligned}\n",
14671456
"\\beta_0 &\\sim \\text{Normal}(0, 1), \\\\\n",
14681457
"\\beta_1 &\\sim \\text{Normal}(0, 1), \\\\\n",
@@ -1479,7 +1468,7 @@
14791468
" + \\overbrace{\n",
14801469
" \\left( \n",
14811470
" \\underbrace{\\beta_1 \\cdot x_i}_{\\text{pop}} \n",
1482-
" + \\underbrace{\\vec{u_1}[g_i] \\cdot u_i}_{\\text{group}} \n",
1471+
" + \\underbrace{\\vec{u_1}[g_i] \\cdot x_i}_{\\text{group}} \n",
14831472
" \\right)\n",
14841473
" }^{\\text{slope}}, \\\\\n",
14851474
"y_i &\\sim \\text{Normal}(\\mu_i, \\sigma).\n",

examples/generalized_linear_models/GLM-simpsons-paradox.myst.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,24 +433,13 @@ ax[0].set(
433433

434434
## Model 3: Partial pooling model
435435

436-
Model 3 assumes the same causal DAG as model 2 (see above). However, we can go further and incorporate more knowledge about the structure of our data. Rather than treating each group as entirely independent, we can use our knowledge that these groups are drawn from a population-level distribution. We could formalise this as saying that the group-level slopes and intercepts are modeled as deflections from a population-level slopes and intercepts, respectively.
436+
Model 3 assumes the same causal DAG as model 2 (see above). However, we can go further and incorporate more knowledge about the structure of our data. Rather than treating each group as entirely independent, we can use our knowledge that these groups are drawn from a population-level distribution. We could formalise this as saying that the group-level slopes and intercepts are modeled as deflections from a population-level slope and intercept, respectively.
437437

438438
+++
439439

440440
And we could describe this model mathematically as:
441441

442442
$$
443-
% \begin{aligned}
444-
% \beta_0 &\sim \text{Normal}(0, 1) \\
445-
% \beta_1 &\sim \text{Normal}(0, 1) \\
446-
% p_{0\sigma}, p_{1\sigma} &\sim \text{Gamma}(2, 2) \\
447-
% \vec{u_0} &\sim \text{Normal}(0, p_{0\sigma}) \\
448-
% \vec{u_1} &\sim \text{Normal}(0, p_{1\sigma}) \\
449-
% \sigma &\sim \text{Gamma}(2, 2) \\
450-
% \mu_i &= \overbrace{\Big( \underbrace{\beta_0}_{\text{pop}} + \underbrace{\vec{u_0}[g_i]}_{\text{group}} \Big)}^{\text{intercept}}
451-
% + \overbrace{\Big( \underbrace{\beta_1[g_i] \cdot x_i}_{\text{pop}} + \underbrace{\vec{u_1}[g_i] \cdot u_i }_{\text{group}}\Big) }^{\text{slope}}\\
452-
% y_i &\sim \text{Normal}(\mu_i, \sigma)
453-
% \end{aligned}
454443
\begin{aligned}
455444
\beta_0 &\sim \text{Normal}(0, 1), \\
456445
\beta_1 &\sim \text{Normal}(0, 1), \\
@@ -467,7 +456,7 @@ p_{0\sigma}, p_{1\sigma} &\sim \text{Gamma}(2, 2), \\
467456
+ \overbrace{
468457
\left(
469458
\underbrace{\beta_1 \cdot x_i}_{\text{pop}}
470-
+ \underbrace{\vec{u_1}[g_i] \cdot u_i}_{\text{group}}
459+
+ \underbrace{\vec{u_1}[g_i] \cdot x_i}_{\text{group}}
471460
\right)
472461
}^{\text{slope}}, \\
473462
y_i &\sim \text{Normal}(\mu_i, \sigma).

0 commit comments

Comments
 (0)