Skip to content

Commit b75b6d5

Browse files
committed
update notebooks
1 parent dbe9a89 commit b75b6d5

File tree

4 files changed

+595
-117
lines changed

4 files changed

+595
-117
lines changed

docs/source/notebooks/did_pymc.ipynb

Lines changed: 138 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
{
170170
"data": {
171171
"application/vnd.jupyter.widget-view+json": {
172-
"model_id": "948c5e2eb1884852866729a222bc9ca7",
172+
"model_id": "b37c2ff6780f4b6a9c7806ee9ea25d50",
173173
"version_major": 2,
174174
"version_minor": 0
175175
},
@@ -288,25 +288,79 @@
288288
"cell_type": "code",
289289
"execution_count": 8,
290290
"metadata": {},
291+
"outputs": [
292+
{
293+
"data": {
294+
"text/html": [
295+
"<div>\n",
296+
"<style scoped>\n",
297+
" .dataframe tbody tr th:only-of-type {\n",
298+
" vertical-align: middle;\n",
299+
" }\n",
300+
"\n",
301+
" .dataframe tbody tr th {\n",
302+
" vertical-align: top;\n",
303+
" }\n",
304+
"\n",
305+
" .dataframe thead th {\n",
306+
" text-align: right;\n",
307+
" }\n",
308+
"</style>\n",
309+
"<table border=\"1\" class=\"dataframe\">\n",
310+
" <thead>\n",
311+
" <tr style=\"text-align: right;\">\n",
312+
" <th></th>\n",
313+
" <th>mean</th>\n",
314+
" <th>median</th>\n",
315+
" <th>hdi_lower</th>\n",
316+
" <th>hdi_upper</th>\n",
317+
" <th>p_gt_0</th>\n",
318+
" </tr>\n",
319+
" </thead>\n",
320+
" <tbody>\n",
321+
" <tr>\n",
322+
" <th>treatment_effect</th>\n",
323+
" <td>0.503779</td>\n",
324+
" <td>0.504367</td>\n",
325+
" <td>0.401661</td>\n",
326+
" <td>0.607651</td>\n",
327+
" <td>1.0</td>\n",
328+
" </tr>\n",
329+
" </tbody>\n",
330+
"</table>\n",
331+
"</div>"
332+
],
333+
"text/plain": [
334+
" mean median hdi_lower hdi_upper p_gt_0\n",
335+
"treatment_effect 0.503779 0.504367 0.401661 0.607651 1.0"
336+
]
337+
},
338+
"execution_count": 8,
339+
"metadata": {},
340+
"output_type": "execute_result"
341+
}
342+
],
343+
"source": [
344+
"# Generate effect summary\n",
345+
"stats = result.effect_summary()\n",
346+
"stats.table"
347+
]
348+
},
349+
{
350+
"cell_type": "code",
351+
"execution_count": 9,
352+
"metadata": {},
291353
"outputs": [
292354
{
293355
"name": "stdout",
294356
"output_type": "stream",
295357
"text": [
296-
" mean median hdi_lower hdi_upper p_gt_0\n",
297-
"treatment_effect 0.503779 0.504367 0.401661 0.607651 1.0\n",
298-
"\n",
299358
"The average treatment effect was 0.50 (95% HDI [0.40, 0.61]), with a posterior probability of an increase of 1.000.\n"
300359
]
301360
}
302361
],
303362
"source": [
304-
"# Generate effect summary\n",
305-
"stats = result.effect_summary()\n",
306-
"\n",
307-
"# Display the summary table\n",
308-
"print(stats.table)\n",
309-
"print(\"\\n\" + stats.text)"
363+
"print(stats.text)"
310364
]
311365
},
312366
{
@@ -322,21 +376,65 @@
322376
},
323377
{
324378
"cell_type": "code",
325-
"execution_count": 9,
379+
"execution_count": 10,
326380
"metadata": {},
327381
"outputs": [
328382
{
329-
"name": "stdout",
330-
"output_type": "stream",
331-
"text": [
332-
" mean median hdi_lower hdi_upper p_two_sided \\\n",
333-
"treatment_effect 0.503779 0.504367 0.401661 0.607651 0.0 \n",
334-
"\n",
335-
" prob_of_effect p_rope \n",
336-
"treatment_effect 1.0 0.99925 \n",
337-
"\n",
338-
"The average treatment effect was 0.50 (95% HDI [0.40, 0.61]), with a posterior probability of an effect of 1.000.\n"
339-
]
383+
"data": {
384+
"text/html": [
385+
"<div>\n",
386+
"<style scoped>\n",
387+
" .dataframe tbody tr th:only-of-type {\n",
388+
" vertical-align: middle;\n",
389+
" }\n",
390+
"\n",
391+
" .dataframe tbody tr th {\n",
392+
" vertical-align: top;\n",
393+
" }\n",
394+
"\n",
395+
" .dataframe thead th {\n",
396+
" text-align: right;\n",
397+
" }\n",
398+
"</style>\n",
399+
"<table border=\"1\" class=\"dataframe\">\n",
400+
" <thead>\n",
401+
" <tr style=\"text-align: right;\">\n",
402+
" <th></th>\n",
403+
" <th>mean</th>\n",
404+
" <th>median</th>\n",
405+
" <th>hdi_lower</th>\n",
406+
" <th>hdi_upper</th>\n",
407+
" <th>p_two_sided</th>\n",
408+
" <th>prob_of_effect</th>\n",
409+
" <th>p_rope</th>\n",
410+
" </tr>\n",
411+
" </thead>\n",
412+
" <tbody>\n",
413+
" <tr>\n",
414+
" <th>treatment_effect</th>\n",
415+
" <td>0.503779</td>\n",
416+
" <td>0.504367</td>\n",
417+
" <td>0.401661</td>\n",
418+
" <td>0.607651</td>\n",
419+
" <td>0.0</td>\n",
420+
" <td>1.0</td>\n",
421+
" <td>0.99925</td>\n",
422+
" </tr>\n",
423+
" </tbody>\n",
424+
"</table>\n",
425+
"</div>"
426+
],
427+
"text/plain": [
428+
" mean median hdi_lower hdi_upper p_two_sided \\\n",
429+
"treatment_effect 0.503779 0.504367 0.401661 0.607651 0.0 \n",
430+
"\n",
431+
" prob_of_effect p_rope \n",
432+
"treatment_effect 1.0 0.99925 "
433+
]
434+
},
435+
"execution_count": 10,
436+
"metadata": {},
437+
"output_type": "execute_result"
340438
}
341439
],
342440
"source": [
@@ -346,8 +444,24 @@
346444
" alpha=0.05,\n",
347445
" min_effect=0.3, # Region of Practical Equivalence\n",
348446
")\n",
349-
"\n",
350-
"print(stats.table)\n",
447+
"stats.table"
448+
]
449+
},
450+
{
451+
"cell_type": "code",
452+
"execution_count": 11,
453+
"metadata": {},
454+
"outputs": [
455+
{
456+
"name": "stdout",
457+
"output_type": "stream",
458+
"text": [
459+
"\n",
460+
"The average treatment effect was 0.50 (95% HDI [0.40, 0.61]), with a posterior probability of an effect of 1.000.\n"
461+
]
462+
}
463+
],
464+
"source": [
351465
"print(\"\\n\" + stats.text)"
352466
]
353467
},

docs/source/notebooks/geolift1.ipynb

Lines changed: 88 additions & 17 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)