Skip to content

Commit 2d329c7

Browse files
committed
add thumbnail and contourplot for sensitivity
1 parent f2cfb03 commit 2d329c7

File tree

4 files changed

+42
-41
lines changed

4 files changed

+42
-41
lines changed
104 KB
Loading

doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@
9898

9999
# -- Extension configuration -------------------------------------------------
100100

101+
nbsphinx_thumbnails = {
102+
'examples/py_double_ml_sensitivity': '_static/sensitivity_example_nb.png',
103+
}
104+
101105
copybutton_prompt_text = r'>>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: | {2,5}\.\.\.\.:'
102106
copybutton_prompt_is_regexp = True
103107

doc/examples/py_double_ml_sensitivity.ipynb

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
{
2525
"cell_type": "code",
26-
"execution_count": 40,
26+
"execution_count": 1,
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
@@ -56,7 +56,7 @@
5656
},
5757
{
5858
"cell_type": "code",
59-
"execution_count": 41,
59+
"execution_count": 2,
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
@@ -67,7 +67,7 @@
6767
},
6868
{
6969
"cell_type": "code",
70-
"execution_count": 42,
70+
"execution_count": 3,
7171
"metadata": {},
7272
"outputs": [
7373
{
@@ -114,7 +114,7 @@
114114
},
115115
{
116116
"cell_type": "code",
117-
"execution_count": 43,
117+
"execution_count": 4,
118118
"metadata": {},
119119
"outputs": [
120120
{
@@ -173,7 +173,7 @@
173173
},
174174
{
175175
"cell_type": "code",
176-
"execution_count": 44,
176+
"execution_count": 5,
177177
"metadata": {},
178178
"outputs": [
179179
{
@@ -216,7 +216,7 @@
216216
"d 3.23674 5.023089"
217217
]
218218
},
219-
"execution_count": 44,
219+
"execution_count": 5,
220220
"metadata": {},
221221
"output_type": "execute_result"
222222
}
@@ -245,7 +245,7 @@
245245
},
246246
{
247247
"cell_type": "code",
248-
"execution_count": 45,
248+
"execution_count": 6,
249249
"metadata": {},
250250
"outputs": [
251251
{
@@ -275,7 +275,7 @@
275275
},
276276
{
277277
"cell_type": "code",
278-
"execution_count": 46,
278+
"execution_count": 7,
279279
"metadata": {},
280280
"outputs": [
281281
{
@@ -293,7 +293,7 @@
293293
" 'null_hypothesis': array([0.])}}"
294294
]
295295
},
296-
"execution_count": 46,
296+
"execution_count": 7,
297297
"metadata": {},
298298
"output_type": "execute_result"
299299
}
@@ -316,7 +316,7 @@
316316
},
317317
{
318318
"cell_type": "code",
319-
"execution_count": 47,
319+
"execution_count": 8,
320320
"metadata": {},
321321
"outputs": [
322322
{
@@ -11661,7 +11661,7 @@
1166111661
},
1166211662
{
1166311663
"cell_type": "code",
11664-
"execution_count": 48,
11664+
"execution_count": 9,
1166511665
"metadata": {},
1166611666
"outputs": [
1166711667
{
@@ -11691,7 +11691,7 @@
1169111691
},
1169211692
{
1169311693
"cell_type": "code",
11694-
"execution_count": 49,
11694+
"execution_count": 10,
1169511695
"metadata": {},
1169611696
"outputs": [
1169711697
{
@@ -23051,7 +23051,7 @@
2305123051
},
2305223052
{
2305323053
"cell_type": "code",
23054-
"execution_count": 50,
23054+
"execution_count": 11,
2305523055
"metadata": {},
2305623056
"outputs": [
2305723057
{
@@ -23102,7 +23102,7 @@
2310223102
},
2310323103
{
2310423104
"cell_type": "code",
23105-
"execution_count": 51,
23105+
"execution_count": 12,
2310623106
"metadata": {},
2310723107
"outputs": [],
2310823108
"source": [
@@ -23114,7 +23114,7 @@
2311423114
},
2311523115
{
2311623116
"cell_type": "code",
23117-
"execution_count": 52,
23117+
"execution_count": 13,
2311823118
"metadata": {},
2311923119
"outputs": [
2312023120
{
@@ -23176,7 +23176,7 @@
2317623176
},
2317723177
{
2317823178
"cell_type": "code",
23179-
"execution_count": 53,
23179+
"execution_count": 14,
2318023180
"metadata": {},
2318123181
"outputs": [
2318223182
{
@@ -23214,7 +23214,7 @@
2321423214
},
2321523215
{
2321623216
"cell_type": "code",
23217-
"execution_count": 54,
23217+
"execution_count": 15,
2321823218
"metadata": {},
2321923219
"outputs": [
2322023220
{
@@ -34561,7 +34561,7 @@
3456134561
},
3456234562
{
3456334563
"cell_type": "code",
34564-
"execution_count": 55,
34564+
"execution_count": 16,
3456534565
"metadata": {},
3456634566
"outputs": [
3456734567
{
@@ -34618,7 +34618,7 @@
3461834618
},
3461934619
{
3462034620
"cell_type": "code",
34621-
"execution_count": 56,
34621+
"execution_count": 17,
3462234622
"metadata": {},
3462334623
"outputs": [
3462434624
{
@@ -34648,7 +34648,7 @@
3464834648
},
3464934649
{
3465034650
"cell_type": "code",
34651-
"execution_count": 57,
34651+
"execution_count": 18,
3465234652
"metadata": {},
3465334653
"outputs": [
3465434654
{
@@ -45985,7 +45985,7 @@
4598545985
},
4598645986
{
4598745987
"cell_type": "code",
45988-
"execution_count": 58,
45988+
"execution_count": 19,
4598945989
"metadata": {},
4599045990
"outputs": [
4599145991
{
@@ -56474,6 +56474,8 @@
5647456474
}
5647556475
],
5647656476
"layout": {
56477+
"autosize": false,
56478+
"height": 500,
5647756479
"template": {
5647856480
"data": {
5647956481
"bar": [
@@ -57291,6 +57293,7 @@
5729157293
}
5729257294
},
5729357295
"title": {},
57296+
"width": 500,
5729457297
"xaxis": {
5729557298
"range": [
5729657299
0,
@@ -57317,7 +57320,14 @@
5731757320
}
5731857321
],
5731957322
"source": [
57320-
"dml_irm_obj.sensitivity_plot()"
57323+
"fig = dml_irm_obj.sensitivity_plot()\n",
57324+
"\n",
57325+
"fig.update_layout(\n",
57326+
" autosize=False,\n",
57327+
" width=500,\n",
57328+
" height=500)\n",
57329+
"\n",
57330+
"fig"
5732157331
]
5732257332
}
5732357333
],

doc/guide/sensitivity.rst

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,15 @@ If the estimated parameter :math:`\hat{\theta}` is larger than the null hypothes
232232
The robustness value $RVa$ defined analogous, but additionally incorporates statistical uncertainty (as it is based on the confidence intervals of the bounds).
233233

234234
To obtain a more complete overview over the sensitivity one can call the ``sensitivity_plot()`` method. The methods creates a contour plot, which calculates estimate of the upper or lower bound for :math:`\theta`
235-
(based on the null hypothesis) for each combination of ``cf_y`` and ``cf_d`` in a grid of values. An interactive example can be found in the Example ga
235+
(based on the null hypothesis) for each combination of ``cf_y`` and ``cf_d`` in a grid of values.
236236

237-
.. tab-set::
237+
.. figure:: ../_static/sensitivity_example_nb.png
238+
:alt: Contour plot
239+
:figclass: captioned-image
238240

239-
.. tab-item:: Python
240-
:sync: py
241+
Contour plot example (see :ref:`examplegallery`)
241242

242-
.. ipython:: python
243-
244-
dml_plr_obj.sensitivity_plot()
243+
By adjusting the parameter ``value='ci'`` in the ``sensitivity_plot()`` method the bounds are displayed for the corresponding confidence level.
245244

246245
.. note::
247246

@@ -250,18 +249,6 @@ To obtain a more complete overview over the sensitivity one can call the ``sensi
250249
- The ``sensitivity_plot()`` is created for the first treatment variable. This can be changed via the ``idx_treatment`` parameter.
251250
- The robustness values are given via the intersection countour of the null hypothesis and the identity.
252251

253-
By adjusting the parameter ``value='ci'`` the bounds are displayed for the corresponding confidence level.
254-
255-
.. tab-set::
256-
257-
.. tab-item:: Python
258-
:sync: py
259-
260-
.. ipython:: python
261-
262-
dml_plr_obj.sensitivity_plot(value='ci')
263-
264-
265252
.. _sensitivity_models:
266253

267254
Model-specific implementations

0 commit comments

Comments
 (0)