-
Notifications
You must be signed in to change notification settings - Fork 94
Adapt nuisance est for IV-type
score (PLR) & new score IV-type
for PLIV
#151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… for IV-type score c86b332
…ption if not all four learners ml_l, ml_m, ml_r and ml_g are set
…learner ml_g=None
PhilippBach
approved these changes
Jun 13, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced Jun 14, 2022
PhilippBach
added a commit
to DoubleML/doubleml-docs
that referenced
this pull request
Jun 14, 2022
upd preprocessing notebook according to changes in DoubleML/doubleml-for-py#151
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
PLR
score='partialling out'
(Equation (4.4) in Chernozhukov et al. (2018)) are not affected by the changes in this PR. However, the naming of the nuisance parameter is changed fromml_g
toml_l
(analogously predictionsg_hat
have been renamed tol_hat
, etc.) to be better in line with Chernozhukov et al. (2018). To make the transition to the new naming smooth, depreciation warnings have been added (see below for an overview of the API changes and examples for the depreciation warnings).score='IV-type'
(Equation (4.3) in Chernozhukov et al. (2018)) the implementation now follows the approach described on pp. C31-C33 in Chernozhukov et al. (2018). This means that an initial estimate fortheta_0
is obtained via the'partialling out'
score. Then an estimate forg_0(X)
is obtained by regressingY - theta_0 * D
onX
. Therefore, an additional learner (not needed to evaluate the score) needs to be provided, i.e., the nuisance functionl_0(X)
(needed for the preliminarytheta_0
estimate) is estimated with learnerml_l
andg_0(X)
with learnerml_g
. To make the transition to the new API (additional learner) smooth, depreciation warnings have been added (see below for an overview of the API changes and examples for the depreciation warnings). Especially, if onlyml_g
is specified but notml_l
, thenml_g = clone(ml_l)
is being used and a warning is being thrown.PLIV
score='partialling out'
(Equation (4.8) in Chernozhukov et al. (2018)) are not affected by the changes in this PR. However, the naming of the nuisance parameter is changed fromml_g
toml_l
(analogously predictionsg_hat
tol_hat
, etc.) to be better in line with Chernozhukov et al. (2018). To make the transition to the new naming smooth, depreciation warnings have been added (see below for examples).score='IV-type'
(Equation (4.7) in Chernozhukov et al. (2018)) is now available for the PLIV model. The estimation of the nuisance parts follows the approach described on p. C33 in Chernozhukov et al. (2018). This means that an initial estimate fortheta_0
is obtained via the'partialling out'
score. Then an estimate forg_0(X)
is obtained by regressingY - theta_0 * D
onX
. Therefore, two additional learners (not needed to evaluate the score) need to be provided, i.e., the nuisance functionsl_0(X)
andr_0(X)
(needed for the preliminarytheta_0
estimate) are estimated with learnerml_l
andml_r
.g_0(X)
is estimated with learnerml_g
.API changes
PLR
DoubleMLPLR(obj_dml_data, ml_g, ml_m [, ...])
toDoubleMLPLR(obj_dml_data, ml_l, ml_m, ml_g [, ...])
.score='partialling out'
ml_l
&ml_m
are needed.score='IV-type'
ml_l
,ml_m
&ml_g
.ml_l
&ml_m
are mandatory andml_g
optional.psi_a, psi_b = score(y, d, g_hat, m_hat, smpls)
topsi_a, psi_b = score(y, d, l_hat, m_hat, g_hat, smpls)
.PLIV
DoubleMLPLIV(obj_dml_data, ml_g, ml_m, ml_r [, ...])
toDoubleMLPLIV(obj_dml_data, ml_g, ml_m, ml_r, ml_g [, ...])
.score='partialling out'
ml_l
,ml_m
&ml_r
are needed.score='IV-type'
ml_l
,ml_m
,ml_r
&ml_g
.ml_l
,ml_m
&ml_r
are mandatory andml_g
optional.psi_a, psi_b = score(y, z, d, g_hat, m_hat, r_hat, smpls)
topsi_a, psi_b = score(y, z, d, l_hat, m_hat, r_hat, g_hat, smpls)
.Depreciation warnings for the API changes for
DoubleMLPLR
andDoubleMLPLIV
score='partialling out'
and if the learners are provided as positional arguments, nothing changed.-- >Note however that, if, besides the learner, other arguments have also been provided as positional arguments, the changed API causes exceptions because the additional learner was added as fourth (PLR) / fifth (PLIV) argument
score='partialling out'
and keyword argumentsml_g
andml_m
(old API naming), the learner provided forml_g
is used forml_l
and a warning is issued.score='IV-type'
and keyword argumentsml_g
andml_m
(old API naming), the learner provided forml_g
is also used forml_l
and a warning is issued. (Note it is first redirected toml_l
and then cloned toml_g
)score='IV-type'
and only two learners as positional arguments, the learner provided forml_g
is used forml_l
and a warning is issued.score='partialling out'
, the methodsset_ml_nuisance_params
andtune
redirectml_g
toml_l
.Miscellaneous
score
is set to a callable, it will in the future be called with keyword-arguments only (instead of positional arguments). This way is "safer" and in some way indirectly checks (up to a certain degree) that the signature of the function is as expected (see docu entry of the argumentscore
for the expected signature). This was implemented for all model classes PLR, PLIV, IRM & IIVMPR Checklist