Skip to content

fix: respect use_other_treat_as_covariate in DoubleMLVector sub-models - #443

Open
vrjdev wants to merge 1 commit into
DoubleML:mainfrom
vrjdev:fix-plrvector-use-other-treat
Open

vrjdev wants to merge 1 commit into
DoubleML:mainfrom
vrjdev:fix-plrvector-use-other-treat

Conversation

@vrjdev

@vrjdev vrjdev commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Description

DoubleMLVector._get_data_for_model always appended the other treatment columns to the covariates of each single-treatment sub-model, ignoring DoubleMLData(use_other_treat_as_covariate=False). PLRVector therefore fitted a different model than requested, and a different one from the legacy DoubleMLPLR on the same data.

  • doubleml/double_ml_vector.py: append the other treatments only if use_other_treat_as_covariate is True, as DoubleMLData.set_x_d does.
    • The default behaviour (True) is unchanged.
    • The docstring is updated. Its old rationale ("so that the DoubleMLScalar single-treatment check passes") didn't hold: the sub-models pass all checks without the extra columns.
  • doubleml/plm/tests/test_plr_vector_vs_plr.py:
    • The comparison with the legacy DoubleMLPLR (coefficients, standard errors, per-repetition values, sensitivity elements) now runs for both values of use_other_treat_as_covariate.
    • A new test_submodel_covariates checks each sub-model's covariates.
    • The False cases (64 of 128) fail before the fix.

Reference to Issues or PRs

Fixes #442

Comments

This only affects the unreleased vector API from #394.

#441 (the fix for #440) also changes double_ml_vector.py and test_plr_vector_vs_plr.py, in different places. The two PRs merge cleanly in either order. With both applied, the benchmark test added in #441 also runs, and passes, for use_other_treat_as_covariate=False.

PR Checklist

  • The title of the pull request summarizes the changes made.
  • The PR contains a detailed description of all changes and additions.
  • References to related issues or PRs are added.
  • The code passes all (unit) tests.
  • Enhancements or new feature are equipped with unit tests.
  • The changes adhere to the PEP8 standards.

DoubleMLVector._get_data_for_model always appended the other treatment
columns to the covariates of each single-treatment sub-model, ignoring
DoubleMLData(use_other_treat_as_covariate=False). PLRVector therefore fitted
a different model than the legacy DoubleMLPLR on the same data. Append the
other treatments only if use_other_treat_as_covariate is True, as
DoubleMLData.set_x_d does.

Run the PLRVector vs DoubleMLPLR comparison tests for both values of the flag
and check the covariates of each sub-model.
@JanTeichertKluge
JanTeichertKluge self-requested a review November 2, 2026 20:47

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: PLRVector ignores use_other_treat_as_covariate=False and always adds the other treatments as covariates

1 participant