Skip to content

Fix the confounding parameter name in the sensitivity docstrings - #1072

Open
VenishPaneliya wants to merge 1 commit into
py-why:mainfrom
VenishPaneliya:sensitivity-c-t-docs
Open

VenishPaneliya wants to merge 1 commit into
py-why:mainfrom
VenishPaneliya:sensitivity-c-t-docs

Conversation

@VenishPaneliya

Copy link
Copy Markdown
Contributor

sensitivity_summary and sensitivity_interval take c_y and c_t, but all six overloads document the second one as c_d, which they do not accept:

file methods documented in signature
dml/causal_forest.py both c_d c_t
dml/dml.py both c_d c_t
dr/_drlearner.py both c_d c_t

The existing description, "The level of confounding in the treatment. Ranges from 0 to 1.", already matches c_t, so only the name changes.

Two things I deliberately left alone rather than guess at:

  • rho is undocumented in all six. It has no docstring anywhere in the package — the implementation these forward to, validate/sensitivity_analysis.py, has none either — so I did not invent a description.
  • sensitivity_summary in dr/_drlearner.py does not document its T argument, though sensitivity_interval next to it does.

Happy to add those if you tell me how rho should be described.

Docs only, no behaviour change. ruff check reports the same before and after.

@kbattocchi

Copy link
Copy Markdown
Member

Thanks for the contribution! rho is the worst case correlation between the estimation errors in Y and T, so should be in the range [-1, 1], with ±1 being the most conservative choices. It would be good to document this and also document the T argument to sensitivity_summary.

@VenishPaneliya

Copy link
Copy Markdown
Contributor Author

Thanks, that's much clearer than what I would have written. I've used your wording for rho on all six overloads and documented T on sensitivity_summary in _drlearner.py so it matches the sensitivity_interval next to it.

One thing I wasn't sure about: rho defaults to 1., i.e. the most conservative end of the range. Is that intentional as a worst-case-by-default, or would a user typically be expected to pass an estimate from their own domain knowledge?

sensitivity_summary and sensitivity_interval take c_y and c_t, but all
six overloads documented the second one as c_d, which they do not accept.
The existing description, "The level of confounding in the treatment",
already matched c_t, so only the name changed.

Following review, rho is now documented on all six as the worst case
correlation between the estimation errors in Y and T, in the range
[-1, 1] with -1 and 1 the most conservative choices, and
sensitivity_summary in _drlearner.py documents its T argument, matching
sensitivity_interval next to it.

Signed-off-by: VenishPaneliya <141703684+VenishPaneliya@users.noreply.github.com>
@kbattocchi

Copy link
Copy Markdown
Member

Thanks, that's much clearer than what I would have written. I've used your wording for rho on all six overloads and documented T on sensitivity_summary in _drlearner.py so it matches the sensitivity_interval next to it.

One thing I wasn't sure about: rho defaults to 1., i.e. the most conservative end of the range. Is that intentional as a worst-case-by-default, or would a user typically be expected to pass an estimate from their own domain knowledge?

Yes, it's intentionally the worst case by default and we don't generally expect users to modify it; the point of the sensitivity analysis is to understand how susceptible our estimates are to unmeasured confounders, so typically worst-case confounding is what we expect people to care about.

@kbattocchi kbattocchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

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.

2 participants