Skip to content

Commit c16a2b8

Browse files
committed
update qte and cvar in guide
1 parent cc4659a commit c16a2b8

File tree

8 files changed

+122
-8
lines changed

8 files changed

+122
-8
lines changed

doc/guide/heterogeneity.rst

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ via feature construction.
1313
Group Average Treatment Effects (GATEs)
1414
++++++++++++++++++++++++++++++++++++++++++++++
1515

16+
.. include:: ../shared/heterogeneity/gate.rst
17+
1618
The ``DoubleMLIRM`` class contains the ``gate()`` method, which enables the estimation and construction of confidence intervals
1719
for GATEs after fitting the ``DoubleMLIRM`` object. To estimate GATEs, the user has to specify a pandas ``DataFrame`` containing
1820
the groups (dummy coded or one column with strings).
@@ -54,6 +56,8 @@ A more detailed notebook on GATEs is available in the :ref:`example gallery <exa
5456
Conditional Average Treatment Effects (CATEs)
5557
++++++++++++++++++++++++++++++++++++++++++++++
5658

59+
.. include:: ../shared/heterogeneity/cate.rst
60+
5761
The ``DoubleMLIRM`` class contains the ``cate()`` method, which enables the estimation and construction of confidence intervals
5862
for CATEs after fitting the ``DoubleMLIRM`` object. To estimate CATEs, the user has to specify a pandas ``DataFrame`` containing
5963
the basis (e.g. B-splines) for the conditional treatment effects.
@@ -98,7 +102,7 @@ The examples also include the construction of a two-dimensional basis with B-spl
98102
Quantiles
99103
++++++++++++++++++++++++++++++++++++++++++++++
100104

101-
The :ref:`DoubleML <doubleml-package>` package includes (local) quantile estimation for potential outcomes for
105+
The :ref:`DoubleML <doubleml_package>` package includes (local) quantile estimation for potential outcomes for
102106
:ref:`IRM <irm-model>` and :ref:`IIVM <iivm-model>` models.
103107

104108
Potential Quantiles (PQs)
@@ -124,7 +128,8 @@ Potential Quantiles (PQs)
124128
dml_pq_obj = dml.DoubleMLPQ(obj_dml_data, ml_g, ml_m, treatment=1, quantile=0.5)
125129
dml_pq_obj.fit().summary
126130
127-
``DoubleMLLPQ`` implements local potential quantile estimation. Estimation is conducted via its ``fit()`` method:
131+
``DoubleMLLPQ`` implements local potential quantile estimation, where the argument ``treatment`` indicates the potential outcome.
132+
Estimation is conducted via its ``fit()`` method:
128133

129134
.. tabbed:: Python
130135

@@ -142,23 +147,89 @@ Potential Quantiles (PQs)
142147
dml_lpq_obj = dml.DoubleMLLPQ(obj_dml_data, ml_g, ml_m, treatment=1, quantile=0.5)
143148
dml_lpq_obj.fit().summary
144149
150+
145151
Quantile Treatment Effects (QTEs)
146152
*******************************************
147153

154+
.. include:: ../shared/heterogeneity/qte.rst
155+
156+
``DoubleMLQTE`` implements quantile treatment effect estimation. Estimation is conducted via its ``fit()`` method:
157+
158+
.. tabbed:: Python
159+
160+
.. ipython:: python
161+
162+
import numpy as np
163+
import doubleml as dml
164+
from doubleml.datasets import make_irm_data
165+
from sklearn.ensemble import RandomForestClassifier
166+
np.random.seed(3141)
167+
ml_g = RandomForestClassifier(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
168+
ml_m = RandomForestClassifier(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
169+
data = make_irm_data(theta=0.5, n_obs=500, dim_x=20, return_type='DataFrame')
170+
obj_dml_data = dml.DoubleMLData(data, 'y', 'd')
171+
dml_qte_obj = dml.DoubleMLQTE(obj_dml_data, ml_g, ml_m, score='PQ', quantiles=[0.25, 0.5, 0.75])
172+
dml_qte_obj.fit().summary
173+
174+
To estimate local quantile effects the ``score`` argument has to be set to ``LPQ``.
148175
A detailed notebook on PQs and QTEs is available in the :ref:`example gallery <examplegallery>`.
149176

150177
Conditional Value at Risk (CVaR)
151178
++++++++++++++++++++++++++++++++++++++++++++
152179

153-
All implemented solutions focus on the :ref:`IRM <irm-model>` models
180+
The :ref:`DoubleML <doubleml_package>` package includes conditional value at risk estimation for
181+
:ref:`IRM <irm-model>` models.
154182

155183
CVaR of Potential Outcomes
156184
*******************************************
157185

186+
.. include:: ../shared/heterogeneity/cvar.rst
187+
188+
``DoubleMLCVAR`` implements conditional value at risk estimation for potential outcomes, where the argument ``treatment`` indicates the potential outcome.
189+
Estimation is conducted via its ``fit()`` method:
190+
191+
.. tabbed:: Python
192+
193+
.. ipython:: python
194+
195+
import numpy as np
196+
import doubleml as dml
197+
from doubleml.datasets import make_irm_data
198+
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
199+
np.random.seed(3141)
200+
ml_g = RandomForestRegressor(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
201+
ml_m = RandomForestClassifier(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
202+
data = make_irm_data(theta=0.5, n_obs=500, dim_x=20, return_type='DataFrame')
203+
obj_dml_data = dml.DoubleMLData(data, 'y', 'd')
204+
dml_cvar_obj = dml.DoubleMLCVAR(obj_dml_data, ml_g, ml_m, treatment=1, quantile=0.5)
205+
dml_cvar_obj.fit().summary
206+
207+
158208
CVaR Treatment Effect
159209
*******************************************
160210

161-
A detailed notebook on conditional value at risk estimation
211+
.. include:: ../shared/heterogeneity/cvar_qte.rst
212+
213+
``DoubleMLQTE`` implements CVaR treatment effect estimation, if the ``score`` argument has been set to ``CVaR`` (default is ``PQ``).
214+
Estimation is conducted via its ``fit()`` method:
215+
216+
.. tabbed:: Python
217+
218+
.. ipython:: python
219+
220+
import numpy as np
221+
import doubleml as dml
222+
from doubleml.datasets import make_irm_data
223+
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
224+
np.random.seed(3141)
225+
ml_g = RandomForestRegressor(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
226+
ml_m = RandomForestClassifier(n_estimators=100, max_features=20, max_depth=10, min_samples_leaf=2)
227+
data = make_irm_data(theta=0.5, n_obs=500, dim_x=20, return_type='DataFrame')
228+
obj_dml_data = dml.DoubleMLData(data, 'y', 'd')
229+
dml_cvar_obj = dml.DoubleMLQTE(obj_dml_data, ml_g, ml_m, score='CVaR', quantiles=[0.25, 0.5, 0.75])
230+
dml_cvar_obj.fit().summary
231+
232+
A detailed notebook on CVaR estimation for potential outcomes and treatment effects
162233
is available in the :ref:`example gallery <examplegallery>`.
163234

164235

doc/guide/models.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Models
44
----------
55

6-
The :ref:`DoubleML <doubleml-package>` includes the following models.
6+
The :ref:`DoubleML <doubleml_package>` includes the following models.
77

88
.. _plr-model:
99

doc/shared/heterogeneity/cate.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**Conditional Average Treatment Effects (CATEs)** consider the target parameters
2+
3+
.. math::
4+
5+
\theta_{0}(x) = \mathbb{E}[Y(1) - Y(0)| X=x]
6+
7+
for a low-dimensional feature :math:`X`, where :math:`Y(d)` the potential outcome with :math:`d \in \{0, 1\}`.

doc/shared/heterogeneity/cvar.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
For a quantile :math:`\tau \in (0,1)` the target parameters :math:`\theta_{\tau}(d)` of interest are
2+
the **conditional values at risk (CVaRs)** of the potential outcomes,
3+
4+
.. math::
5+
6+
\theta_{\tau}(d) = \frac{\mathbb{E}[Y(d) 1\{F_{Y(d)}(Y(d) \ge \tau)]}{1-\tau},
7+
8+
9+
where :math:`Y(d)` denotes the potential outcome with :math:`d \in \{0, 1\}` and
10+
:math:`F_{Y(d)}(x)` the corresponding cdf of :math:`Y(d)`.

doc/shared/heterogeneity/cvar_qte.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
For a quantile :math:`\tau \in (0,1)` the target parameter :math:`\theta_{\tau}` of interest are the
2+
**treatment effects on the conditional value at risk**,
3+
4+
.. math::
5+
6+
\theta_{\tau} = \theta_{\tau}(1) - \theta_{\tau}(0)
7+
8+
where :math:`\theta_{\tau}(d)` denotes the corresponding conditional values at risk
9+
of the potential outcomes.

doc/shared/heterogeneity/gate.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**Group Average Treatment Effects (GATEs)** consider the target parameters
2+
3+
.. math::
4+
5+
\theta_{0,k} = \mathbb{E}[Y(1) - Y(0)| G_k],\quad k=1,\dots, K.
6+
7+
where :math:`G_k` denotes a group indicator and :math:`Y(d)` the potential outcome with :math:`d \in \{0, 1\}`.

doc/shared/heterogeneity/pq.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
For a quantile :math:`\tau \in (0,1)` the target parameters :math:`\theta_0` of interest are the **potential quantile (PQ)**,
1+
For a quantile :math:`\tau \in (0,1)` the target parameters :math:`\theta_{\tau}(d)` of interest are the **potential quantiles (PQs)**,
22

33
.. math::
44
5-
P(Y(d) \le \theta_0) = \tau,
5+
P(Y(d) \le \theta_{\tau}(d)) = \tau,
66
77
and **local potential quantiles (LPQs)**,
88

99
.. math::
1010
11-
P(Y(d) \le \theta_0|\text{Compliers}) = \tau.
11+
P(Y(d) \le \theta_{\tau}(d)|\text{Compliers}) = \tau.
1212
1313
where :math:`Y(d)` denotes the potential outcome with :math:`d \in \{0, 1\}`.
1414

doc/shared/heterogeneity/qte.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
For a quantile :math:`\tau \in (0,1)` the target parameter :math:`\theta_{\tau}` of interest are the **quantile treatment effect (QTE)**,
2+
3+
.. math::
4+
5+
\theta_{\tau} = \theta_{\tau}(1) - \theta_{\tau}(0)
6+
7+
where :math:`\theta_{\tau}(d)` denotes the corresponding potential quantile.
8+
9+
Analogously, the **local quantile treatment effect (LQTE)** can be defined as the difference of
10+
the corresponding local potential quantiles.

0 commit comments

Comments
 (0)