diffindiff 2.2.7__tar.gz → 2.3.1__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.1}/PKG-INFO +32 -22
- {diffindiff-2.2.7 → diffindiff-2.3.1}/README.md +31 -21
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/config.py +4 -4
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/didanalysis.py +989 -76
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/didanalysis_helper.py +407 -32
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/diddata.py +1039 -45
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/didtools.py +792 -48
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/tests/tests_diffindiff.py +6 -2
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff.egg-info/PKG-INFO +32 -22
- {diffindiff-2.2.7 → diffindiff-2.3.1}/setup.py +1 -1
- {diffindiff-2.2.7 → diffindiff-2.3.1}/MANIFEST.in +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/__init__.py +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/tests/__init__.py +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/tests/data/Corona_Hesse.xlsx +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/tests/data/counties_DE.csv +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff/tests/data/curfew_DE.csv +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff.egg-info/SOURCES.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff.egg-info/dependency_links.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff.egg-info/requires.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/diffindiff.egg-info/top_level.txt +0 -0
- {diffindiff-2.2.7 → diffindiff-2.3.1}/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.1
|
|
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.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
@@ -52,30 +52,31 @@ 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
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
- Perform standard DiD analysis with pre-post data
|
|
56
|
+
- Perform DiD analysis with two-way fixed effects models
|
|
57
|
+
- Simultaneous and/or staggered adoption are supported
|
|
58
|
+
- Single or multiple treatments are supported
|
|
59
|
+
- Binary or continuous treatments are supported
|
|
60
|
+
- Model extensions for DiD analysis:
|
|
60
61
|
- Group- or individual-specific treatment effects
|
|
61
62
|
- Group- or individual-specific time trends
|
|
62
63
|
- Including covariates
|
|
63
64
|
- Including after-treatment period
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
- Perform Triple Difference (DDD) analysis
|
|
66
|
+
- **Diagnosis tools and extensions of analyses**:
|
|
67
|
+
- Add own counterfactuals or create counterfactuals based on machine learning or OLS regression models
|
|
68
|
+
- Bonferroni correction for treatment effects
|
|
69
|
+
- Placebo test
|
|
70
|
+
- Test for control conditions (automatically within analysis or stand-alone)
|
|
71
|
+
- Test for type of adoption (automatically within analysis or stand-alone)
|
|
72
|
+
- Test whether the panel dataset is balanced (automatically within analysis or stand-alone)
|
|
73
|
+
- Test for parallel trend assumption (automatically within analysis or stand-alone)
|
|
68
74
|
- **Visualization**:
|
|
69
75
|
- Plot observed and expected time course of treatment and control group
|
|
70
76
|
- Plot expected time course of treatment group and counterfactual
|
|
71
77
|
- Plot model coefficients with confidence intervals
|
|
72
78
|
- Plot individual or group-specific treatment effects with confidence intervals
|
|
73
79
|
- 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
80
|
|
|
80
81
|
|
|
81
82
|
## Examples
|
|
@@ -167,9 +168,18 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
167
168
|
- Wooldridge JM (2012) *Introductory Econometrics. A Modern Approach*.
|
|
168
169
|
|
|
169
170
|
|
|
170
|
-
##
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
## AI Usage Statement
|
|
172
|
+
|
|
173
|
+
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-docstrings.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## What's new (v2.3.1)
|
|
177
|
+
|
|
173
178
|
- Bugfixes:
|
|
174
|
-
- didtools.
|
|
175
|
-
-
|
|
179
|
+
- didtools.is_missing(): No "Removing NA" note anymore when no missing values occur
|
|
180
|
+
- didanalyis.did_analysis(): No "xx fixed effects included" notes anymore when FE_unit and/or FE_time are already set to True by user
|
|
181
|
+
- DiffModel methods treatment_statistics() and plot_timeline() now accept continuous treatments (value of treatment variable > 0)
|
|
182
|
+
- didtools function is_parallel() now accepts continuous treatments (value of treatment variable > 0)
|
|
183
|
+
- Added parameter log_outcome_add in method DiffData.analysis()
|
|
184
|
+
- Corrected examples in docstrings
|
|
185
|
+
- Corrected typos in README
|
|
@@ -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.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
## Installation
|
|
@@ -44,30 +44,31 @@ 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
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
- Perform standard DiD analysis with pre-post data
|
|
48
|
+
- Perform DiD analysis with two-way fixed effects models
|
|
49
|
+
- Simultaneous and/or staggered adoption are supported
|
|
50
|
+
- Single or multiple treatments are supported
|
|
51
|
+
- Binary or continuous treatments are supported
|
|
52
|
+
- Model extensions for DiD analysis:
|
|
52
53
|
- Group- or individual-specific treatment effects
|
|
53
54
|
- Group- or individual-specific time trends
|
|
54
55
|
- Including covariates
|
|
55
56
|
- Including after-treatment period
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
- Perform Triple Difference (DDD) analysis
|
|
58
|
+
- **Diagnosis tools and extensions of analyses**:
|
|
59
|
+
- Add own counterfactuals or create counterfactuals based on machine learning or OLS regression models
|
|
60
|
+
- Bonferroni correction for treatment effects
|
|
61
|
+
- Placebo test
|
|
62
|
+
- Test for control conditions (automatically within analysis or stand-alone)
|
|
63
|
+
- Test for type of adoption (automatically within analysis or stand-alone)
|
|
64
|
+
- Test whether the panel dataset is balanced (automatically within analysis or stand-alone)
|
|
65
|
+
- Test for parallel trend assumption (automatically within analysis or stand-alone)
|
|
60
66
|
- **Visualization**:
|
|
61
67
|
- Plot observed and expected time course of treatment and control group
|
|
62
68
|
- Plot expected time course of treatment group and counterfactual
|
|
63
69
|
- Plot model coefficients with confidence intervals
|
|
64
70
|
- Plot individual or group-specific treatment effects with confidence intervals
|
|
65
71
|
- 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
72
|
|
|
72
73
|
|
|
73
74
|
## Examples
|
|
@@ -159,9 +160,18 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
159
160
|
- Wooldridge JM (2012) *Introductory Econometrics. A Modern Approach*.
|
|
160
161
|
|
|
161
162
|
|
|
162
|
-
##
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
## AI Usage Statement
|
|
164
|
+
|
|
165
|
+
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-docstrings.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## What's new (v2.3.1)
|
|
169
|
+
|
|
165
170
|
- Bugfixes:
|
|
166
|
-
- didtools.
|
|
167
|
-
-
|
|
171
|
+
- didtools.is_missing(): No "Removing NA" note anymore when no missing values occur
|
|
172
|
+
- didanalyis.did_analysis(): No "xx fixed effects included" notes anymore when FE_unit and/or FE_time are already set to True by user
|
|
173
|
+
- DiffModel methods treatment_statistics() and plot_timeline() now accept continuous treatments (value of treatment variable > 0)
|
|
174
|
+
- didtools function is_parallel() now accepts continuous treatments (value of treatment variable > 0)
|
|
175
|
+
- Added parameter log_outcome_add in method DiffData.analysis()
|
|
176
|
+
- Corrected examples in docstrings
|
|
177
|
+
- Corrected typos in README
|
|
@@ -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-
|
|
7
|
+
# Version: 1.0.9
|
|
8
|
+
# Last update: 2026-03-03 17:38
|
|
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.1"
|
|
16
16
|
|
|
17
|
-
VERBOSE =
|
|
17
|
+
VERBOSE = False
|
|
18
18
|
|
|
19
19
|
ROUND_STATISTIC = 3
|
|
20
20
|
ROUND_PERCENT = 2
|