Skip to content

Commit 61167fb

Browse files
committed
extend sensitivity guide
1 parent da369d7 commit 61167fb

File tree

2 files changed

+216
-71
lines changed

2 files changed

+216
-71
lines changed

doc/examples/py_double_ml_sensitivity.ipynb

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": 1,
16+
"execution_count": 21,
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
@@ -57,7 +57,7 @@
5757
},
5858
{
5959
"cell_type": "code",
60-
"execution_count": 2,
60+
"execution_count": 22,
6161
"metadata": {},
6262
"outputs": [],
6363
"source": [
@@ -68,7 +68,7 @@
6868
},
6969
{
7070
"cell_type": "code",
71-
"execution_count": 3,
71+
"execution_count": 23,
7272
"metadata": {},
7373
"outputs": [
7474
{
@@ -115,7 +115,7 @@
115115
},
116116
{
117117
"cell_type": "code",
118-
"execution_count": 4,
118+
"execution_count": 24,
119119
"metadata": {},
120120
"outputs": [
121121
{
@@ -174,7 +174,7 @@
174174
},
175175
{
176176
"cell_type": "code",
177-
"execution_count": 5,
177+
"execution_count": 25,
178178
"metadata": {},
179179
"outputs": [
180180
{
@@ -217,7 +217,7 @@
217217
"d 3.23674 5.023089"
218218
]
219219
},
220-
"execution_count": 5,
220+
"execution_count": 25,
221221
"metadata": {},
222222
"output_type": "execute_result"
223223
}
@@ -246,7 +246,7 @@
246246
},
247247
{
248248
"cell_type": "code",
249-
"execution_count": 6,
249+
"execution_count": 26,
250250
"metadata": {},
251251
"outputs": [
252252
{
@@ -256,17 +256,16 @@
256256
"================== Sensitivity Analysis ==================\n",
257257
"\n",
258258
"------------------ Scenario ------------------\n",
259-
"Null Hypothesis: theta=0.0\n",
260259
"Significance Level: level=0.95\n",
261260
"Sensitivity parameters: cf_y=0.03; cf_d=0.03, rho=1.0\n",
262261
"\n",
263-
"------------------ Robustness Values ------------------\n",
264-
" RV (%) RVa (%)\n",
265-
"d 34.277832 29.773191\n",
266-
"\n",
267262
"------------------ Bounds with CI ------------------\n",
268263
" CI lower theta lower theta theta upper CI upper\n",
269-
"d 3.097583 3.832391 4.129914 4.427438 5.192852\n"
264+
"d 3.097583 3.832391 4.129914 4.427438 5.192852\n",
265+
"\n",
266+
"------------------ Robustness Values ------------------\n",
267+
" H_0 RV (%) RVa (%)\n",
268+
"d 0.0 34.277832 29.773191\n"
270269
]
271270
}
272271
],
@@ -277,7 +276,7 @@
277276
},
278277
{
279278
"cell_type": "code",
280-
"execution_count": 7,
279+
"execution_count": 27,
281280
"metadata": {},
282281
"outputs": [
283282
{
@@ -292,10 +291,10 @@
292291
" 'cf_d': 0.03,\n",
293292
" 'rho': 1.0,\n",
294293
" 'level': 0.95,\n",
295-
" 'theta': 0.0}}"
294+
" 'null_hypothesis': array([0.])}}"
296295
]
297296
},
298-
"execution_count": 7,
297+
"execution_count": 27,
299298
"metadata": {},
300299
"output_type": "execute_result"
301300
}
@@ -318,7 +317,7 @@
318317
},
319318
{
320319
"cell_type": "code",
321-
"execution_count": 8,
320+
"execution_count": 28,
322321
"metadata": {},
323322
"outputs": [
324323
{
@@ -11658,12 +11657,12 @@
1165811657
"cell_type": "markdown",
1165911658
"metadata": {},
1166011659
"source": [
11661-
"To consider a different null hypothesis and add a different scenario to the the contour plot, we can adjust the parameter `theta`."
11660+
"To consider a different null hypothesis and add a different scenario to the the contour plot, we can adjust the parameter `null_hypothesis`."
1166211661
]
1166311662
},
1166411663
{
1166511664
"cell_type": "code",
11666-
"execution_count": 9,
11665+
"execution_count": 29,
1166711666
"metadata": {},
1166811667
"outputs": [
1166911668
{
@@ -11673,28 +11672,27 @@
1167311672
"================== Sensitivity Analysis ==================\n",
1167411673
"\n",
1167511674
"------------------ Scenario ------------------\n",
11676-
"Null Hypothesis: theta=5.0\n",
1167711675
"Significance Level: level=0.95\n",
1167811676
"Sensitivity parameters: cf_y=0.1; cf_d=0.1, rho=1.0\n",
1167911677
"\n",
11680-
"------------------ Robustness Values ------------------\n",
11681-
" RV (%) RVa (%)\n",
11682-
"d 8.520003 1.16567\n",
11683-
"\n",
1168411678
"------------------ Bounds with CI ------------------\n",
1168511679
" CI lower theta lower theta theta upper CI upper\n",
11686-
"d 2.396879 3.100324 4.129914 5.159504 5.96804\n"
11680+
"d 2.396879 3.100324 4.129914 5.159504 5.96804\n",
11681+
"\n",
11682+
"------------------ Robustness Values ------------------\n",
11683+
" H_0 RV (%) RVa (%)\n",
11684+
"d 5.0 8.520003 1.16567\n"
1168711685
]
1168811686
}
1168911687
],
1169011688
"source": [
11691-
"dml_obj.sensitivity_analysis(cf_y=cf_y, cf_d=cf_d, theta=theta)\n",
11689+
"dml_obj.sensitivity_analysis(cf_y=cf_y, cf_d=cf_d, null_hypothesis=theta)\n",
1169211690
"print(dml_obj.sensitivity_summary)"
1169311691
]
1169411692
},
1169511693
{
1169611694
"cell_type": "code",
11697-
"execution_count": 10,
11695+
"execution_count": 30,
1169811696
"metadata": {},
1169911697
"outputs": [
1170011698
{
@@ -23026,7 +23024,7 @@
2302623024
}
2302723025
],
2302823026
"source": [
23029-
"dml_obj.sensitivity_plot(theta=theta)"
23027+
"dml_obj.sensitivity_plot()"
2303023028
]
2303123029
},
2303223030
{
@@ -23054,7 +23052,7 @@
2305423052
},
2305523053
{
2305623054
"cell_type": "code",
23057-
"execution_count": 11,
23055+
"execution_count": 31,
2305823056
"metadata": {},
2305923057
"outputs": [
2306023058
{
@@ -23105,7 +23103,7 @@
2310523103
},
2310623104
{
2310723105
"cell_type": "code",
23108-
"execution_count": 12,
23106+
"execution_count": 32,
2310923107
"metadata": {},
2311023108
"outputs": [],
2311123109
"source": [
@@ -23117,7 +23115,7 @@
2311723115
},
2311823116
{
2311923117
"cell_type": "code",
23120-
"execution_count": 13,
23118+
"execution_count": 33,
2312123119
"metadata": {},
2312223120
"outputs": [
2312323121
{
@@ -23179,7 +23177,7 @@
2317923177
},
2318023178
{
2318123179
"cell_type": "code",
23182-
"execution_count": 14,
23180+
"execution_count": 34,
2318323181
"metadata": {},
2318423182
"outputs": [
2318523183
{
@@ -23189,17 +23187,16 @@
2318923187
"================== Sensitivity Analysis ==================\n",
2319023188
"\n",
2319123189
"------------------ Scenario ------------------\n",
23192-
"Null Hypothesis: theta=0.0\n",
2319323190
"Significance Level: level=0.95\n",
2319423191
"Sensitivity parameters: cf_y=0.04; cf_d=0.03, rho=1.0\n",
2319523192
"\n",
23196-
"------------------ Robustness Values ------------------\n",
23197-
" RV (%) RVa (%)\n",
23198-
"e401 7.142167 5.344182\n",
23199-
"\n",
2320023193
"------------------ Bounds with CI ------------------\n",
2320123194
" CI lower theta lower theta theta upper CI upper\n",
23202-
"e401 2466.628749 4688.643738 8923.15163 13157.659522 15368.317475\n"
23195+
"e401 2466.628749 4688.643738 8923.15163 13157.659522 15368.317475\n",
23196+
"\n",
23197+
"------------------ Robustness Values ------------------\n",
23198+
" H_0 RV (%) RVa (%)\n",
23199+
"e401 0.0 7.142167 5.344182\n"
2320323200
]
2320423201
}
2320523202
],
@@ -23218,7 +23215,7 @@
2321823215
},
2321923216
{
2322023217
"cell_type": "code",
23221-
"execution_count": 15,
23218+
"execution_count": 35,
2322223219
"metadata": {},
2322323220
"outputs": [
2322423221
{
@@ -34565,7 +34562,7 @@
3456534562
},
3456634563
{
3456734564
"cell_type": "code",
34568-
"execution_count": 16,
34565+
"execution_count": 36,
3456934566
"metadata": {},
3457034567
"outputs": [
3457134568
{
@@ -34622,7 +34619,7 @@
3462234619
},
3462334620
{
3462434621
"cell_type": "code",
34625-
"execution_count": 17,
34622+
"execution_count": 37,
3462634623
"metadata": {},
3462734624
"outputs": [
3462834625
{
@@ -34632,17 +34629,16 @@
3463234629
"================== Sensitivity Analysis ==================\n",
3463334630
"\n",
3463434631
"------------------ Scenario ------------------\n",
34635-
"Null Hypothesis: theta=0.0\n",
3463634632
"Significance Level: level=0.95\n",
3463734633
"Sensitivity parameters: cf_y=0.04; cf_d=0.03, rho=1.0\n",
3463834634
"\n",
34639-
"------------------ Robustness Values ------------------\n",
34640-
" RV (%) RVa (%)\n",
34641-
"e401 5.921927 4.52499\n",
34642-
"\n",
3464334635
"------------------ Bounds with CI ------------------\n",
3464434636
" CI lower theta lower theta theta upper CI upper\n",
34645-
"e401 1557.650883 3467.844007 8180.537217 12893.230427 14796.611327\n"
34637+
"e401 1557.650883 3467.844007 8180.537217 12893.230427 14796.611327\n",
34638+
"\n",
34639+
"------------------ Robustness Values ------------------\n",
34640+
" H_0 RV (%) RVa (%)\n",
34641+
"e401 0.0 5.921927 4.52499\n"
3464634642
]
3464734643
}
3464834644
],
@@ -34653,7 +34649,7 @@
3465334649
},
3465434650
{
3465534651
"cell_type": "code",
34656-
"execution_count": 18,
34652+
"execution_count": 38,
3465734653
"metadata": {},
3465834654
"outputs": [
3465934655
{

0 commit comments

Comments
 (0)