diffindiff 2.3.1__tar.gz → 2.3.2__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.3.1 → diffindiff-2.3.2}/PKG-INFO +5 -11
- {diffindiff-2.3.1 → diffindiff-2.3.2}/README.md +4 -10
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/config.py +3 -3
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/didanalysis.py +29 -8
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/diddata.py +12 -12
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff.egg-info/PKG-INFO +5 -11
- {diffindiff-2.3.1 → diffindiff-2.3.2}/setup.py +1 -1
- {diffindiff-2.3.1 → diffindiff-2.3.2}/MANIFEST.in +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/__init__.py +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/didanalysis_helper.py +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/didtools.py +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/tests/__init__.py +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/tests/data/Corona_Hesse.xlsx +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/tests/data/counties_DE.csv +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/tests/data/curfew_DE.csv +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff/tests/tests_diffindiff.py +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff.egg-info/SOURCES.txt +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff.egg-info/dependency_links.txt +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff.egg-info/requires.txt +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/diffindiff.egg-info/top_level.txt +0 -0
- {diffindiff-2.3.1 → diffindiff-2.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diffindiff
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
|
|
5
5
|
Author: Thomas Wieland
|
|
6
6
|
Author-email: geowieland@googlemail.com
|
|
@@ -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.3.
|
|
30
|
+
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.3.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
@@ -173,13 +173,7 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
173
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
174
|
|
|
175
175
|
|
|
176
|
-
## What's new (v2.3.
|
|
176
|
+
## What's new (v2.3.2)
|
|
177
177
|
|
|
178
|
-
-
|
|
179
|
-
-
|
|
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
|
|
178
|
+
- Extensions:
|
|
179
|
+
- Re-transform log-transformed outcomes in DiffModel.plot() via parameter 'retransform_log_outcome'
|
|
@@ -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.3.
|
|
22
|
+
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.3.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
## Installation
|
|
@@ -165,13 +165,7 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
165
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
166
|
|
|
167
167
|
|
|
168
|
-
## What's new (v2.3.
|
|
168
|
+
## What's new (v2.3.2)
|
|
169
169
|
|
|
170
|
-
-
|
|
171
|
-
-
|
|
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
|
|
170
|
+
- Extensions:
|
|
171
|
+
- Re-transform log-transformed outcomes in DiffModel.plot() via parameter 'retransform_log_outcome'
|
|
@@ -4,15 +4,15 @@
|
|
|
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-03-
|
|
7
|
+
# Version: 1.0.10
|
|
8
|
+
# Last update: 2026-03-05 21:27
|
|
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.3.
|
|
15
|
+
PACKAGE_VERSION = "2.3.2"
|
|
16
16
|
|
|
17
17
|
VERBOSE = False
|
|
18
18
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# Author: Thomas Wieland
|
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
|
6
6
|
# mail: geowieland@googlemail.com
|
|
7
|
-
# Version: 2.3.
|
|
8
|
-
# Last update: 2026-03-
|
|
7
|
+
# Version: 2.3.2
|
|
8
|
+
# Last update: 2026-03-06 21:26
|
|
9
9
|
# Copyright (c) 2024-2026 Thomas Wieland
|
|
10
10
|
#-----------------------------------------------------------------------
|
|
11
11
|
|
|
@@ -1165,7 +1165,7 @@ class DiffModel:
|
|
|
1165
1165
|
|
|
1166
1166
|
def prediction_intervals(
|
|
1167
1167
|
self,
|
|
1168
|
-
confint_alpha = 0.05
|
|
1168
|
+
confint_alpha: float = 0.05
|
|
1169
1169
|
):
|
|
1170
1170
|
|
|
1171
1171
|
"""
|
|
@@ -1359,11 +1359,11 @@ class DiffModel:
|
|
|
1359
1359
|
self,
|
|
1360
1360
|
treatment: str = None,
|
|
1361
1361
|
TG_col: str = None,
|
|
1362
|
-
x_label = "Time",
|
|
1363
|
-
y_label = "Analysis units",
|
|
1362
|
+
x_label: str = "Time",
|
|
1363
|
+
y_label: str = "Analysis units",
|
|
1364
1364
|
y_lim = None,
|
|
1365
|
-
plot_title = "Treatment time",
|
|
1366
|
-
plot_symbol = "o",
|
|
1365
|
+
plot_title: str = "Treatment time",
|
|
1366
|
+
plot_symbol: str = "o",
|
|
1367
1367
|
treatment_group_only = True
|
|
1368
1368
|
):
|
|
1369
1369
|
|
|
@@ -1485,7 +1485,8 @@ class DiffModel:
|
|
|
1485
1485
|
plot_size: list = [12, 6],
|
|
1486
1486
|
pre_post_ticks: list = ["Pre", "Post"],
|
|
1487
1487
|
pre_post_barplot = False,
|
|
1488
|
-
pre_post_bar_width = 0.5
|
|
1488
|
+
pre_post_bar_width = 0.5,
|
|
1489
|
+
retransform_log_outcome: bool = False
|
|
1489
1490
|
):
|
|
1490
1491
|
|
|
1491
1492
|
"""
|
|
@@ -1529,6 +1530,9 @@ class DiffModel:
|
|
|
1529
1530
|
Plot pre-post as barplot. Default is False.
|
|
1530
1531
|
pre_post_bar_width : float, optional
|
|
1531
1532
|
Bar width when pre_post_barplot is True. Default is 0.5.
|
|
1533
|
+
retransform_log_outcome : bool, optional
|
|
1534
|
+
If outcome was log-transformed, retransform to original scale for plotting.
|
|
1535
|
+
Default is False.
|
|
1532
1536
|
|
|
1533
1537
|
Returns
|
|
1534
1538
|
-------
|
|
@@ -1612,6 +1616,23 @@ class DiffModel:
|
|
|
1612
1616
|
|
|
1613
1617
|
model_data = pd.concat ([model_data, model_predictions], axis = 1)
|
|
1614
1618
|
|
|
1619
|
+
if retransform_log_outcome:
|
|
1620
|
+
|
|
1621
|
+
if model_config["log_outcome"]:
|
|
1622
|
+
|
|
1623
|
+
model_data[outcome_col] = np.exp(model_data[outcome_col])
|
|
1624
|
+
model_data[outcome_col_predicted] = np.exp(model_data[outcome_col_predicted])
|
|
1625
|
+
|
|
1626
|
+
model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[2]] = np.exp(model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[2]])
|
|
1627
|
+
model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[3]] = np.exp(model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[3]])
|
|
1628
|
+
model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[4]] = np.exp(model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[4]])
|
|
1629
|
+
model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[5]] = np.exp(model_data[config.PREDICTIONS_SUMMARY_FRAME_COLS_LIST[5]])
|
|
1630
|
+
|
|
1631
|
+
print("NOTE: Outcome variable was log-transformed, Re-transformation was applied.")
|
|
1632
|
+
|
|
1633
|
+
else:
|
|
1634
|
+
print("NOTE: Parameter 'retransform_log_outcome' was set to True, but outcome variable was not log-transformed. No re-transformation applied.")
|
|
1635
|
+
|
|
1615
1636
|
model_data_TG = model_data[model_data[TG_col] == 1]
|
|
1616
1637
|
model_data_CG = model_data[model_data[TG_col] == 0]
|
|
1617
1638
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# Author: Thomas Wieland
|
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
|
6
6
|
# mail: geowieland@googlemail.com
|
|
7
|
-
# Version: 2.2.
|
|
8
|
-
# Last update: 2026-03-
|
|
7
|
+
# Version: 2.2.2
|
|
8
|
+
# Last update: 2026-03-06 21:27
|
|
9
9
|
# Copyright (c) 2024-2026 Thomas Wieland
|
|
10
10
|
#-----------------------------------------------------------------------
|
|
11
11
|
|
|
@@ -174,7 +174,7 @@ class DiffGroups:
|
|
|
174
174
|
def add_segmentation(
|
|
175
175
|
self,
|
|
176
176
|
group_benefit: list,
|
|
177
|
-
verbose: bool =
|
|
177
|
+
verbose: bool = False
|
|
178
178
|
):
|
|
179
179
|
|
|
180
180
|
"""
|
|
@@ -236,7 +236,7 @@ def create_groups(
|
|
|
236
236
|
treatment_group,
|
|
237
237
|
control_group,
|
|
238
238
|
treatment_name: str = None,
|
|
239
|
-
verbose: bool =
|
|
239
|
+
verbose: bool = False
|
|
240
240
|
):
|
|
241
241
|
|
|
242
242
|
"""
|
|
@@ -538,7 +538,7 @@ def create_treatment(
|
|
|
538
538
|
treatment_name: str = None,
|
|
539
539
|
pre_post: bool = False,
|
|
540
540
|
after_treatment_period: bool = False,
|
|
541
|
-
verbose =
|
|
541
|
+
verbose = False
|
|
542
542
|
):
|
|
543
543
|
|
|
544
544
|
"""
|
|
@@ -1181,7 +1181,7 @@ class DiffData:
|
|
|
1181
1181
|
print(f"WARNING: Additional data frame includes duplicate column names: {', '.join(existing_variables)}")
|
|
1182
1182
|
|
|
1183
1183
|
return self
|
|
1184
|
-
|
|
1184
|
+
|
|
1185
1185
|
def add_treatment(
|
|
1186
1186
|
self,
|
|
1187
1187
|
treatment_name: str,
|
|
@@ -1190,7 +1190,7 @@ class DiffData:
|
|
|
1190
1190
|
control_group,
|
|
1191
1191
|
after_treatment_period: bool = False,
|
|
1192
1192
|
after_treatment_name = None,
|
|
1193
|
-
verbose: bool =
|
|
1193
|
+
verbose: bool = False
|
|
1194
1194
|
):
|
|
1195
1195
|
|
|
1196
1196
|
"""
|
|
@@ -1389,7 +1389,7 @@ class DiffData:
|
|
|
1389
1389
|
treatment_name: str,
|
|
1390
1390
|
after_treatment_period: bool = False,
|
|
1391
1391
|
after_treatment_name: str = None,
|
|
1392
|
-
verbose: bool =
|
|
1392
|
+
verbose: bool = False
|
|
1393
1393
|
):
|
|
1394
1394
|
|
|
1395
1395
|
"""
|
|
@@ -1613,7 +1613,7 @@ class DiffData:
|
|
|
1613
1613
|
counterfactual_outcome_col: str,
|
|
1614
1614
|
time_col: str,
|
|
1615
1615
|
counterfactual_UID: str = "counterfac",
|
|
1616
|
-
verbose: bool =
|
|
1616
|
+
verbose: bool = False
|
|
1617
1617
|
):
|
|
1618
1618
|
|
|
1619
1619
|
"""
|
|
@@ -1815,7 +1815,7 @@ class DiffData:
|
|
|
1815
1815
|
bonferroni: bool = False,
|
|
1816
1816
|
drop_missing: bool = True,
|
|
1817
1817
|
missing_replace_by_zero: bool = False,
|
|
1818
|
-
verbose: bool =
|
|
1818
|
+
verbose: bool = False
|
|
1819
1819
|
):
|
|
1820
1820
|
|
|
1821
1821
|
"""
|
|
@@ -1998,7 +1998,7 @@ def merge_data(
|
|
|
1998
1998
|
drop_missing: bool = True,
|
|
1999
1999
|
missing_replace_by_zero: bool = False,
|
|
2000
2000
|
keep_columns: bool = False,
|
|
2001
|
-
verbose: bool =
|
|
2001
|
+
verbose: bool = False
|
|
2002
2002
|
):
|
|
2003
2003
|
|
|
2004
2004
|
"""
|
|
@@ -2190,7 +2190,7 @@ def create_data(
|
|
|
2190
2190
|
after_treatment_period: bool = False,
|
|
2191
2191
|
drop_missing: bool = True,
|
|
2192
2192
|
missing_replace_by_zero: bool = False,
|
|
2193
|
-
verbose: bool =
|
|
2193
|
+
verbose: bool = False
|
|
2194
2194
|
):
|
|
2195
2195
|
|
|
2196
2196
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diffindiff
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
|
|
5
5
|
Author: Thomas Wieland
|
|
6
6
|
Author-email: geowieland@googlemail.com
|
|
@@ -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.3.
|
|
30
|
+
Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.3.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
@@ -173,13 +173,7 @@ See the /tests directory for usage examples of most of the included functions.
|
|
|
173
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
174
|
|
|
175
175
|
|
|
176
|
-
## What's new (v2.3.
|
|
176
|
+
## What's new (v2.3.2)
|
|
177
177
|
|
|
178
|
-
-
|
|
179
|
-
-
|
|
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
|
|
178
|
+
- Extensions:
|
|
179
|
+
- Re-transform log-transformed outcomes in DiffModel.plot() via parameter 'retransform_log_outcome'
|
|
@@ -7,7 +7,7 @@ def read_README():
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='diffindiff',
|
|
10
|
-
version='2.3.
|
|
10
|
+
version='2.3.2',
|
|
11
11
|
description='diffindiff: Python library for convenient Difference-in-Differences analyses',
|
|
12
12
|
packages=find_packages(include=["diffindiff", "diffindiff.tests"]),
|
|
13
13
|
include_package_data=True,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|