|
1 | 1 | {
|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 |
| - "attachments": {}, |
5 | 4 | "cell_type": "markdown",
|
6 | 5 | "id": "domestic-remove",
|
7 | 6 | "metadata": {},
|
|
10 | 9 | "# Modeling Heteroscedasticity with BART\n",
|
11 | 10 | "\n",
|
12 | 11 | ":::{post} January, 2023\n",
|
13 |
| - ":tags: bart regression \n", |
| 12 | + ":tags: BART, regression\n", |
14 | 13 | ":category: beginner, reference\n",
|
15 |
| - ":author: [Juan Orduz](https://juanitorduz.github.io/)\n", |
| 14 | + ":author: Juan Orduz\n", |
16 | 15 | ":::"
|
17 | 16 | ]
|
18 | 17 | },
|
19 | 18 | {
|
20 |
| - "attachments": {}, |
21 | 19 | "cell_type": "markdown",
|
22 | 20 | "id": "72588976-efc3-4adc-bec2-bc5b6ac4b7e1",
|
23 | 21 | "metadata": {},
|
|
60 | 58 | ]
|
61 | 59 | },
|
62 | 60 | {
|
63 |
| - "attachments": {}, |
64 | 61 | "cell_type": "markdown",
|
65 | 62 | "id": "4cae4407",
|
66 | 63 | "metadata": {},
|
|
167 | 164 | ]
|
168 | 165 | },
|
169 | 166 | {
|
170 |
| - "attachments": {}, |
171 | 167 | "cell_type": "markdown",
|
172 | 168 | "id": "6d6364a9",
|
173 | 169 | "metadata": {},
|
|
206 | 202 | ]
|
207 | 203 | },
|
208 | 204 | {
|
209 |
| - "attachments": {}, |
210 | 205 | "cell_type": "markdown",
|
211 | 206 | "id": "5c3971f2",
|
212 | 207 | "metadata": {},
|
|
215 | 210 | ]
|
216 | 211 | },
|
217 | 212 | {
|
218 |
| - "attachments": {}, |
219 | 213 | "cell_type": "markdown",
|
220 | 214 | "id": "e8a3ce48",
|
221 | 215 | "metadata": {},
|
|
237 | 231 | ]
|
238 | 232 | },
|
239 | 233 | {
|
240 |
| - "attachments": {}, |
241 | 234 | "cell_type": "markdown",
|
242 | 235 | "id": "a29b706c",
|
243 | 236 | "metadata": {},
|
|
253 | 246 | "outputs": [
|
254 | 247 | {
|
255 | 248 | "data": {
|
256 |
| - "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.50.0 (0)\n -->\n<!-- Pages: 1 -->\n<svg width=\"138pt\" height=\"260pt\"\n viewBox=\"0.00 0.00 138.00 259.91\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 255.91)\">\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-255.91 134,-255.91 134,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster2 x 200</title>\n<path fill=\"none\" stroke=\"black\" d=\"M20,-129.95C20,-129.95 110,-129.95 110,-129.95 116,-129.95 122,-135.95 122,-141.95 122,-141.95 122,-231.91 122,-231.91 122,-237.91 116,-243.91 110,-243.91 110,-243.91 20,-243.91 20,-243.91 14,-243.91 8,-237.91 8,-231.91 8,-231.91 8,-141.95 8,-141.95 8,-135.95 14,-129.95 20,-129.95\"/>\n<text text-anchor=\"middle\" x=\"93\" y=\"-137.75\" font-family=\"Times,serif\" font-size=\"14.00\">2 x 200</text>\n</g>\n<g id=\"clust2\" class=\"cluster\">\n<title>cluster200</title>\n<path fill=\"none\" stroke=\"black\" d=\"M26,-8C26,-8 104,-8 104,-8 110,-8 116,-14 116,-20 116,-20 116,-109.95 116,-109.95 116,-115.95 110,-121.95 104,-121.95 104,-121.95 26,-121.95 26,-121.95 20,-121.95 14,-115.95 14,-109.95 14,-109.95 14,-20 14,-20 14,-14 20,-8 26,-8\"/>\n<text text-anchor=\"middle\" x=\"97.5\" y=\"-15.8\" font-family=\"Times,serif\" font-size=\"14.00\">200</text>\n</g>\n<!-- w -->\n<g id=\"node1\" class=\"node\">\n<title>w</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"65\" cy=\"-198.43\" rx=\"48.58\" ry=\"37.45\"/>\n<text text-anchor=\"middle\" x=\"65\" y=\"-209.73\" font-family=\"Times,serif\" font-size=\"14.00\">w</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-194.73\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-179.73\" font-family=\"Times,serif\" font-size=\"14.00\">BART_w</text>\n</g>\n<!-- y -->\n<g id=\"node2\" class=\"node\">\n<title>y</title>\n<ellipse fill=\"lightgrey\" stroke=\"black\" cx=\"65\" cy=\"-76.48\" rx=\"43.27\" ry=\"37.45\"/>\n<text text-anchor=\"middle\" x=\"65\" y=\"-87.78\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-72.78\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n<text text-anchor=\"middle\" x=\"65\" y=\"-57.78\" font-family=\"Times,serif\" font-size=\"14.00\">Gamma</text>\n</g>\n<!-- w->y -->\n<g id=\"edge1\" class=\"edge\">\n<title>w->y</title>\n<path fill=\"none\" stroke=\"black\" d=\"M65,-160.79C65,-149.38 65,-136.65 65,-124.63\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"68.5,-124.31 65,-114.31 61.5,-124.31 68.5,-124.31\"/>\n</g>\n</g>\n</svg>\n", |
| 249 | + "image/svg+xml": [ |
| 250 | + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
| 251 | + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
| 252 | + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
| 253 | + "<!-- Generated by graphviz version 2.50.0 (0)\n", |
| 254 | + " -->\n", |
| 255 | + "<!-- Pages: 1 -->\n", |
| 256 | + "<svg width=\"138pt\" height=\"260pt\"\n", |
| 257 | + " viewBox=\"0.00 0.00 138.00 259.91\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
| 258 | + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 255.91)\">\n", |
| 259 | + "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-255.91 134,-255.91 134,4 -4,4\"/>\n", |
| 260 | + "<g id=\"clust1\" class=\"cluster\">\n", |
| 261 | + "<title>cluster2 x 200</title>\n", |
| 262 | + "<path fill=\"none\" stroke=\"black\" d=\"M20,-129.95C20,-129.95 110,-129.95 110,-129.95 116,-129.95 122,-135.95 122,-141.95 122,-141.95 122,-231.91 122,-231.91 122,-237.91 116,-243.91 110,-243.91 110,-243.91 20,-243.91 20,-243.91 14,-243.91 8,-237.91 8,-231.91 8,-231.91 8,-141.95 8,-141.95 8,-135.95 14,-129.95 20,-129.95\"/>\n", |
| 263 | + "<text text-anchor=\"middle\" x=\"93\" y=\"-137.75\" font-family=\"Times,serif\" font-size=\"14.00\">2 x 200</text>\n", |
| 264 | + "</g>\n", |
| 265 | + "<g id=\"clust2\" class=\"cluster\">\n", |
| 266 | + "<title>cluster200</title>\n", |
| 267 | + "<path fill=\"none\" stroke=\"black\" d=\"M26,-8C26,-8 104,-8 104,-8 110,-8 116,-14 116,-20 116,-20 116,-109.95 116,-109.95 116,-115.95 110,-121.95 104,-121.95 104,-121.95 26,-121.95 26,-121.95 20,-121.95 14,-115.95 14,-109.95 14,-109.95 14,-20 14,-20 14,-14 20,-8 26,-8\"/>\n", |
| 268 | + "<text text-anchor=\"middle\" x=\"97.5\" y=\"-15.8\" font-family=\"Times,serif\" font-size=\"14.00\">200</text>\n", |
| 269 | + "</g>\n", |
| 270 | + "<!-- w -->\n", |
| 271 | + "<g id=\"node1\" class=\"node\">\n", |
| 272 | + "<title>w</title>\n", |
| 273 | + "<ellipse fill=\"none\" stroke=\"black\" cx=\"65\" cy=\"-198.43\" rx=\"48.58\" ry=\"37.45\"/>\n", |
| 274 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-209.73\" font-family=\"Times,serif\" font-size=\"14.00\">w</text>\n", |
| 275 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-194.73\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n", |
| 276 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-179.73\" font-family=\"Times,serif\" font-size=\"14.00\">BART_w</text>\n", |
| 277 | + "</g>\n", |
| 278 | + "<!-- y -->\n", |
| 279 | + "<g id=\"node2\" class=\"node\">\n", |
| 280 | + "<title>y</title>\n", |
| 281 | + "<ellipse fill=\"lightgrey\" stroke=\"black\" cx=\"65\" cy=\"-76.48\" rx=\"43.27\" ry=\"37.45\"/>\n", |
| 282 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-87.78\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n", |
| 283 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-72.78\" font-family=\"Times,serif\" font-size=\"14.00\">~</text>\n", |
| 284 | + "<text text-anchor=\"middle\" x=\"65\" y=\"-57.78\" font-family=\"Times,serif\" font-size=\"14.00\">Gamma</text>\n", |
| 285 | + "</g>\n", |
| 286 | + "<!-- w->y -->\n", |
| 287 | + "<g id=\"edge1\" class=\"edge\">\n", |
| 288 | + "<title>w->y</title>\n", |
| 289 | + "<path fill=\"none\" stroke=\"black\" d=\"M65,-160.79C65,-149.38 65,-136.65 65,-124.63\"/>\n", |
| 290 | + "<polygon fill=\"black\" stroke=\"black\" points=\"68.5,-124.31 65,-114.31 61.5,-124.31 68.5,-124.31\"/>\n", |
| 291 | + "</g>\n", |
| 292 | + "</g>\n", |
| 293 | + "</svg>\n" |
| 294 | + ], |
257 | 295 | "text/plain": [
|
258 | 296 | "<graphviz.graphs.Digraph at 0x7f31ae9c47f0>"
|
259 | 297 | ]
|
|
272 | 310 | ]
|
273 | 311 | },
|
274 | 312 | {
|
275 |
| - "attachments": {}, |
276 | 313 | "cell_type": "markdown",
|
277 | 314 | "id": "9aa885a3",
|
278 | 315 | "metadata": {},
|
|
292 | 329 | "text": [
|
293 | 330 | "Multiprocess sampling (4 chains in 4 jobs)\n",
|
294 | 331 | "PGBART: [w]\n",
|
295 |
| - "PGBART: [w]\n" |
296 |
| - ] |
297 |
| - }, |
298 |
| - { |
299 |
| - "name": "stderr", |
300 |
| - "output_type": "stream", |
301 |
| - "text": [ |
| 332 | + "PGBART: [w]\n", |
302 | 333 | "Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 136 seconds.\n",
|
303 | 334 | "The rhat statistic is larger than 1.01 for some parameters. This indicates problems during sampling. See https://arxiv.org/abs/1903.08008 for details\n"
|
304 | 335 | ]
|
|
313 | 344 | ]
|
314 | 345 | },
|
315 | 346 | {
|
316 |
| - "attachments": {}, |
317 | 347 | "cell_type": "markdown",
|
318 | 348 | "id": "eba7cee5",
|
319 | 349 | "metadata": {},
|
|
392 | 422 | ]
|
393 | 423 | },
|
394 | 424 | {
|
395 |
| - "attachments": {}, |
396 | 425 | "cell_type": "markdown",
|
397 | 426 | "id": "d1775acb",
|
398 | 427 | "metadata": {},
|
|
401 | 430 | ]
|
402 | 431 | },
|
403 | 432 | {
|
404 |
| - "attachments": {}, |
405 | 433 | "cell_type": "markdown",
|
406 | 434 | "id": "b743d58b-2678-4e17-9947-a8fe4ed03e21",
|
407 | 435 | "metadata": {},
|
|
479 | 507 | ],
|
480 | 508 | "metadata": {
|
481 | 509 | "kernelspec": {
|
482 |
| - "display_name": "pymc-examples-env", |
| 510 | + "display_name": "Python 3 (ipykernel)", |
483 | 511 | "language": "python",
|
484 | 512 | "name": "python3"
|
485 | 513 | },
|
|
493 | 521 | "name": "python",
|
494 | 522 | "nbconvert_exporter": "python",
|
495 | 523 | "pygments_lexer": "ipython3",
|
496 |
| - "version": "3.10.9" |
| 524 | + "version": "3.10.0" |
497 | 525 | },
|
498 | 526 | "vscode": {
|
499 | 527 | "interpreter": {
|
|
0 commit comments