diff-diff 2.1.6__tar.gz → 2.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {diff_diff-2.1.6 → diff_diff-2.1.8}/PKG-INFO +14 -9
  2. {diff_diff-2.1.6 → diff_diff-2.1.8}/README.md +13 -8
  3. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/__init__.py +1 -1
  4. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/trop.py +394 -88
  5. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/visualization.py +44 -11
  6. {diff_diff-2.1.6 → diff_diff-2.1.8}/pyproject.toml +1 -1
  7. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/Cargo.lock +5 -5
  8. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/Cargo.toml +1 -1
  9. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/src/trop.rs +217 -45
  10. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/_backend.py +0 -0
  11. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/bacon.py +0 -0
  12. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/datasets.py +0 -0
  13. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/diagnostics.py +0 -0
  14. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/estimators.py +0 -0
  15. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/honest_did.py +0 -0
  16. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/linalg.py +0 -0
  17. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/power.py +0 -0
  18. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/prep.py +0 -0
  19. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/prep_dgp.py +0 -0
  20. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/pretrends.py +0 -0
  21. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/results.py +0 -0
  22. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/staggered.py +0 -0
  23. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/staggered_aggregation.py +0 -0
  24. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/staggered_bootstrap.py +0 -0
  25. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/staggered_results.py +0 -0
  26. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/sun_abraham.py +0 -0
  27. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/synthetic_did.py +0 -0
  28. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/triple_diff.py +0 -0
  29. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/twfe.py +0 -0
  30. {diff_diff-2.1.6 → diff_diff-2.1.8}/diff_diff/utils.py +0 -0
  31. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/src/bootstrap.rs +0 -0
  32. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/src/lib.rs +0 -0
  33. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/src/linalg.rs +0 -0
  34. {diff_diff-2.1.6 → diff_diff-2.1.8}/rust/src/weights.rs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diff-diff
3
- Version: 2.1.6
3
+ Version: 2.1.8
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Intended Audience :: Science/Research
6
6
  Classifier: Operating System :: OS Independent
@@ -1173,13 +1173,15 @@ trop_est = TROP(
1173
1173
  lambda_nn_grid=[0.0, 0.1, 1.0], # Nuclear norm grid
1174
1174
  n_bootstrap=200
1175
1175
  )
1176
+ # Note: TROP infers treatment periods from the treatment indicator column.
1177
+ # The 'treated' column must be an absorbing state (D=1 for all periods
1178
+ # during and after treatment starts for each unit).
1176
1179
  results = trop_est.fit(
1177
1180
  panel_data,
1178
1181
  outcome='gdp_growth',
1179
1182
  treatment='treated',
1180
1183
  unit='state',
1181
- time='year',
1182
- post_periods=[2015, 2016, 2017, 2018]
1184
+ time='year'
1183
1185
  )
1184
1186
 
1185
1187
  # View results
@@ -1267,9 +1269,11 @@ sdid_results = sdid.fit(data, outcome='y', treatment='treated',
1267
1269
  unit='unit', time='time', post_periods=[5,6,7])
1268
1270
 
1269
1271
  # TROP (accounts for factors)
1272
+ # Note: TROP infers treatment periods from the treatment indicator column
1273
+ # (D=1 for treated observations, D=0 for control)
1270
1274
  trop_est = TROP() # Uses default grids with LOOCV selection
1271
1275
  trop_results = trop_est.fit(data, outcome='y', treatment='treated',
1272
- unit='unit', time='time', post_periods=[5,6,7])
1276
+ unit='unit', time='time')
1273
1277
 
1274
1278
  print(f"SDID estimate: {sdid_results.att:.3f}")
1275
1279
  print(f"TROP estimate: {trop_results.att:.3f}")
@@ -1314,13 +1318,13 @@ TROP(
1314
1318
 
1315
1319
  ```python
1316
1320
  # One-liner estimation with default tuning grids
1321
+ # Note: TROP infers treatment periods from the treatment indicator
1317
1322
  results = trop(
1318
1323
  data,
1319
1324
  outcome='y',
1320
1325
  treatment='treated',
1321
1326
  unit='unit',
1322
1327
  time='time',
1323
- post_periods=[5, 6, 7],
1324
1328
  n_bootstrap=200
1325
1329
  )
1326
1330
  ```
@@ -1912,10 +1916,11 @@ TROP(
1912
1916
  |-----------|------|-------------|
1913
1917
  | `data` | DataFrame | Panel data |
1914
1918
  | `outcome` | str | Outcome variable column name |
1915
- | `treatment` | str | Treatment indicator column (0/1) |
1919
+ | `treatment` | str | Treatment indicator column (0/1 absorbing state) |
1916
1920
  | `unit` | str | Unit identifier column |
1917
1921
  | `time` | str | Time period column |
1918
- | `post_periods` | list | List of post-treatment period values |
1922
+
1923
+ Note: TROP infers treatment periods from the treatment indicator column. The treatment column should be an absorbing state indicator where D=1 for all periods during and after treatment starts.
1919
1924
 
1920
1925
  ### TROPResults
1921
1926
 
@@ -1941,8 +1946,8 @@ TROP(
1941
1946
  | `factor_matrix` | Low-rank factor matrix L (n_periods x n_units) |
1942
1947
  | `effective_rank` | Effective rank of factor matrix |
1943
1948
  | `loocv_score` | LOOCV score for selected parameters |
1944
- | `pre_periods` | List of pre-treatment periods |
1945
- | `post_periods` | List of post-treatment periods |
1949
+ | `n_pre_periods` | Number of pre-treatment periods |
1950
+ | `n_post_periods` | Number of post-treatment periods |
1946
1951
  | `variance_method` | Variance estimation method |
1947
1952
  | `bootstrap_distribution` | Bootstrap distribution (if bootstrap) |
1948
1953
 
@@ -1138,13 +1138,15 @@ trop_est = TROP(
1138
1138
  lambda_nn_grid=[0.0, 0.1, 1.0], # Nuclear norm grid
1139
1139
  n_bootstrap=200
1140
1140
  )
1141
+ # Note: TROP infers treatment periods from the treatment indicator column.
1142
+ # The 'treated' column must be an absorbing state (D=1 for all periods
1143
+ # during and after treatment starts for each unit).
1141
1144
  results = trop_est.fit(
1142
1145
  panel_data,
1143
1146
  outcome='gdp_growth',
1144
1147
  treatment='treated',
1145
1148
  unit='state',
1146
- time='year',
1147
- post_periods=[2015, 2016, 2017, 2018]
1149
+ time='year'
1148
1150
  )
1149
1151
 
1150
1152
  # View results
@@ -1232,9 +1234,11 @@ sdid_results = sdid.fit(data, outcome='y', treatment='treated',
1232
1234
  unit='unit', time='time', post_periods=[5,6,7])
1233
1235
 
1234
1236
  # TROP (accounts for factors)
1237
+ # Note: TROP infers treatment periods from the treatment indicator column
1238
+ # (D=1 for treated observations, D=0 for control)
1235
1239
  trop_est = TROP() # Uses default grids with LOOCV selection
1236
1240
  trop_results = trop_est.fit(data, outcome='y', treatment='treated',
1237
- unit='unit', time='time', post_periods=[5,6,7])
1241
+ unit='unit', time='time')
1238
1242
 
1239
1243
  print(f"SDID estimate: {sdid_results.att:.3f}")
1240
1244
  print(f"TROP estimate: {trop_results.att:.3f}")
@@ -1279,13 +1283,13 @@ TROP(
1279
1283
 
1280
1284
  ```python
1281
1285
  # One-liner estimation with default tuning grids
1286
+ # Note: TROP infers treatment periods from the treatment indicator
1282
1287
  results = trop(
1283
1288
  data,
1284
1289
  outcome='y',
1285
1290
  treatment='treated',
1286
1291
  unit='unit',
1287
1292
  time='time',
1288
- post_periods=[5, 6, 7],
1289
1293
  n_bootstrap=200
1290
1294
  )
1291
1295
  ```
@@ -1877,10 +1881,11 @@ TROP(
1877
1881
  |-----------|------|-------------|
1878
1882
  | `data` | DataFrame | Panel data |
1879
1883
  | `outcome` | str | Outcome variable column name |
1880
- | `treatment` | str | Treatment indicator column (0/1) |
1884
+ | `treatment` | str | Treatment indicator column (0/1 absorbing state) |
1881
1885
  | `unit` | str | Unit identifier column |
1882
1886
  | `time` | str | Time period column |
1883
- | `post_periods` | list | List of post-treatment period values |
1887
+
1888
+ Note: TROP infers treatment periods from the treatment indicator column. The treatment column should be an absorbing state indicator where D=1 for all periods during and after treatment starts.
1884
1889
 
1885
1890
  ### TROPResults
1886
1891
 
@@ -1906,8 +1911,8 @@ TROP(
1906
1911
  | `factor_matrix` | Low-rank factor matrix L (n_periods x n_units) |
1907
1912
  | `effective_rank` | Effective rank of factor matrix |
1908
1913
  | `loocv_score` | LOOCV score for selected parameters |
1909
- | `pre_periods` | List of pre-treatment periods |
1910
- | `post_periods` | List of post-treatment periods |
1914
+ | `n_pre_periods` | Number of pre-treatment periods |
1915
+ | `n_post_periods` | Number of post-treatment periods |
1911
1916
  | `variance_method` | Variance estimation method |
1912
1917
  | `bootstrap_distribution` | Bootstrap distribution (if bootstrap) |
1913
1918
 
@@ -136,7 +136,7 @@ from diff_diff.datasets import (
136
136
  load_mpdta,
137
137
  )
138
138
 
139
- __version__ = "2.1.6"
139
+ __version__ = "2.1.8"
140
140
  __all__ = [
141
141
  # Estimators
142
142
  "DifferenceInDifferences",