Skip to content

Restructure doubleml #225

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
merged 33 commits into from
Feb 29, 2024
Merged

Restructure doubleml #225

merged 33 commits into from
Feb 29, 2024

Conversation

SvenKlaassen
Copy link
Member

@SvenKlaassen SvenKlaassen commented Dec 22, 2023

Restructure the package to have a good overview by creating several subpackages.

  • utils: collection of various utilities
  • plm: collection of partially linear models
  • irm: collection of interactive regression models
  • did: collection of difference in differences models

fix bugs:

  • adjusted propensity scores for irm models
  • predictions now include trimming
  • resampling for stratification in irm models

@@ -134,6 +133,11 @@
y_treat = self._dml_data.y[self._dml_data.d == self.treatment]
self._coef_start_val = np.mean(y_treat[y_treat >= np.quantile(y_treat, self.quantile)])

# set stratication for resampling
self._strata = self._dml_data.d

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute _strata, which was previously defined in superclass [DoubleML](1).
@@ -153,6 +152,13 @@
self._coef_bounds = (self._dml_data.y.min(), self._dml_data.y.max())
self._coef_start_val = np.quantile(self._dml_data.y[self._dml_data.d == self.treatment], self.quantile)

# set stratication for resampling
self._strata = self._dml_data.d.reshape(-1, 1) + 2 * self._dml_data.z.reshape(-1, 1)

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute _strata, which was previously defined in superclass [DoubleML](1).
if draw_sample_splitting:
self.draw_sample_splitting()

self._external_predictions_implemented = True

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute _external_predictions_implemented, which was previously defined in superclass [DoubleML](1).
@@ -165,6 +164,13 @@
self._coef_bounds = (self._dml_data.y.min(), self._dml_data.y.max())
self._coef_start_val = np.quantile(self._dml_data.y[self._dml_data.d == self.treatment], self.quantile)

# set stratication for resampling
self._strata = self._dml_data.d

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute _strata, which was previously defined in superclass [DoubleML](1).
if draw_sample_splitting:
self.draw_sample_splitting()

self._external_predictions_implemented = True

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class

Assignment overwrites attribute _external_predictions_implemented, which was previously defined in superclass [DoubleML](1).
@@ -201,13 +204,16 @@
u_hat0, u_hat1, w_hat0, w_hat1, g_hat0, g_hat1, m_hat, r_hat0, r_hat1 = compute_iivm_residuals(
y, d, g_hat0_list, g_hat1_list, m_hat_list, r_hat0_list, r_hat1_list, smpls)

m_hat_adj = np.full_like(m_hat, np.nan, dtype='float64')

Check warning

Code scanning / CodeQL

Variable defined multiple times

This assignment to 'm_hat_adj' is unnecessary as it is [redefined](1) before this value is used. This assignment to 'm_hat_adj' is unnecessary as it is [redefined](2) before this value is used.
@SvenKlaassen SvenKlaassen marked this pull request as ready for review February 29, 2024 07:21
@SvenKlaassen SvenKlaassen merged commit 1ad6ec2 into main Feb 29, 2024
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.

1 participant