diffindiff 2.2.7__tar.gz → 2.3.0__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.
- {diffindiff-2.2.7 → diffindiff-2.3.0}/PKG-INFO +34 -22
- {diffindiff-2.2.7 → diffindiff-2.3.0}/README.md +33 -21
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/config.py +4 -4
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/didanalysis.py +938 -52
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/didanalysis_helper.py +407 -32
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/diddata.py +1033 -43
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/didtools.py +728 -24
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/tests/tests_diffindiff.py +6 -2
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff.egg-info/PKG-INFO +34 -22
- {diffindiff-2.2.7 → diffindiff-2.3.0}/setup.py +1 -1
- {diffindiff-2.2.7 → diffindiff-2.3.0}/MANIFEST.in +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/__init__.py +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/tests/__init__.py +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/tests/data/Corona_Hesse.xlsx +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/tests/data/counties_DE.csv +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff/tests/data/curfew_DE.csv +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff.egg-info/SOURCES.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff.egg-info/dependency_links.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff.egg-info/requires.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/diffindiff.egg-info/top_level.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diffindiff
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
|
|
5
5
|
Author: Thomas Wieland
|
|
6
6
|
Author-email: geowieland@googlemail.com
|
|
@@ -8,7 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
|
|
9
9
|
# diffindiff: Python library for convenient Difference-in-Differences analyses
|
|
10
10
|
|
|
11
|
-
This Python library is designed for performing Difference-in-Differences (DiD) analyses in a convenient way. It allows users to construct datasets, define treatment and control groups, and set treatment periods. DiD model analyses may be conducted with both datasets created by built-in functions and ready-to-use external datasets. Both simultaneous and staggered adoption are supported. The library allows for various extensions, such as two-way fixed effects models, group- or individual-specific effects, post-treatment periods, and triple-difference estimations. Additionally, it includes functions for visualizing results, such as plotting DiD coefficients with confidence intervals and illustrating the temporal evolution of staggered treatments. Furthermore, several functions for rigorous treatment setting and data diagnostics are incorporated.
|
|
11
|
+
This Python library is designed for performing Difference-in-Differences (DiD) analyses in a convenient way. The package is intended to be used in econometric analyses of natural experiments by researchers in economics, marketing, economic geography, and health sciences. It is designed to cover the entire workflow of a DiD analysis, while not requiring extensive programming skills. The package allows users to construct datasets, define treatment and control groups, and set treatment periods. DiD model analyses may be conducted with both datasets created by built-in functions and ready-to-use external datasets. Both simultaneous and staggered adoption are supported. The library allows for various extensions, such as two-way fixed effects models, group- or individual-specific effects, post-treatment periods, and triple-difference estimations. Additionally, it includes functions for visualizing results, such as plotting DiD coefficients with confidence intervals and illustrating the temporal evolution of staggered treatments. Furthermore, several functions for rigorous treatment setting and data diagnostics are incorporated.
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
## Author
|
|
@@ -27,7 +27,7 @@ Thomas Wieland [ORCID](https://orcid.org/0000-0001-5168-9846) [EMail](mailto:geo
|
|
|
27
27
|
|
|
28
28
|
If you use this software, please cite:
|
|
29
29
|
|
|
30
|
-
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.
|
|
30
|
+
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.3.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
@@ -52,30 +52,30 @@ pip install git+https://github.com/geowieland/diffindiff_official.git
|
|
|
52
52
|
- Create ready-to-fit DiD data objects
|
|
53
53
|
- Create predictive counterfactuals
|
|
54
54
|
- **DiD analysis**:
|
|
55
|
-
- Perfom standard DiD analysis
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
- Perfom standard DiD analysis with pre-post data
|
|
56
|
+
- Perfom DiD analysis with two-way fixed effects models
|
|
57
|
+
- Simultaneous and/or staggered adoption are supported
|
|
58
|
+
- Single or multiple treatments are supported
|
|
59
|
+
- Model extensions for DiD analysis:
|
|
60
60
|
- Group- or individual-specific treatment effects
|
|
61
61
|
- Group- or individual-specific time trends
|
|
62
62
|
- Including covariates
|
|
63
63
|
- Including after-treatment period
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
- Perform Triple Difference (DDD) analysis
|
|
65
|
+
- **Diagnosis tools and extensions of analyses**:
|
|
66
|
+
- Add own counterfactuals or create counterfactuals based on machine learning or OLS regression models
|
|
67
|
+
- Bonferroni correction for treatment effects
|
|
68
|
+
- Placebo test
|
|
69
|
+
- Test for control conditions
|
|
70
|
+
- Test for type of adoption
|
|
71
|
+
- Test whether the panel dataset is balanced
|
|
72
|
+
- Test for parallel trend assumption
|
|
68
73
|
- **Visualization**:
|
|
69
74
|
- Plot observed and expected time course of treatment and control group
|
|
70
75
|
- Plot expected time course of treatment group and counterfactual
|
|
71
76
|
- Plot model coefficients with confidence intervals
|
|
72
77
|
- Plot individual or group-specific treatment effects with confidence intervals
|
|
73
78
|
- Visualize the temporal evolution of staggered treatments
|
|
74
|
-
- **Diagnosis tools**:
|
|
75
|
-
- Test for control conditions
|
|
76
|
-
- Test for type of adoption
|
|
77
|
-
- Test whether the panel dataset is balanced
|
|
78
|
-
- Test for parallel trend assumption
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
## Examples
|
|
@@ -167,9 +167,21 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
167
167
|
- Wooldridge JM (2012) *Introductory Econometrics. A Modern Approach*.
|
|
168
168
|
|
|
169
169
|
|
|
170
|
-
##
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
## AI Usage Statement
|
|
171
|
+
|
|
172
|
+
This software was developed without the use of AI-generated code. The Continue Agent in Microsoft Visual Studio Code using the GPT-5 mini model (by OpenAI) was used solely to assist in drafting and refining docstrings for documentation. The corresponding guidelines and constraints defined by the author are documented in `Agents.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## What's new (v2.3.0)
|
|
176
|
+
|
|
177
|
+
- General
|
|
178
|
+
- Full documentation (docstring in NumPy style) of all classes, methods, and functions
|
|
179
|
+
- Extended information in README
|
|
180
|
+
- Extensions
|
|
181
|
+
- Timestamps for all methods creating or changing DiffGroups, DiffTreatment, DiffData and DiffModel objects
|
|
182
|
+
- Hyperparameters and other config information in didtools.model_wrapper() are now saved
|
|
183
|
+
- All summary methods return self
|
|
173
184
|
- Bugfixes:
|
|
174
|
-
-
|
|
175
|
-
-
|
|
185
|
+
- Correct check of input lists in didanalysis_helper functions create_spillover() and extract_model_results()
|
|
186
|
+
- Correct check of input lists in DiffData methods add_covariates() and analysis()
|
|
187
|
+
- Correct check of input lists in didanalysis functions did_analysis() and ddd_analysis()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# diffindiff: Python library for convenient Difference-in-Differences analyses
|
|
2
2
|
|
|
3
|
-
This Python library is designed for performing Difference-in-Differences (DiD) analyses in a convenient way. It allows users to construct datasets, define treatment and control groups, and set treatment periods. DiD model analyses may be conducted with both datasets created by built-in functions and ready-to-use external datasets. Both simultaneous and staggered adoption are supported. The library allows for various extensions, such as two-way fixed effects models, group- or individual-specific effects, post-treatment periods, and triple-difference estimations. Additionally, it includes functions for visualizing results, such as plotting DiD coefficients with confidence intervals and illustrating the temporal evolution of staggered treatments. Furthermore, several functions for rigorous treatment setting and data diagnostics are incorporated.
|
|
3
|
+
This Python library is designed for performing Difference-in-Differences (DiD) analyses in a convenient way. The package is intended to be used in econometric analyses of natural experiments by researchers in economics, marketing, economic geography, and health sciences. It is designed to cover the entire workflow of a DiD analysis, while not requiring extensive programming skills. The package allows users to construct datasets, define treatment and control groups, and set treatment periods. DiD model analyses may be conducted with both datasets created by built-in functions and ready-to-use external datasets. Both simultaneous and staggered adoption are supported. The library allows for various extensions, such as two-way fixed effects models, group- or individual-specific effects, post-treatment periods, and triple-difference estimations. Additionally, it includes functions for visualizing results, such as plotting DiD coefficients with confidence intervals and illustrating the temporal evolution of staggered treatments. Furthermore, several functions for rigorous treatment setting and data diagnostics are incorporated.
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Author
|
|
@@ -19,7 +19,7 @@ Thomas Wieland [ORCID](https://orcid.org/0000-0001-5168-9846) [EMail](mailto:geo
|
|
|
19
19
|
|
|
20
20
|
If you use this software, please cite:
|
|
21
21
|
|
|
22
|
-
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.
|
|
22
|
+
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.3.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
## Installation
|
|
@@ -44,30 +44,30 @@ pip install git+https://github.com/geowieland/diffindiff_official.git
|
|
|
44
44
|
- Create ready-to-fit DiD data objects
|
|
45
45
|
- Create predictive counterfactuals
|
|
46
46
|
- **DiD analysis**:
|
|
47
|
-
- Perfom standard DiD analysis
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
- Perfom standard DiD analysis with pre-post data
|
|
48
|
+
- Perfom DiD analysis with two-way fixed effects models
|
|
49
|
+
- Simultaneous and/or staggered adoption are supported
|
|
50
|
+
- Single or multiple treatments are supported
|
|
51
|
+
- Model extensions for DiD analysis:
|
|
52
52
|
- Group- or individual-specific treatment effects
|
|
53
53
|
- Group- or individual-specific time trends
|
|
54
54
|
- Including covariates
|
|
55
55
|
- Including after-treatment period
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
- Perform Triple Difference (DDD) analysis
|
|
57
|
+
- **Diagnosis tools and extensions of analyses**:
|
|
58
|
+
- Add own counterfactuals or create counterfactuals based on machine learning or OLS regression models
|
|
59
|
+
- Bonferroni correction for treatment effects
|
|
60
|
+
- Placebo test
|
|
61
|
+
- Test for control conditions
|
|
62
|
+
- Test for type of adoption
|
|
63
|
+
- Test whether the panel dataset is balanced
|
|
64
|
+
- Test for parallel trend assumption
|
|
60
65
|
- **Visualization**:
|
|
61
66
|
- Plot observed and expected time course of treatment and control group
|
|
62
67
|
- Plot expected time course of treatment group and counterfactual
|
|
63
68
|
- Plot model coefficients with confidence intervals
|
|
64
69
|
- Plot individual or group-specific treatment effects with confidence intervals
|
|
65
70
|
- Visualize the temporal evolution of staggered treatments
|
|
66
|
-
- **Diagnosis tools**:
|
|
67
|
-
- Test for control conditions
|
|
68
|
-
- Test for type of adoption
|
|
69
|
-
- Test whether the panel dataset is balanced
|
|
70
|
-
- Test for parallel trend assumption
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
## Examples
|
|
@@ -159,9 +159,21 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
159
159
|
- Wooldridge JM (2012) *Introductory Econometrics. A Modern Approach*.
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
##
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
## AI Usage Statement
|
|
163
|
+
|
|
164
|
+
This software was developed without the use of AI-generated code. The Continue Agent in Microsoft Visual Studio Code using the GPT-5 mini model (by OpenAI) was used solely to assist in drafting and refining docstrings for documentation. The corresponding guidelines and constraints defined by the author are documented in `Agents.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
## What's new (v2.3.0)
|
|
168
|
+
|
|
169
|
+
- General
|
|
170
|
+
- Full documentation (docstring in NumPy style) of all classes, methods, and functions
|
|
171
|
+
- Extended information in README
|
|
172
|
+
- Extensions
|
|
173
|
+
- Timestamps for all methods creating or changing DiffGroups, DiffTreatment, DiffData and DiffModel objects
|
|
174
|
+
- Hyperparameters and other config information in didtools.model_wrapper() are now saved
|
|
175
|
+
- All summary methods return self
|
|
165
176
|
- Bugfixes:
|
|
166
|
-
-
|
|
167
|
-
-
|
|
177
|
+
- Correct check of input lists in didanalysis_helper functions create_spillover() and extract_model_results()
|
|
178
|
+
- Correct check of input lists in DiffData methods add_covariates() and analysis()
|
|
179
|
+
- Correct check of input lists in didanalysis functions did_analysis() and ddd_analysis()
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
# Author: Thomas Wieland
|
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
|
6
6
|
# mail: geowieland@googlemail.com
|
|
7
|
-
# Version: 1.0.
|
|
8
|
-
# Last update: 2026-02-
|
|
7
|
+
# Version: 1.0.8
|
|
8
|
+
# Last update: 2026-02-27 21:55
|
|
9
9
|
# Copyright (c) 2025-2026 Thomas Wieland
|
|
10
10
|
#-----------------------------------------------------------------------
|
|
11
11
|
|
|
12
12
|
# Basic config:
|
|
13
13
|
|
|
14
14
|
PACKAGE_NAME = "diffindiff"
|
|
15
|
-
PACKAGE_VERSION = "2.
|
|
15
|
+
PACKAGE_VERSION = "2.3.0"
|
|
16
16
|
|
|
17
|
-
VERBOSE =
|
|
17
|
+
VERBOSE = False
|
|
18
18
|
|
|
19
19
|
ROUND_STATISTIC = 3
|
|
20
20
|
ROUND_PERCENT = 2
|