|
1 | 1 | {
|
2 | 2 | "cells": [
|
3 | 3 | {
|
| 4 | + "attachments": {}, |
4 | 5 | "cell_type": "markdown",
|
5 | 6 | "id": "f2e8530c-5ba0-4041-a309-18919d5d0533",
|
6 | 7 | "metadata": {
|
|
12 | 13 | },
|
13 | 14 | "source": [
|
14 | 15 | "(interventional_distribution)=\n",
|
15 |
| - "# Interventional distributions and graph mutilation with the do-operator\n", |
| 16 | + "# Interventional distributions and graph mutation with the do-operator\n", |
16 | 17 | "\n",
|
17 | 18 | ":::{post} July, 2023\n",
|
18 | 19 | ":tags: causal inference, do-operator, graph mutation\n",
|
|
22 | 23 | ]
|
23 | 24 | },
|
24 | 25 | {
|
| 26 | + "attachments": {}, |
25 | 27 | "cell_type": "markdown",
|
26 | 28 | "id": "8f973a4f-def4-4fb6-b166-2aefbdf5eee2",
|
27 | 29 | "metadata": {
|
|
44 | 46 | ]
|
45 | 47 | },
|
46 | 48 | {
|
| 49 | + "attachments": {}, |
47 | 50 | "cell_type": "markdown",
|
48 | 51 | "id": "ed816fbf-320c-44f7-a711-cb4750d86e24",
|
49 | 52 | "metadata": {},
|
|
75 | 78 | ]
|
76 | 79 | },
|
77 | 80 | {
|
| 81 | + "attachments": {}, |
78 | 82 | "cell_type": "markdown",
|
79 | 83 | "id": "e2441116-c8a5-41af-be95-9eeddf2b0e2e",
|
80 | 84 | "metadata": {
|
|
136 | 140 | ]
|
137 | 141 | },
|
138 | 142 | {
|
| 143 | + "attachments": {}, |
139 | 144 | "cell_type": "markdown",
|
140 | 145 | "id": "782d6135-2e59-4462-8b9c-9832a58751ef",
|
141 | 146 | "metadata": {
|
|
259 | 264 | ]
|
260 | 265 | },
|
261 | 266 | {
|
| 267 | + "attachments": {}, |
262 | 268 | "cell_type": "markdown",
|
263 | 269 | "id": "f618f053-266b-4006-a521-f892cb8519e1",
|
264 | 270 | "metadata": {
|
|
281 | 287 | ]
|
282 | 288 | },
|
283 | 289 | {
|
| 290 | + "attachments": {}, |
284 | 291 | "cell_type": "markdown",
|
285 | 292 | "id": "ca2ed504-ffda-4f1d-8d18-cdb06608202b",
|
286 | 293 | "metadata": {
|
|
301 | 308 | ]
|
302 | 309 | },
|
303 | 310 | {
|
| 311 | + "attachments": {}, |
304 | 312 | "cell_type": "markdown",
|
305 | 313 | "id": "83b8106f-c9e1-4277-ba38-f13b03a33ef6",
|
306 | 314 | "metadata": {
|
|
466 | 474 | ]
|
467 | 475 | },
|
468 | 476 | {
|
| 477 | + "attachments": {}, |
469 | 478 | "cell_type": "markdown",
|
470 | 479 | "id": "56832ddc-ef61-4dbf-b46f-b6ef2ae8820e",
|
471 | 480 | "metadata": {
|
|
482 | 491 | ]
|
483 | 492 | },
|
484 | 493 | {
|
| 494 | + "attachments": {}, |
485 | 495 | "cell_type": "markdown",
|
486 | 496 | "id": "24792fb8-3e40-41b5-a26a-4a2d4da052ed",
|
487 | 497 | "metadata": {
|
|
503 | 513 | ]
|
504 | 514 | },
|
505 | 515 | {
|
| 516 | + "attachments": {}, |
506 | 517 | "cell_type": "markdown",
|
507 | 518 | "id": "aac4d49b-6a1e-4d77-a9c7-205050bebb9f",
|
508 | 519 | "metadata": {
|
|
572 | 583 | ]
|
573 | 584 | },
|
574 | 585 | {
|
| 586 | + "attachments": {}, |
575 | 587 | "cell_type": "markdown",
|
576 | 588 | "id": "b70e42b0-61a1-4c62-8dd9-d973d60d7946",
|
577 | 589 | "metadata": {
|
|
727 | 739 | ]
|
728 | 740 | },
|
729 | 741 | {
|
| 742 | + "attachments": {}, |
730 | 743 | "cell_type": "markdown",
|
731 | 744 | "id": "3bb5134c-f476-4b8f-9338-1ed07e1fbb13",
|
732 | 745 | "metadata": {
|
|
763 | 776 | ]
|
764 | 777 | },
|
765 | 778 | {
|
| 779 | + "attachments": {}, |
766 | 780 | "cell_type": "markdown",
|
767 | 781 | "id": "e2d1a7ca-1948-4165-92aa-3713df60b73b",
|
768 | 782 | "metadata": {},
|
|
773 | 787 | ]
|
774 | 788 | },
|
775 | 789 | {
|
| 790 | + "attachments": {}, |
776 | 791 | "cell_type": "markdown",
|
777 | 792 | "id": "453edf32-48d2-4d7f-96fb-6fb61851de9e",
|
778 | 793 | "metadata": {
|
|
783 | 798 | "tags": []
|
784 | 799 | },
|
785 | 800 | "source": [
|
786 |
| - "However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll package the data up in `DataFrame`'s for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above." |
| 801 | + "However, we are going to implement these using Bayesian causal DAGs with PyMC. Let's see how we can do this, then generate samples from them using `pm.sample_prior_predictive`. As we go with each DAG, we'll extract the samples for plotting later, and also plot the graphviz representation of the PyMC models. You'll see that while these are a fraction more visually complex, they do actually match up with the causal DAGs we've specified above." |
787 | 802 | ]
|
788 | 803 | },
|
789 | 804 | {
|
|
1095 | 1110 | ]
|
1096 | 1111 | },
|
1097 | 1112 | {
|
| 1113 | + "attachments": {}, |
1098 | 1114 | "cell_type": "markdown",
|
1099 | 1115 | "id": "07b66542-dd10-43b1-9dfb-5b438f756736",
|
1100 | 1116 | "metadata": {
|
|
1164 | 1180 | ]
|
1165 | 1181 | },
|
1166 | 1182 | {
|
| 1183 | + "attachments": {}, |
1167 | 1184 | "cell_type": "markdown",
|
1168 | 1185 | "id": "6625a68d-e19e-4490-b486-29e3bff42716",
|
1169 | 1186 | "metadata": {
|
|
1178 | 1195 | ]
|
1179 | 1196 | },
|
1180 | 1197 | {
|
| 1198 | + "attachments": {}, |
1181 | 1199 | "cell_type": "markdown",
|
1182 | 1200 | "id": "b44eef67-7ad3-46cc-b18c-e589b9fd271b",
|
1183 | 1201 | "metadata": {
|
|
1192 | 1210 | ]
|
1193 | 1211 | },
|
1194 | 1212 | {
|
| 1213 | + "attachments": {}, |
1195 | 1214 | "cell_type": "markdown",
|
1196 | 1215 | "id": "2d30eb22-2560-495a-8af2-f9c9fe04848a",
|
1197 | 1216 | "metadata": {},
|
|
1219 | 1238 | ]
|
1220 | 1239 | },
|
1221 | 1240 | {
|
| 1241 | + "attachments": {}, |
1222 | 1242 | "cell_type": "markdown",
|
1223 | 1243 | "id": "99ccc753-e3ef-4834-b02f-4a8d82749fe5",
|
1224 | 1244 | "metadata": {},
|
|
1227 | 1247 | ]
|
1228 | 1248 | },
|
1229 | 1249 | {
|
| 1250 | + "attachments": {}, |
1230 | 1251 | "cell_type": "markdown",
|
1231 | 1252 | "id": "d0896e42-ee27-4c37-a065-7c78d6f6c0e2",
|
1232 | 1253 | "metadata": {
|
|
1321 | 1342 | ]
|
1322 | 1343 | },
|
1323 | 1344 | {
|
| 1345 | + "attachments": {}, |
1324 | 1346 | "cell_type": "markdown",
|
1325 | 1347 | "id": "95844edc-2e47-47a1-986a-c6e0b30386c0",
|
1326 | 1348 | "metadata": {},
|
|
1471 | 1493 | ]
|
1472 | 1494 | },
|
1473 | 1495 | {
|
| 1496 | + "attachments": {}, |
1474 | 1497 | "cell_type": "markdown",
|
1475 | 1498 | "id": "688de710-654d-4905-a328-81941aaa1fe6",
|
1476 | 1499 | "metadata": {
|
|
1485 | 1508 | ]
|
1486 | 1509 | },
|
1487 | 1510 | {
|
| 1511 | + "attachments": {}, |
1488 | 1512 | "cell_type": "markdown",
|
1489 | 1513 | "id": "01ba8784-cd8b-45e8-b9ec-1fd6d56b010a",
|
1490 | 1514 | "metadata": {
|
|
1532 | 1556 | ]
|
1533 | 1557 | },
|
1534 | 1558 | {
|
| 1559 | + "attachments": {}, |
1535 | 1560 | "cell_type": "markdown",
|
1536 | 1561 | "id": "d9d4fe62-b694-4a90-9e7f-21344f69fcf6",
|
1537 | 1562 | "metadata": {
|
|
1599 | 1624 | ]
|
1600 | 1625 | },
|
1601 | 1626 | {
|
| 1627 | + "attachments": {}, |
1602 | 1628 | "cell_type": "markdown",
|
1603 | 1629 | "id": "f546f9e2-0f9b-4eaa-93e3-b5887b757a37",
|
1604 | 1630 | "metadata": {
|
|
1675 | 1701 | ]
|
1676 | 1702 | },
|
1677 | 1703 | {
|
| 1704 | + "attachments": {}, |
1678 | 1705 | "cell_type": "markdown",
|
1679 | 1706 | "id": "9c4122ee-9709-4c9c-b0eb-a4c20e1b7f3a",
|
1680 | 1707 | "metadata": {
|
|
1761 | 1788 | ]
|
1762 | 1789 | },
|
1763 | 1790 | {
|
| 1791 | + "attachments": {}, |
1764 | 1792 | "cell_type": "markdown",
|
1765 | 1793 | "id": "dec5c8d6-e562-47ca-a263-2e8269704d04",
|
1766 | 1794 | "metadata": {
|
|
1775 | 1803 | ]
|
1776 | 1804 | },
|
1777 | 1805 | {
|
| 1806 | + "attachments": {}, |
1778 | 1807 | "cell_type": "markdown",
|
1779 | 1808 | "id": "e546b0ab-dd66-4c20-b814-c8cd1bc6c710",
|
1780 | 1809 | "metadata": {
|
|
1797 | 1826 | ]
|
1798 | 1827 | },
|
1799 | 1828 | {
|
| 1829 | + "attachments": {}, |
1800 | 1830 | "cell_type": "markdown",
|
1801 | 1831 | "id": "f17a9b3b-a3c2-4919-893b-569049db03d6",
|
1802 | 1832 | "metadata": {
|
|
1812 | 1842 | ]
|
1813 | 1843 | },
|
1814 | 1844 | {
|
| 1845 | + "attachments": {}, |
1815 | 1846 | "cell_type": "markdown",
|
1816 | 1847 | "id": "ecbb878d-531b-4c96-afe2-c39f928b9162",
|
1817 | 1848 | "metadata": {},
|
|
1824 | 1855 | ]
|
1825 | 1856 | },
|
1826 | 1857 | {
|
| 1858 | + "attachments": {}, |
1827 | 1859 | "cell_type": "markdown",
|
1828 | 1860 | "id": "9fd548d0-5977-4a19-935a-506e86063887",
|
1829 | 1861 | "metadata": {},
|
|
1871 | 1903 | ]
|
1872 | 1904 | },
|
1873 | 1905 | {
|
| 1906 | + "attachments": {}, |
1874 | 1907 | "cell_type": "markdown",
|
1875 | 1908 | "id": "62e8040f-452c-4a11-90f5-fa94eb03c971",
|
1876 | 1909 | "metadata": {
|
|
0 commit comments