mergeron 2024.738946.0__py3-none-any.whl → 2024.738949.0__py3-none-any.whl
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.
Potentially problematic release.
This version of mergeron might be problematic. Click here for more details.
- mergeron/core/excel_helper.py +38 -25
- mergeron/core/proportions_tests.py +12 -10
- mergeron/examples/guidelines_enforcement_patterns.py +2 -2
- mergeron/examples/investigations_stats_sim_tables.py +1 -1
- mergeron/examples/visualize_guidelines_tests.py +1 -1
- {mergeron-2024.738946.0.dist-info → mergeron-2024.738949.0.dist-info}/METADATA +1 -2
- {mergeron-2024.738946.0.dist-info → mergeron-2024.738949.0.dist-info}/RECORD +8 -8
- {mergeron-2024.738946.0.dist-info → mergeron-2024.738949.0.dist-info}/WHEEL +0 -0
mergeron/core/excel_helper.py
CHANGED
|
@@ -14,16 +14,29 @@ from .. import _PKG_NAME # noqa: TID252
|
|
|
14
14
|
|
|
15
15
|
__version__ = version(_PKG_NAME)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
from
|
|
17
|
+
import enum
|
|
18
|
+
from collections.abc import Mapping, Sequence
|
|
19
|
+
from types import MappingProxyType
|
|
20
|
+
from typing import Any
|
|
19
21
|
|
|
20
|
-
import aenum # type: ignore
|
|
21
22
|
import numpy as np
|
|
22
23
|
import numpy.typing as npt
|
|
23
24
|
import xlsxwriter # type: ignore
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
@enum.unique
|
|
28
|
+
class CFmtParent(dict[str, Any], enum.ReprEnum):
|
|
29
|
+
def merge(self, _other) -> CFmtParent:
|
|
30
|
+
if isinstance(_other, CFmtParent):
|
|
31
|
+
return self.value | _other.value
|
|
32
|
+
else:
|
|
33
|
+
raise RuntimeWarning(
|
|
34
|
+
f"Object {_other!r} not valid for merge(), returned original."
|
|
35
|
+
)
|
|
36
|
+
return self.value
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CFmt(CFmtParent): # type: ignore
|
|
27
40
|
"""
|
|
28
41
|
Initialize cell formats for xlsxwriter.
|
|
29
42
|
|
|
@@ -35,31 +48,31 @@ class CFmt(aenum.UniqueEnum): # type: ignore
|
|
|
35
48
|
See, https://xlsxwriter.readthedocs.io/format.html
|
|
36
49
|
"""
|
|
37
50
|
|
|
38
|
-
XL_DEFAULT
|
|
39
|
-
XL_DEFAULT_2003
|
|
51
|
+
XL_DEFAULT = MappingProxyType({"font_name": "Calibri", "font_size": 11})
|
|
52
|
+
XL_DEFAULT_2003 = MappingProxyType({"font_name": "Arial", "font_size": 10})
|
|
40
53
|
|
|
41
|
-
A_CTR
|
|
42
|
-
A_CTR_ACROSS
|
|
43
|
-
A_LEFT
|
|
44
|
-
A_RIGHT
|
|
54
|
+
A_CTR = MappingProxyType({"align": "center"})
|
|
55
|
+
A_CTR_ACROSS = MappingProxyType({"align": "center_across"})
|
|
56
|
+
A_LEFT = MappingProxyType({"align": "left"})
|
|
57
|
+
A_RIGHT = MappingProxyType({"align": "right"})
|
|
45
58
|
|
|
46
|
-
BOLD
|
|
47
|
-
ITALIC
|
|
48
|
-
ULINE
|
|
59
|
+
BOLD = MappingProxyType({"bold": True})
|
|
60
|
+
ITALIC = MappingProxyType({"italic": True})
|
|
61
|
+
ULINE = MappingProxyType({"underline": True})
|
|
49
62
|
|
|
50
|
-
TEXT_WRAP
|
|
51
|
-
IND_1
|
|
63
|
+
TEXT_WRAP = MappingProxyType({"text_wrap": True})
|
|
64
|
+
IND_1 = MappingProxyType({"indent": 1})
|
|
52
65
|
|
|
53
|
-
DOLLAR_NUM
|
|
54
|
-
DT_NUM
|
|
55
|
-
QTY_NUM
|
|
56
|
-
PCT_NUM
|
|
57
|
-
AREA_NUM
|
|
66
|
+
DOLLAR_NUM = MappingProxyType({"num_format": "[$$-409]#,##0.00"})
|
|
67
|
+
DT_NUM = MappingProxyType({"num_format": "mm/dd/yyyy"})
|
|
68
|
+
QTY_NUM = MappingProxyType({"num_format": "#,##0.0"})
|
|
69
|
+
PCT_NUM = MappingProxyType({"num_format": "##0.000000%"})
|
|
70
|
+
AREA_NUM = MappingProxyType({"num_format": "0.00000000"})
|
|
58
71
|
|
|
59
|
-
BAR_FILL
|
|
60
|
-
BOT_BORDER
|
|
61
|
-
TOP_BORDER
|
|
62
|
-
HDR_BORDER
|
|
72
|
+
BAR_FILL = MappingProxyType({"pattern": 1, "bg_color": "dfeadf"})
|
|
73
|
+
BOT_BORDER = MappingProxyType({"bottom": 1, "bottom_color": "000000"})
|
|
74
|
+
TOP_BORDER = MappingProxyType({"top": 1, "top_color": "000000"})
|
|
75
|
+
HDR_BORDER = TOP_BORDER | BOT_BORDER
|
|
63
76
|
|
|
64
77
|
|
|
65
78
|
def matrix_to_sheet(
|
|
@@ -216,7 +229,7 @@ def xl_fmt(
|
|
|
216
229
|
:code:`xlsxwriter` `Format` object
|
|
217
230
|
|
|
218
231
|
"""
|
|
219
|
-
_cell_fmt_dict:
|
|
232
|
+
_cell_fmt_dict: Mapping[str, Any] = MappingProxyType({})
|
|
220
233
|
if isinstance(_cell_fmt, tuple):
|
|
221
234
|
ensure_cell_format_spec_tuple(_cell_fmt)
|
|
222
235
|
for _cf in _cell_fmt:
|
|
@@ -7,6 +7,7 @@ Functions to estimate confidence intervals for
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
from dataclasses import dataclass
|
|
10
11
|
from importlib.metadata import version
|
|
11
12
|
|
|
12
13
|
from .. import _PKG_NAME # noqa: TID252
|
|
@@ -14,7 +15,7 @@ from .. import _PKG_NAME # noqa: TID252
|
|
|
14
15
|
__version__ = version(_PKG_NAME)
|
|
15
16
|
|
|
16
17
|
from collections.abc import Sequence
|
|
17
|
-
from typing import Literal,
|
|
18
|
+
from typing import Literal, TypeVar
|
|
18
19
|
|
|
19
20
|
import numpy as np
|
|
20
21
|
from numpy.typing import NBitBase, NDArray
|
|
@@ -101,12 +102,12 @@ def propn_ci(
|
|
|
101
102
|
case "Agresti-Coull":
|
|
102
103
|
_zsc = norm.ppf(1 - alpha / 2)
|
|
103
104
|
_zscsq = _zsc * _zsc
|
|
104
|
-
|
|
105
|
-
_est_phat = (_npos +
|
|
105
|
+
_adjmt = 4 if alpha == 0.05 else _zscsq
|
|
106
|
+
_est_phat = (_npos + _adjmt / 2) / (_nobs + _adjmt)
|
|
106
107
|
_est_ci_l, _est_ci_u = (
|
|
107
108
|
_est_phat + _g
|
|
108
109
|
for _g in [
|
|
109
|
-
_f * _zsc * np.sqrt(_est_phat * (1 - _est_phat) / (_nobs +
|
|
110
|
+
_f * _zsc * np.sqrt(_est_phat * (1 - _est_phat) / (_nobs + _adjmt))
|
|
110
111
|
for _f in (-1, 1)
|
|
111
112
|
]
|
|
112
113
|
)
|
|
@@ -441,7 +442,7 @@ def _propn_diff_chisq_mn(
|
|
|
441
442
|
)
|
|
442
443
|
|
|
443
444
|
|
|
444
|
-
def
|
|
445
|
+
def propn_diff_ci_multinomial(
|
|
445
446
|
_counts: NDArray[np.integer[TI]], /, *, alpha: float = 0.05
|
|
446
447
|
) -> NDArray[np.float64]:
|
|
447
448
|
"""Estimate confidence intervals of pair-wise differences in multinomial proportions
|
|
@@ -475,16 +476,17 @@ def propn_ci_diff_multinomial(
|
|
|
475
476
|
return np.column_stack([_d + _f * _d_cr * np.sqrt(_var) for _f in (-1, 1)])
|
|
476
477
|
|
|
477
478
|
|
|
478
|
-
|
|
479
|
+
@dataclass(slots=True, frozen=True)
|
|
480
|
+
class MultinomialPropnsTest:
|
|
479
481
|
estimate: np.float64
|
|
480
482
|
dof: int
|
|
481
483
|
critical_value: np.float64
|
|
482
484
|
p_value: np.float64
|
|
483
485
|
|
|
484
486
|
|
|
485
|
-
def
|
|
487
|
+
def propn_test_multinomial(
|
|
486
488
|
_counts: NDArray[np.integer[TI]], /, *, alpha: float = 0.05
|
|
487
|
-
) ->
|
|
489
|
+
) -> MultinomialPropnsTest:
|
|
488
490
|
"""Chi-square test for homogeneity of differences in multinomial proportions.
|
|
489
491
|
|
|
490
492
|
Differences in multinomial proportions sum to zero.
|
|
@@ -510,9 +512,9 @@ def propn_diff_multinomial_chisq(
|
|
|
510
512
|
_p_bar = _n / np.einsum("jk->j", _n_k / _prob)
|
|
511
513
|
|
|
512
514
|
_y_sq = _n * ((1 / np.einsum("j->", _p_bar)) - 1)
|
|
513
|
-
_dof = np.array([
|
|
515
|
+
_dof = np.array([_s - 1 for _s in _counts.shape]).prod()
|
|
514
516
|
_chi_rv = chi2(_dof)
|
|
515
517
|
|
|
516
|
-
return
|
|
518
|
+
return MultinomialPropnsTest(
|
|
517
519
|
_y_sq, _dof, _chi_rv.ppf(1 - alpha), 1 - _chi_rv.cdf(_y_sq)
|
|
518
520
|
)
|
|
@@ -58,11 +58,11 @@ if __name__ == "__main__":
|
|
|
58
58
|
|
|
59
59
|
print()
|
|
60
60
|
print("Conf. intervals for differences in proportions enforced (Goodman, 1964)")
|
|
61
|
-
print(repr(pcl.
|
|
61
|
+
print(repr(pcl.propn_diff_ci_multinomial(enf_counts[:, [1, 3]])))
|
|
62
62
|
|
|
63
63
|
print()
|
|
64
64
|
print("Goodman's chi-squared test for homogeneity of enforcement patterns")
|
|
65
|
-
print(repr(pcl.
|
|
65
|
+
print(repr(pcl.propn_test_multinomial(enf_counts[:, [1, 3]])))
|
|
66
66
|
|
|
67
67
|
print()
|
|
68
68
|
print(
|
|
@@ -277,7 +277,7 @@ if __name__ == "__main__":
|
|
|
277
277
|
),
|
|
278
278
|
)
|
|
279
279
|
|
|
280
|
-
save_data_to_file_flag =
|
|
280
|
+
save_data_to_file_flag = True
|
|
281
281
|
if save_data_to_file_flag:
|
|
282
282
|
h5_path = DATA_DIR / PROG_PATH.with_suffix(".h5").name
|
|
283
283
|
(_, h5_file, h5_group), h5_subgroup_name = utl.initialize_hd5(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.738949.0
|
|
4
4
|
Summary: Analysis of standards defined in Horizontal Merger Guidelines
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
|
|
@@ -18,7 +18,6 @@ Classifier: Programming Language :: Python :: 3
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
20
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
-
Requires-Dist: aenum (>=3.1)
|
|
22
21
|
Requires-Dist: attrs (>=23.2)
|
|
23
22
|
Requires-Dist: bs4 (>=0.0.1)
|
|
24
23
|
Requires-Dist: certifi (>=2023.11.17)
|
|
@@ -3,25 +3,25 @@ mergeron/__init__.py,sha256=gk_2mS6jdui5fVmVHHfZVaEG9LyO3vfRATnES29ajRA,398
|
|
|
3
3
|
mergeron/core/InCommon RSA Server CA cert chain.pem,sha256=W8TqydgY8jphQ4fr6WMdT6jLwqFjHLpx8fFr3LXub4s,4292
|
|
4
4
|
mergeron/core/__init__.py,sha256=iyfxkX3-SoMS4ZQZKHKPn8JEMN536vpty9oSZf0LHv8,115
|
|
5
5
|
mergeron/core/damodaran_margin_data.py,sha256=N1SU_PDjFMoCzCqone-If-gR4PpcG-MK5TfayusOJLs,8166
|
|
6
|
-
mergeron/core/excel_helper.py,sha256=
|
|
6
|
+
mergeron/core/excel_helper.py,sha256=_TkoWMPB4MZSVcP6qzqwqWWHcxHFrJu7prMbIArC98w,8079
|
|
7
7
|
mergeron/core/ftc_merger_investigations_data.py,sha256=8Zn-kbEg6J6R-qkpkkq-8kBHJt7QbGcRPn9hpjgFfP4,26761
|
|
8
8
|
mergeron/core/guidelines_boundaries.py,sha256=uWQUoVn2SCL-4cCTUkEPfeMTmFpIHLfMXFMTPNV0mqA,44733
|
|
9
|
-
mergeron/core/proportions_tests.py,sha256=
|
|
9
|
+
mergeron/core/proportions_tests.py,sha256=YER1RTLSTSyNbP4ZUkvUWTViUv4lxlnRCCKuC6HbWXI,15320
|
|
10
10
|
mergeron/core/pseudorandom_numbers.py,sha256=ZnIE1ixp3JcgJjlulgMsIcWFVAxeyjC9lsiMIk7OHlM,9430
|
|
11
11
|
mergeron/examples/__init__.py,sha256=iyfxkX3-SoMS4ZQZKHKPn8JEMN536vpty9oSZf0LHv8,115
|
|
12
12
|
mergeron/examples/concentration_as_diversion.py,sha256=p9-VzqC8Tb3fMJD1mLnqmMnvOCrCTULjIPCEG0RhASQ,20645
|
|
13
13
|
mergeron/examples/enforcement_boundaries_for_mergers_with_asymmetric_shares.py,sha256=-jOHETKp788pqKTv7U25t28UzVtJNMmUn1FVH7jCiCU,16020
|
|
14
14
|
mergeron/examples/enforcement_boundaries_for_symmetric_firm_mergers.py,sha256=DAljm5NJquE56f-x4pLXzKCdhYQyVpWaM8uGlD6rIEs,5779
|
|
15
15
|
mergeron/examples/example_parameterizations.py,sha256=VP-hi7L0j30ffcEzmJ3P8mOj1VjwEWKCTZSx_CaVQxA,4197
|
|
16
|
-
mergeron/examples/guidelines_enforcement_patterns.py,sha256=
|
|
16
|
+
mergeron/examples/guidelines_enforcement_patterns.py,sha256=iHGUaWCidVwIywI60ZNB4AnvzpTe60az1H7AzB3ddl0,2255
|
|
17
17
|
mergeron/examples/investigations_stats_obs_tables.py,sha256=WP38WWjLEn1JHKutaGLa-f5pmoePYgGfzc6vrYZ9of4,17827
|
|
18
|
-
mergeron/examples/investigations_stats_sim_tables.py,sha256=
|
|
18
|
+
mergeron/examples/investigations_stats_sim_tables.py,sha256=ND3eKEm7h9L9B4MRUMk98CBBuZ5gd6CE-S2iHxeErIQ,14917
|
|
19
19
|
mergeron/examples/plotSafeHarbs_symbolically.py,sha256=S-F1q0OouQCWE0t5XS-jmJaZcAHq7E0q2rsn-ewSTQI,1528
|
|
20
20
|
mergeron/examples/sound_guppi_safeharbor.py,sha256=mclCHLgBJOSPIxyWaxdfh3RdRVhmBhDhVwuKWNVn-XE,6085
|
|
21
21
|
mergeron/examples/summarize_ftc_investigations_data.py,sha256=447vtwlAsfc3Po8wFcKRHC4Ur-zvKc5dwBjtu4M49ig,1360
|
|
22
22
|
mergeron/examples/testIntrinsicClearanceRates.py,sha256=T0-6m-SEPVy-mY8gZY2HlJO4ncBa47r87bERhhANLFs,5378
|
|
23
23
|
mergeron/examples/visualize_empirical_margin_distribution.py,sha256=eMTWgNJ1eSTZBgwojZXAYMfuzgMGM2UU999axNjBip4,2918
|
|
24
|
-
mergeron/examples/visualize_guidelines_tests.py,sha256=
|
|
24
|
+
mergeron/examples/visualize_guidelines_tests.py,sha256=VE3aotuFOsU-CSt4SymRG8_iVfIHPgrxVFRB7B1hCyI,9365
|
|
25
25
|
mergeron/ext/__init__.py,sha256=iyfxkX3-SoMS4ZQZKHKPn8JEMN536vpty9oSZf0LHv8,115
|
|
26
26
|
mergeron/ext/tol_colors.py,sha256=wFOHZXWZonbp9mhmSGu9mVujBYhdTsvx9_WikMpoCmo,22229
|
|
27
27
|
mergeron/gen/__init__.py,sha256=MxjGj4bHklt6R-Xc-iT46pgK4XZNlcMDErnlF3jA7LU,16787
|
|
@@ -37,6 +37,6 @@ mergeron/jinja_LaTex_templates/mergeron.cls,sha256=AV2mk4-uERvAuMkE95Ka7el6LZsb0
|
|
|
37
37
|
mergeron/jinja_LaTex_templates/mergeron_table_collection_template.tex.jinja2,sha256=nr6xUI0_2KHG4Sz9k1JFVQjs2h9qS9BGt1MeE6Tygs8,2429
|
|
38
38
|
mergeron/jinja_LaTex_templates/setup_tikz_tables.tex.jinja2,sha256=WKVxtp3eoMchfGliQAJMj4w2FtBkWG5z2V3-hBYUYUQ,3292
|
|
39
39
|
mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
40
|
-
mergeron-2024.
|
|
41
|
-
mergeron-2024.
|
|
42
|
-
mergeron-2024.
|
|
40
|
+
mergeron-2024.738949.0.dist-info/METADATA,sha256=frwPeN3n7LB93DCX30amODqFJyAfwNbX5ErHWbU9rY4,6362
|
|
41
|
+
mergeron-2024.738949.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
42
|
+
mergeron-2024.738949.0.dist-info/RECORD,,
|
|
File without changes
|