Skip to content

Add possibility of user defined bandwidth in rdrobust #343

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions doubleml/rdd/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def __init__(

self._check_effect_sign()

# TODO: Add further input checks
if ("h", "b") & kwargs.keys():
warnings.warn(f"Key-worded arguments contain: {('h', 'b') & kwargs.keys()}. \n \
Iterative bandwidth selection will be overwritten by provided values.")

self.kwargs = kwargs

self._smpls = DoubleMLResampling(
Expand Down Expand Up @@ -453,10 +456,12 @@ def _update_weights(self):
def _fit_rdd(self, h=None, b=None):
if self.fuzzy:
rdd_res = rdrobust.rdrobust(
y=self._M_Y[:, self._i_rep], x=self._score, fuzzy=self._M_D[:, self._i_rep], h=h, b=b, **self.kwargs
y=self._M_Y[:, self._i_rep], x=self._score, fuzzy=self._M_D[:, self._i_rep],
c=0, **({"h": h, "b": b} | self.kwargs)
)
else:
rdd_res = rdrobust.rdrobust(y=self._M_Y[:, self._i_rep], x=self._score, h=h, b=b, **self.kwargs)
rdd_res = rdrobust.rdrobust(y=self._M_Y[:, self._i_rep], x=self._score, fuzzy=None,
c=0, **({"h": h, "b": b} | self.kwargs))
return rdd_res

def _set_coefs(self, rdd_res, h):
Expand Down