You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Full API documentation: `docs/api/pretrends.rst`
21
+
22
+
**Reference**: Roth, J. (2022). "Pretest with Caution: Event-Study Estimates after Testing for Parallel Trends." *American Economic Review: Insights*, 4(3), 305-322.
23
+
24
+
### Fixed
25
+
-**Reference period handling in pre-trends analysis**: Fixed bug where reference period was incorrectly assigned `avg_se` instead of being excluded from power calculations. Now properly excludes the omitted reference period from the joint Wald test.
26
+
8
27
## [1.1.1] - 2026-01-06
9
28
10
29
### Fixed
@@ -215,6 +234,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
215
234
-`to_dict()` and `to_dataframe()` export methods
216
235
-`is_significant` and `significance_stars` properties
A passing pre-trends test doesn't mean parallel trends holds—it may just mean the test has low power. **Pre-Trends Power Analysis** (Roth 2022) answers: "What violations could my pre-trends test have detected?"
1228
+
1229
+
```python
1230
+
from diff_diff import PreTrendsPower, MultiPeriodDiD
print(f"Power to detect violations of size MDV: {power_results.power:.1%}")
1249
+
```
1250
+
1251
+
**Key concepts:**
1252
+
1253
+
-**Minimum Detectable Violation (MDV)**: Smallest violation magnitude that would be detected with your target power (e.g., 80%). Passing the pre-trends test does NOT rule out violations up to this size.
1254
+
-**Power**: Probability of detecting a violation of given size if it exists.
1255
+
-**Violation types**: Linear trend, constant violation, last-period only, or custom patterns.
1256
+
1257
+
**Power curve visualization:**
1258
+
1259
+
```python
1260
+
from diff_diff import plot_pretrends_power
1261
+
1262
+
# Generate power curve across violation magnitudes
1263
+
curve = pt.power_curve(event_results)
1264
+
1265
+
# Plot the power curve
1266
+
plot_pretrends_power(curve, title="Pre-Trends Test Power Curve")
1267
+
1268
+
# Or from the curve object directly
1269
+
curve.plot()
1270
+
```
1271
+
1272
+
**Different violation patterns:**
1273
+
1274
+
```python
1275
+
# Linear trend violations (default) - most common assumption
Placebo tests help validate the parallel trends assumption by checking whether effects appear where they shouldn't (before treatment or in untreated groups).
@@ -1645,6 +1730,81 @@ HonestDiD(
1645
1730
|`plot(ax)`| Plot sensitivity analysis |
1646
1731
|`to_dataframe()`| Convert to pandas DataFrame |
1647
1732
1733
+
### PreTrendsPower
1734
+
1735
+
```python
1736
+
PreTrendsPower(
1737
+
alpha=0.05, # Significance level for pre-trends test
0 commit comments