Skip to content

Commit e432660

Browse files
igerberclaude
andcommitted
Rename TROP method="twostep" to method="local" with deprecation
Rename the per-observation TROP method from "twostep" to "local", forming a natural local/global pair. Both "twostep" and "joint" are now deprecated aliases (removal in v3.0). Also rename internal _joint_* methods to _global_* and Rust exports for consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 405de88 commit e432660

14 files changed

Lines changed: 305 additions & 246 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Rename TROP `method="twostep"` to `method="local"`; `"twostep"` deprecated, removal in v3.0
12+
- Rename internal TROP `_joint_*` methods to `_global_*` for consistency
13+
1014
## [2.7.1] - 2026-03-15
1115

1216
### Changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ category (`Methodology/Correctness`, `Performance`, or `Testing/Docs`):
122122
`threshold = 0.40 if n_boot < 100 else 0.15`.
123123
- **`assert_nan_inference()`** from conftest.py: Use to validate ALL inference fields are
124124
NaN-consistent. Don't check individual fields separately.
125-
- **Slow tests**: TROP methodology/joint-method tests, Sun-Abraham bootstrap, and
125+
- **Slow tests**: TROP methodology/global-method tests, Sun-Abraham bootstrap, and
126126
TROP-parity tests are marked `@pytest.mark.slow` and excluded by default via `addopts`.
127127
`test_trop.py` uses per-class markers (not file-level) so that validation, API, and
128128
solver tests still run in the pure Python CI fallback. Run `pytest -m ''` to include

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ trop = TROP(
15171517

15181518
```python
15191519
TROP(
1520-
method='twostep', # Estimation method: 'twostep' (default) or 'joint'
1520+
method='local', # Estimation method: 'local' (default) or 'global'
15211521
lambda_time_grid=None, # Time decay grid (default: [0, 0.1, 0.5, 1, 2, 5])
15221522
lambda_unit_grid=None, # Unit distance grid (default: [0, 0.1, 0.5, 1, 2, 5])
15231523
lambda_nn_grid=None, # Nuclear norm grid (default: [0, 0.01, 0.1, 1, 10])
@@ -1530,8 +1530,8 @@ TROP(
15301530
```
15311531

15321532
**Estimation methods:**
1533-
- `'twostep'` (default): Per-observation model fitting following Algorithm 2 of the paper. Computes observation-specific weights and fits a model for each treated observation, then averages the individual treatment effects. More flexible but computationally intensive.
1534-
- `'joint'`: Joint weighted least squares optimization. Estimates a single scalar treatment effect τ along with fixed effects and optional low-rank factor adjustment. Faster but assumes homogeneous treatment effects.
1533+
- `'local'` (default): Per-observation model fitting following Algorithm 2 of the paper. Computes observation-specific weights and fits a model for each treated observation, then averages the individual treatment effects. More flexible but computationally intensive.
1534+
- `'global'`: Global weighted least squares optimization. Fits a single model on control observations with global weights, then computes per-observation treatment effects as residuals. Faster but uses global rather than observation-specific weights.
15351535

15361536
**Convenience function:**
15371537

diff_diff/_backend.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
project_simplex as _rust_project_simplex,
2424
solve_ols as _rust_solve_ols,
2525
compute_robust_vcov as _rust_compute_robust_vcov,
26-
# TROP estimator acceleration (twostep method)
26+
# TROP estimator acceleration (local method)
2727
compute_unit_distance_matrix as _rust_unit_distance_matrix,
2828
loocv_grid_search as _rust_loocv_grid_search,
2929
bootstrap_trop_variance as _rust_bootstrap_trop_variance,
30-
# TROP estimator acceleration (joint method)
31-
loocv_grid_search_joint as _rust_loocv_grid_search_joint,
32-
bootstrap_trop_variance_joint as _rust_bootstrap_trop_variance_joint,
30+
# TROP estimator acceleration (global method)
31+
loocv_grid_search_global as _rust_loocv_grid_search_global,
32+
bootstrap_trop_variance_global as _rust_bootstrap_trop_variance_global,
3333
# SDID weights (Frank-Wolfe matching R's synthdid)
3434
compute_sdid_unit_weights as _rust_sdid_unit_weights,
3535
compute_time_weights as _rust_compute_time_weights,
@@ -46,13 +46,13 @@
4646
_rust_project_simplex = None
4747
_rust_solve_ols = None
4848
_rust_compute_robust_vcov = None
49-
# TROP estimator acceleration (twostep method)
49+
# TROP estimator acceleration (local method)
5050
_rust_unit_distance_matrix = None
5151
_rust_loocv_grid_search = None
5252
_rust_bootstrap_trop_variance = None
53-
# TROP estimator acceleration (joint method)
54-
_rust_loocv_grid_search_joint = None
55-
_rust_bootstrap_trop_variance_joint = None
53+
# TROP estimator acceleration (global method)
54+
_rust_loocv_grid_search_global = None
55+
_rust_bootstrap_trop_variance_global = None
5656
# SDID weights (Frank-Wolfe matching R's synthdid)
5757
_rust_sdid_unit_weights = None
5858
_rust_compute_time_weights = None
@@ -69,13 +69,13 @@
6969
_rust_project_simplex = None
7070
_rust_solve_ols = None
7171
_rust_compute_robust_vcov = None
72-
# TROP estimator acceleration (twostep method)
72+
# TROP estimator acceleration (local method)
7373
_rust_unit_distance_matrix = None
7474
_rust_loocv_grid_search = None
7575
_rust_bootstrap_trop_variance = None
76-
# TROP estimator acceleration (joint method)
77-
_rust_loocv_grid_search_joint = None
78-
_rust_bootstrap_trop_variance_joint = None
76+
# TROP estimator acceleration (global method)
77+
_rust_loocv_grid_search_global = None
78+
_rust_bootstrap_trop_variance_global = None
7979
# SDID weights (Frank-Wolfe matching R's synthdid)
8080
_rust_sdid_unit_weights = None
8181
_rust_compute_time_weights = None
@@ -118,13 +118,13 @@ def rust_backend_info():
118118
'_rust_project_simplex',
119119
'_rust_solve_ols',
120120
'_rust_compute_robust_vcov',
121-
# TROP estimator acceleration (twostep method)
121+
# TROP estimator acceleration (local method)
122122
'_rust_unit_distance_matrix',
123123
'_rust_loocv_grid_search',
124124
'_rust_bootstrap_trop_variance',
125-
# TROP estimator acceleration (joint method)
126-
'_rust_loocv_grid_search_joint',
127-
'_rust_bootstrap_trop_variance_joint',
125+
# TROP estimator acceleration (global method)
126+
'_rust_loocv_grid_search_global',
127+
'_rust_bootstrap_trop_variance_global',
128128
# SDID weights (Frank-Wolfe matching R's synthdid)
129129
'_rust_sdid_unit_weights',
130130
'_rust_compute_time_weights',

0 commit comments

Comments
 (0)