mergeron 2025.739290.6__py3-none-any.whl → 2025.739290.9__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/gen/upp_tests.py CHANGED
@@ -21,13 +21,7 @@ from .. import ( # noqa
21
21
  UPPAggrSelector,
22
22
  )
23
23
  from ..core import guidelines_boundaries as gbl # noqa: TID252
24
- from . import (
25
- INVResolution,
26
- MarketSampleData,
27
- UPPTestRegime,
28
- UPPTestsCounts,
29
- UPPTestsRaw,
30
- )
24
+ from . import INVResolution, MarketSampleData, UPPTestRegime, UPPTestsCounts
31
25
  from . import enforcement_stats as esl
32
26
 
33
27
  __version__ = VERSION
@@ -41,7 +35,7 @@ class INVRESCntsArgs(TypedDict, total=False):
41
35
  nthreads: int
42
36
 
43
37
 
44
- def compute_upp_test_counts(
38
+ def compute_upp_test_counts( # noqa: PLR0914
45
39
  _market_data_sample: MarketSampleData,
46
40
  _upp_test_parms: gbl.HMGThresholds,
47
41
  _upp_test_regime: UPPTestRegime,
@@ -71,134 +65,6 @@ def compute_upp_test_counts(
71
65
 
72
66
  """
73
67
 
74
- upp_test_arrays = compute_upp_test_arrays(
75
- _market_data_sample, _upp_test_parms, _upp_test_regime
76
- )
77
-
78
- fcounts, hhi_delta, hhi_post = (
79
- getattr(_market_data_sample, _g) for _g in ("fcounts", "hhi_delta", "hhi_post")
80
- )
81
-
82
- stats_rowlen = 6
83
- # Clearance/enforcement counts --- by firm count
84
- enf_cnts_sim_byfirmcount_array: ArrayBIGINT = np.zeros(stats_rowlen, int)
85
- firmcounts_list = np.unique(fcounts)
86
- if firmcounts_list.any():
87
- for _fc in firmcounts_list:
88
- fc_test = fcounts == _fc
89
-
90
- enf_cnts_sim_byfirmcount_array = np.vstack((
91
- enf_cnts_sim_byfirmcount_array,
92
- np.array([
93
- _fc,
94
- np.einsum("ij->", 1 * fc_test),
95
- *[
96
- np.einsum(
97
- "ij->", 1 * (fc_test & getattr(upp_test_arrays, _a.name))
98
- )
99
- for _a in upp_test_arrays.__attrs_attrs__
100
- ],
101
- ]),
102
- ))
103
-
104
- enf_cnts_sim_byfirmcount_array = enf_cnts_sim_byfirmcount_array[1:]
105
- else:
106
- enf_cnts_sim_byfirmcount_array = np.array([], int)
107
-
108
- # Clearance/enforcement counts --- by delta
109
- enf_cnts_sim_bydelta_array: ArrayBIGINT = np.zeros(stats_rowlen, int)
110
- hhi_deltaranged = esl.hhi_delta_ranger(hhi_delta)
111
- for hhi_deltalim in esl.HHI_DELTA_KNOTS[:-1]:
112
- hhi_deltatest = hhi_deltaranged == hhi_deltalim
113
-
114
- enf_cnts_sim_bydelta_array = np.vstack((
115
- enf_cnts_sim_bydelta_array,
116
- np.array([
117
- hhi_deltalim,
118
- np.einsum("ij->", 1 * hhi_deltatest),
119
- *[
120
- np.einsum(
121
- "ij->", 1 * (hhi_deltatest & getattr(upp_test_arrays, _a.name))
122
- )
123
- for _a in upp_test_arrays.__attrs_attrs__
124
- ],
125
- ]),
126
- ))
127
-
128
- enf_cnts_sim_bydelta_array = enf_cnts_sim_bydelta_array[1:]
129
-
130
- # Clearance/enforcement counts --- by zone
131
- if np.isnan(hhi_post).all():
132
- stats_byconczone_sim = np.array([], int)
133
- else:
134
- try:
135
- hhi_zone_post_ranged = esl.hhi_zone_post_ranger(hhi_post)
136
- except ValueError as _err:
137
- print(hhi_post)
138
- raise _err
139
-
140
- stats_byconczone_sim = np.zeros(stats_rowlen + 1, int)
141
- for hhi_zone_post_knot in esl.HHI_POST_ZONE_KNOTS[:-1]:
142
- level_test = hhi_zone_post_ranged == hhi_zone_post_knot
143
-
144
- for hhi_zone_delta_knot in [0, 100, 200]:
145
- delta_test = (
146
- hhi_deltaranged > 100
147
- if hhi_zone_delta_knot == 200
148
- else hhi_deltaranged == hhi_zone_delta_knot
149
- )
150
-
151
- conc_test = level_test & delta_test
152
-
153
- stats_byconczone_sim = np.vstack((
154
- stats_byconczone_sim,
155
- np.array([
156
- hhi_zone_post_knot,
157
- hhi_zone_delta_knot,
158
- np.einsum("ij->", 1 * conc_test),
159
- *[
160
- np.einsum(
161
- "ij->",
162
- 1 * (conc_test & getattr(upp_test_arrays, _a.name)),
163
- )
164
- for _a in upp_test_arrays.__attrs_attrs__
165
- ],
166
- ]),
167
- ))
168
-
169
- enf_cnts_sim_byconczone_array = esl.enf_cnts_byconczone(stats_byconczone_sim[1:])
170
-
171
- del stats_byconczone_sim
172
- del hhi_delta, hhi_post, fcounts
173
-
174
- return UPPTestsCounts(
175
- enf_cnts_sim_byfirmcount_array,
176
- enf_cnts_sim_bydelta_array,
177
- enf_cnts_sim_byconczone_array,
178
- )
179
-
180
-
181
- def compute_upp_test_arrays(
182
- _market_data_sample: MarketSampleData,
183
- _upp_test_parms: gbl.HMGThresholds,
184
- _sim_test_regime: UPPTestRegime,
185
- /,
186
- ) -> UPPTestsRaw:
187
- """
188
- Generate UPP tests arrays for given configuration and market sample
189
-
190
- Given a standards vector, market
191
-
192
- Parameters
193
- ----------
194
- _market_data_sample
195
- market data sample
196
- _upp_test_parms
197
- guidelines thresholds for testing UPP and related statistics
198
- _sim_test_regime
199
- configuration to use for generating UPP tests
200
-
201
- """
202
68
  g_bar_, divr_bar_, cmcr_bar_, ipr_bar_ = (
203
69
  getattr(_upp_test_parms, _f) for _f in ("guppi", "divr", "cmcr", "ipr")
204
70
  )
@@ -228,32 +94,72 @@ def compute_upp_test_arrays(
228
94
  (divr_test_vector,) = _compute_test_array_seq(
229
95
  (_market_data_sample.divr_array,),
230
96
  _market_data_sample.frmshr_array,
231
- _sim_test_regime.divr_aggregator,
97
+ _upp_test_regime.divr_aggregator,
232
98
  )
233
99
 
234
100
  (guppi_test_vector, cmcr_test_vector, ipr_test_vector) = _compute_test_array_seq(
235
101
  (guppi_array, cmcr_array, ipr_array),
236
102
  _market_data_sample.frmshr_array,
237
- _sim_test_regime.guppi_aggregator,
103
+ _upp_test_regime.guppi_aggregator,
238
104
  )
239
105
  del cmcr_array, ipr_array, guppi_array
240
106
 
241
- if _sim_test_regime.resolution == INVResolution.ENFT:
242
- upp_test_arrays = UPPTestsRaw(
107
+ if _upp_test_regime.resolution == INVResolution.ENFT:
108
+ upp_test_arrays = np.hstack((
243
109
  guppi_test_vector >= g_bar_,
244
110
  (guppi_test_vector >= g_bar_) | (divr_test_vector >= divr_bar_),
245
111
  cmcr_test_vector >= cmcr_bar_,
246
112
  ipr_test_vector >= ipr_bar_,
247
- )
113
+ ))
248
114
  else:
249
- upp_test_arrays = UPPTestsRaw(
115
+ upp_test_arrays = np.hstack((
250
116
  guppi_test_vector < g_bar_,
251
117
  (guppi_test_vector < g_bar_) & (divr_test_vector < divr_bar_),
252
118
  cmcr_test_vector < cmcr_bar_,
253
119
  ipr_test_vector < ipr_bar_,
254
- )
120
+ ))
121
+
122
+ fcounts, hhi_delta, hhi_post = (
123
+ getattr(_market_data_sample, _g) for _g in ("fcounts", "hhi_delta", "hhi_post")
124
+ )
255
125
 
256
- return upp_test_arrays
126
+ # Clearance counts by firm count
127
+ enf_cnts_sim_byfirmcount_array = esl.enf_cnts_byfirmcount(
128
+ np.hstack((fcounts, np.ones_like(fcounts), upp_test_arrays))
129
+ )
130
+
131
+ # Clearance counts by Delta and Concentration Zone
132
+ hhi_zone_ranged = (
133
+ esl.hhi_zone_post_ranger(hhi_post).astype(int)
134
+ if hhi_post.any() and not np.isnan(hhi_post).all()
135
+ else np.zeros_like(hhi_post, int)
136
+ )
137
+ hhi_delta_ranged = esl.hhi_delta_ranger(hhi_delta).astype(int)
138
+
139
+ enf_cnts_sim_byhhianddelta_array = np.hstack(
140
+ (
141
+ hhi_zone_ranged,
142
+ hhi_delta_ranged,
143
+ np.ones_like(hhi_delta_ranged),
144
+ upp_test_arrays,
145
+ # *[
146
+ # 1 * getattr(upp_test_arrays, _a.name)
147
+ # for _a in upp_test_arrays.__attrs_attrs__
148
+ # ],
149
+ ),
150
+ dtype=int,
151
+ )
152
+
153
+ enf_cnts_sim_bydelta_array = esl.enf_cnts_bydelta(enf_cnts_sim_byhhianddelta_array)
154
+ enf_cnts_sim_byconczone_array = esl.enf_cnts_byconczone(
155
+ enf_cnts_sim_byhhianddelta_array
156
+ )
157
+
158
+ return UPPTestsCounts(
159
+ enf_cnts_sim_byfirmcount_array,
160
+ enf_cnts_sim_bydelta_array,
161
+ enf_cnts_sim_byconczone_array,
162
+ )
257
163
 
258
164
 
259
165
  def _compute_test_array_seq(
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.3
2
+ Name: mergeron
3
+ Version: 2025.739290.9
4
+ Summary: Analyze merger enforcement policy using Python
5
+ License: MIT
6
+ Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
7
+ Author: Murthy Kambhampaty
8
+ Author-email: smk@capeconomics.com
9
+ Requires-Python: >=3.12,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: Implementation :: CPython
22
+ Requires-Dist: aenum (>=3.1.15,<4.0.0)
23
+ Requires-Dist: attrs (>=23.2)
24
+ Requires-Dist: bs4 (>=0.0.1)
25
+ Requires-Dist: certifi (>=2023.11.17)
26
+ Requires-Dist: h5py (>=3.13.0,<4.0.0)
27
+ Requires-Dist: jinja2 (>=3.1)
28
+ Requires-Dist: joblib (>=1.3)
29
+ Requires-Dist: matplotlib (>=3.8)
30
+ Requires-Dist: mpmath (>=1.3)
31
+ Requires-Dist: msgpack (>=1.0)
32
+ Requires-Dist: msgpack-numpy (>=0.4)
33
+ Requires-Dist: ruamel-yaml (>=0.18.10,<0.19.0)
34
+ Requires-Dist: scipy (>=1.12)
35
+ Requires-Dist: sympy (>=1.12)
36
+ Requires-Dist: types-beautifulsoup4 (>=4.11.2)
37
+ Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
38
+ Requires-Dist: xlrd (>=2.0.1,<3.0.0)
39
+ Requires-Dist: xlsxwriter (>=3.1)
40
+ Description-Content-Type: text/x-rst
41
+
42
+ mergeron: Merger Policy Analysis with Python
43
+ ============================================
44
+
45
+ Usage
46
+ -----
47
+
48
+ *Visualizing Guidelines boundaries*
49
+
50
+ .. code:: python
51
+
52
+ %matplotlib inline
53
+ from mergeron.core import guidelines_boundaries as gbl
54
+ from mergeron.core import guidelines_boundary_functions as gbf
55
+ from math import sqrt
56
+
57
+ delta_bound = 0.01
58
+ conc_boundary = gbl.ConcentrationBoundary(delta_bound, "ΔHHI")
59
+ share_boundary = gbl.ConcentrationBoundary(2 * sqrt(delta_bound / 2), "Combined share")
60
+
61
+ divr_boundary_a = gbl.DiversionRatioBoundary(
62
+ gbl.guppi_from_delta(delta_bound, m_star=1.0, r_bar=0.85),
63
+ agg_method=gbl.UPPAggrSelector.AVG
64
+ )
65
+
66
+ divr_boundary_i = gbl.DiversionRatioBoundary(
67
+ gbl.guppi_from_delta(delta_bound, m_star=1.0, r_bar=0.85),
68
+ agg_method=gbl.UPPAggrSelector.MIN
69
+ )
70
+
71
+ divr_boundary_x = gbl.DiversionRatioBoundary(
72
+ gbl.guppi_from_delta(delta_bound, m_star=1.0, r_bar=0.85),
73
+ agg_method=gbl.UPPAggrSelector.MAX
74
+ )
75
+
76
+
77
+ Plots are written to PDF, typically, with ``backend="pgf"`` as the
78
+ default backend in the function, ``gbf.boundary_plot``. Here, we set the
79
+ backend to ``None`` to skip fine-tuning plots for PDF generation.
80
+
81
+ .. code:: python
82
+
83
+ plt, fig, ax, layout_axis = gbf.boundary_plot(backend=None)
84
+
85
+ ax.set_title("Concentration and Diversion Ratio Boundaries")
86
+
87
+ ax.plot(conc_boundary.coordinates[:, 0], conc_boundary.coordinates[:, 1], color="black", linestyle="-", label="ΔHHI")
88
+ ax.plot(share_boundary.coordinates[:, 0], share_boundary.coordinates[:, 1], color="black", linestyle=":", label="Combined share")
89
+ ax.plot(divr_boundary_a.coordinates[:, 0], divr_boundary_a.coordinates[:, 1], "b-", label="Average Diversion Ratio")
90
+ ax.plot(divr_boundary_i.coordinates[:, 0], divr_boundary_i.coordinates[:, 1], "r-", label="Minimum Diversion Ratio")
91
+ ax.plot(divr_boundary_x.coordinates[:, 0], divr_boundary_x.coordinates[:, 1], "g-", label="Maximum Diversion Ratio")
92
+
93
+ _ = fig.legend(loc=(0.4, 0.7), frameon=False)
94
+
95
+
96
+
97
+ .. image:: ./docs/readme_content/output_5_0.png
98
+
99
+
100
+ *Analyzing FTC Merger Investigations Data*
101
+
102
+ .. code:: python
103
+
104
+ from mergeron.core import ftc_merger_investigations_data as fid
105
+ import tabulate
106
+
107
+ inv_data = fid.construct_data(fid.INVDATA_ARCHIVE_PATH)
108
+
109
+
110
+ We can now analyze counts of markets reported in the source data, by
111
+ table number. Note that odd-numbered tables report FTC investigations
112
+ data organized by HHI and ΔHHI, while even-numbered tables report by
113
+ firm-count.
114
+
115
+ .. code:: python
116
+
117
+ from mergeron.gen import enforcement_stats as esl
118
+
119
+ print("Enforcement Rates in Markets with Entry Barriers, 1996-2003 vs 2004-2011")
120
+ print()
121
+ counts_by_delta_1 = esl.enf_cnts_bydelta(
122
+ inv_data["1996-2003"]["ByHHIandDelta"]["Table 9.2"].data_array
123
+ )
124
+ counts_by_delta_2 = esl.enf_cnts_bydelta(
125
+ inv_data["2004-2011"]["ByHHIandDelta"]["Table 9.2"].data_array
126
+ )
127
+ observed_enforcement_rates = list(zip(
128
+ (
129
+ {_v: _k for _k, _v in fid.CONC_DELTA_DICT.items()}[i]
130
+ for i in counts_by_delta_1[:, 0]
131
+ ),
132
+ (
133
+ f"{_a[1] / _a[-1]: <12.2%}" if _a[-1] else "--"
134
+ for _a in counts_by_delta_1
135
+ ),
136
+ (
137
+ f"{_e[1] / _e[-1]: <12.2%}" if _e[-1] else "--"
138
+ for _e in counts_by_delta_2
139
+ ),
140
+ ))
141
+
142
+ observed_enforcement_rates.append([
143
+ "Total",
144
+ f"{counts_by_delta_1[:, 1].sum() / counts_by_delta_1[:, -1].sum(): <12.2%}",
145
+ f"{counts_by_delta_2[:, 1].sum() / counts_by_delta_2[:, -1].sum(): <12.2%}",
146
+ ])
147
+
148
+ print(tabulate.tabulate(
149
+ observed_enforcement_rates,
150
+ tablefmt="simple",
151
+ headers=("ΔHHI", "1996-2003", "2004-2011"),
152
+ stralign="center",
153
+ maxcolwidths=36,
154
+ maxheadercolwidths=36,
155
+ ))
156
+
157
+
158
+ .. parsed-literal::
159
+
160
+ Enforcement Rates in Markets with Entry Barriers, 1996-2003 vs 2004-2011
161
+
162
+ ΔHHI 1996-2003 2004-2011
163
+ ------------- ----------- -----------
164
+ 0 - 100 -- 100.00%
165
+ 100 - 200 33.33% 50.00%
166
+ 200 - 300 33.33% 50.00%
167
+ 300 - 500 75.00% 77.78%
168
+ 500 - 800 59.09% 54.55%
169
+ 800 - 1,200 93.33% 81.82%
170
+ 1,200 - 2,500 90.91% 84.38%
171
+ 2,500 + 96.00% 100.00%
172
+ Total 81.65% 82.86%
173
+
174
+
175
+ Generating synthetic market data and analyzing enforcement rates
176
+
177
+
178
+
@@ -0,0 +1,22 @@
1
+ mergeron/__init__.py,sha256=fXHKGm9EqnQ23tIpDUiJ4m6PbMWtHpSY71gDpNlQOlE,5549
2
+ mergeron/core/__init__.py,sha256=BzL_bXHyOQG8cvo76OP3K48LkeHQCJQN7ZFPRhoOdcE,2850
3
+ mergeron/core/empirical_margin_distribution.py,sha256=HQOIsruz6-UODic66BRnP4USnNHlbypZBWud-pP7ftc,9249
4
+ mergeron/core/ftc_merger_investigations_data.py,sha256=DYqtyxGPnpGyaWbQ8dPHmHmQBOeHbmU5h9snk-YwSN4,28575
5
+ mergeron/core/guidelines_boundaries.py,sha256=srCEWzSuv7cDFCf-ity-9C0NtFCdZznn5dgiUS9Ndpo,15246
6
+ mergeron/core/guidelines_boundary_functions.py,sha256=wQdIQcEga888vVe3cAwYsDa7HTaxgqe3RbV48UklmzQ,29064
7
+ mergeron/core/guidelines_boundary_functions_extra.py,sha256=i2CmEpYRUVnMbPakSjlyWodMP11JW-rkVImhKOQlV6g,22355
8
+ mergeron/core/pseudorandom_numbers.py,sha256=YqcVwU-Pgc0F_pKzG9Osn14RnIuYOwE-q7GVDpCUtpI,9998
9
+ mergeron/data/__init__.py,sha256=4yOOvERJ28JIT5KRkIa_t2y9aYmuFdStPM4P38BsufM,1806
10
+ mergeron/data/damodaran_margin_data.xls,sha256=Qggl1p5nkOMJI8YUXhkwXQRz-OhRSqBTzz57N0JQyYA,79360
11
+ mergeron/data/ftc_merger_investigations_data.zip,sha256=tiB2TLFyS9LMSFIv8DBA_oEEx12DU4MyjHni4NlsRMU,24002
12
+ mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
13
+ mergeron/demo/visualize_empirical_margin_distribution.py,sha256=17awsa188r7uVDJuHuCWTYwlQbfaq4n8HEHF5jK-0Ic,2532
14
+ mergeron/gen/__init__.py,sha256=JvyF3WyujbDzJNKtJb_GwqGwv7lydCkubsOMDsCND3w,22579
15
+ mergeron/gen/data_generation.py,sha256=ED0ShgPL0sgJceLzJu1BcNs8yC-EBzNGHW1oj8_g_so,17092
16
+ mergeron/gen/data_generation_functions.py,sha256=6ND1OOvIQUwDuBbpNG0KTBLI32YgphEONwQNCp2LpPc,26402
17
+ mergeron/gen/enforcement_stats.py,sha256=UrsZWZNYy7DXWsCu96qmOQINipFbf9qLX0W8iNGgE_Y,11073
18
+ mergeron/gen/upp_tests.py,sha256=Czub4njLESkV5LRwb1lByEI4nHBK0AwT96LYp_bG12s,6968
19
+ mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
20
+ mergeron-2025.739290.9.dist-info/METADATA,sha256=R4M_2x5P9TATg8EkUy2TPvDXaHipBUxehTTgBSPt1-k,6107
21
+ mergeron-2025.739290.9.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
22
+ mergeron-2025.739290.9.dist-info/RECORD,,
@@ -1,115 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: mergeron
3
- Version: 2025.739290.6
4
- Summary: Analyze merger enforcement policy using Python
5
- License: MIT
6
- Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
7
- Author: Murthy Kambhampaty
8
- Author-email: smk@capeconomics.com
9
- Requires-Python: >=3.12,<4.0
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Environment :: Console
12
- Classifier: Intended Audience :: End Users/Desktop
13
- Classifier: Intended Audience :: Science/Research
14
- Classifier: License :: OSI Approved :: MIT License
15
- Classifier: Operating System :: OS Independent
16
- Classifier: Programming Language :: Python
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: 3.13
20
- Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: Implementation :: CPython
22
- Requires-Dist: aenum (>=3.1.15,<4.0.0)
23
- Requires-Dist: attrs (>=23.2)
24
- Requires-Dist: bs4 (>=0.0.1)
25
- Requires-Dist: certifi (>=2023.11.17)
26
- Requires-Dist: h5py (>=3.13.0,<4.0.0)
27
- Requires-Dist: jinja2 (>=3.1)
28
- Requires-Dist: joblib (>=1.3)
29
- Requires-Dist: matplotlib (>=3.8)
30
- Requires-Dist: mpmath (>=1.3)
31
- Requires-Dist: msgpack (>=1.0)
32
- Requires-Dist: msgpack-numpy (>=0.4)
33
- Requires-Dist: ruamel-yaml (>=0.18.10,<0.19.0)
34
- Requires-Dist: scipy (>=1.12)
35
- Requires-Dist: sympy (>=1.12)
36
- Requires-Dist: types-beautifulsoup4 (>=4.11.2)
37
- Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
38
- Requires-Dist: xlrd (>=2.0.1,<3.0.0)
39
- Requires-Dist: xlsxwriter (>=3.1)
40
- Description-Content-Type: text/x-rst
41
-
42
- mergeron: Merger Policy Analysis using Python
43
- =============================================
44
-
45
- Visualize the sets of mergers conforming to concentration and diversion-ratio standards. Estimate intrinsic enforcement rates, and intrinsic clearance rates, under concentration, diversion ratio, GUPPI, CMCR, and IPR bounds using generated data with specified distributions of market shares, price-cost margins, firm counts, and prices, optionally imposing restrictions implied by statutory filing thresholds and/or Bertrand-Nash oligopoly with MNL demand. Download and analyze merger investigations data published by the U.S. Federal Trade Commission in various reports on extended merger investigations (Second Requests) during 1996 to 2011.
46
-
47
- Here, enforcement rates derived with merger enforcement as being exogenous to firm conduct are defined as intrinsic enforcement rates, and similarly intrinsic clearance rates. Depending on the merger enforcement regime, or merger control regime, intrinsic enforcement rates may also not be the complement of intrinsic clearance rates, i.e, it is not necessarily true that the intrinsic clearance rate estimate for a given enforcement regime is 1 minus the intrinsic enforcement rate. In contrast, observed enforcement rates reflect the deterrent effects of merger enforcement on firm conduct as well as the effects of merger screening on the level of enforcement; and, by definition, the observed clearance rate is 1 minus the observed enforcement rate.
48
-
49
- Introduction
50
- ------------
51
-
52
- Module :code:`.core.guidelines_boundaries` includes classes for specifying concentration bounds (:code:`.core.guidelines_boundaries.ConcentrationBoundary`) and diversion-ratio bounds (:code:`.core.guidelines_boundaries.DiversionRatioBoundary`), with automatic generation of boundary, as an array of share-pairs, and area. This module also includes a function for generating plots of concentration and diversion-ratio boundaries, and functions for mapping GUPPI standards to concentration (ΔHHI) standards, and vice-versa.
53
-
54
- Module :code:`.gen.data_generation` includes the :code:`.gen.data_generation.MarketSample` which provides for a rich specification of shares and diversion ratios (:code:`.gen.data_generation.MarketSample.share_spec`), margins (:code:`.gen.data_generation.MarketSample.pcm_spec`, prices (:code:`.gen.data_generation.MarketSample.price_spec`), and HSR filing requirements (:code:`.gen.data_generation.MarketSample.hsr_filing_test_type`), and with methods for, (i) generating sample data (:code:`.gen.data_generation.MarketSample.generate_sample`), and (ii) computing the intrinsic enforcement rate and intrinsic clearance rate for the generated sample, given a method (:code:`.UPPAggrSelector`) of aggregating diversion ratio or GUPPI estimates for the firms in a merger (:code:`.gen.data_generation.MarketSample.estimate_enf_counts`). While the latter populate the properties, :code:`.gen.data_generation.MarketSample.data`
55
- and :code:`.gen.data_generation.MarketSample.enf_counts`, respectively, the underlying methods for generating standalone :code:`MarketDataSample` and :code:`UPPTestCounts` objects are included in the class definition, with helper functions defined in the modules, :code:`.gen.data_generation_functions` and :code:`.gen.upp_tests`. Notably, market shares are generated for a sample of markets with firm-count distributed as specified in :code:`.gen.data_generation.MarketSample.share_spec.firm_count_weights`, with defaults as discussed below (also see, :code:`.gen.ShareSpec.firm_count_weights`.
56
-
57
- By default, merging-firm shares are drawn with uniform distribution over the space :math:`s_1 + s_2 \leqslant 1` for an unspecified number of firms. Alternatively, shares may be drawn from the Dirichlet distribution (see property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec`, of type, :code:`.gen.SHRDistribution`), with specified shape parameters (property `dist_parms` of :code:`.gen.data_generation.MarketSample.share_spec`. When drawing shares from the Dirichlet distribution, the user specifies the `firm_count_weights` property of :code:`.gen.data_generation.MarketSample.share_spec`, as a vector of weights specifying the frequency distribution over sequential firm counts, e.g., :code:`[133, 184, 134, 52, 32, 10, 12, 4, 3]` to specify shares drawn from Dirichlet distributions with 2 to 10 pre-merger firms distributed as in data for FTC merger investigations during 1996--2003 (See, for example, Table 4.1 of `FTC, Horizontal Merger Investigations Data, Fiscal Years 1996--2003 (Revised: August 31, 2004) <https://www.ftc.gov/sites/default/files/documents/reports/horizontal-merger-investigation-data-fiscal-years-1996-2003/040831horizmergersdata96-03.pdf>`_). If the property `firm_count_weights` is not explicitly assigned a value when defining :code:`.gen.data_generation.MarketSample.share_spec`, the default values is used, which results in a sample of markets with 2 to 7 firms with relative frequency in inverse proportion to firm-count, with 2-firm markets being 6 times as likely to be drawn as 7-firm markets.
58
-
59
- Recapture ratios can be specified as, "proportional", "inside-out", or "outside-in" (see :code:`.RECForm`). The "inside-out" specification (assigning :code:`.RECForm.INOUT` to the `recapture_form` property of :code:`.gen.data_generation.MarketSample.share_spec`) results in recapture ratios consistent with MNL demand, given merging-firms' in-market shares and a default recapture ratio. The "outside-in" specification (assigning :code:`.RECForm.INOUT` to the `recapture_form` property of :code:`.gen.data_generation.MarketSample.share_spec`) yields diversion ratios from purchase probabilities drawn at random for :math:`N+1` goods, with market shares and recapture ratios for the :math:`N` goods in the putative market (see, :code:`.gen.ShareSpec`) computed from the simulated choice probabilities. The "outside-in" specification requires specification of the distribution of markets over firm counts (the default being uniform distirbution over markets with 2 to 7 firms pre-merger), and Dirichlet-distributed shares, with optional parameters (the default being a "flat" Dirichlet distribution, i.e., one with all parameters being 1). The parameters of the Dirichlet distribution can, for example, be specified to increase (decrease) the probability of drawing mergers to monopoly relative to that probability associated with the Flat Dirichlet specification, by setting the first 2 specified parameters at higher (lower) values relative to the others. Lastly, the "proportional" form of recapture ratio (`recapture_form` = :code:`.RECForm.FIXED`) is often used in the literature, as an approximation to the "inside-out" calibration. See, for example, Coate (2011).
60
-
61
- Price-cost-margins may be specified as having uniform distribution, Beta distribution (including a bounded Beta distribution with specified mean and variance), or a built-in empirical distribution (see, :code:`.gen.PCMSpec`). The in-built empirical margin distribution is based on resampling margin data published by Prof. Damodaran of NYU Stern School of Business (see Notes), using an estimated Gaussian KDE. The second merging firm's margin (per the property `firm2_pcm_constraint` of :code:`.gen.data_generation.MarketSample.pcm_spec`) may be specified as symmetric, i.i.d., or subject to equilibrium conditions for (profit-maximization in) Bertrand-Nash oligopoly with MNL demand (:code:`.gen.FM2Constraint`).
62
-
63
- Prices may be specified as symmetric or asymmetric, and in the latter case, the direction of correlation between merging firm prices, if any, can also be specified (see, :code:`.gen.PriceSpec`). Prices may also be defined by imposing cost symmetry on firms in the sample, with fixed unit marginal costs normalized to 1 unit, such that prices equal :math:`1 / (1 - \pmb{m})`, where :math:`\pmb{m}` represents the array of margins for firms in the sample.
64
-
65
- The market sample may be restricted to mergers meeting the HSR filing requirement under two alternative approaches: in the one, the smaller of the two merging firms meets the lower HSR size threshold ($10 million, as adjusted) and the larger of the two merging firms meets the size test if it's share is no less than 10 times the share of the smaller firm. In the other, the :math:`n`-th firm's size is maintained as $10 million, as adjusted (see, :code:`.gen.SSZConstant`), and a merger meets the HSR filing test if either, (a.) the smaller merging firm is no smaller than the n-th firm and the larger merging firm is at 10-times as large as the n-th firm, or (b.) the smaller merging firm's market share is in excess of 10%; in effect this version of the test maintains that if the smaller merging firm's market share exceeds 10%, the value of the transaction exceeds $200 million, as adjusted, and the size-of-person test is eliminated (see, FTC (2008, p. 12); the above are simplifications of the statutory HSR filing requirements). The second assumption avoids the unfortunate assumption in the first that, within the resulting sample, the larger merging firm be at least 10 times as large as the smaller merging firm, as a consequence of the full definition of the HSR filing requirement.
66
-
67
- The full specification of a market sample is given in a :code:`.gen.data_generation.MarketSample` object, including the above parameters. Data are drawn by invoking :code:`.gen.data_generation.MarketSample.generate_sample` which adds a :code:`data` property of class, :code:`.gen.MarketDataSample`. Enforcement or clearance counts are computed by invoking :code:`.gen.data_generation.MarketSample.estimate_enf_counts`, which adds an :code:`enf_counts` property of class :code:`.gen.UPPTestsCounts`. For fast, parallel generation of enforcement or clearance counts over large market data samples that ordinarily would exceed available limits on machine memory, the user can invoke the method :code:`.gen.data_generation.MarketSample.estimate_enf_counts` on a :code:`.gen.data_generation.MarketSample` object without first invoking :code:`.gen.data_generation.MarketSample.generate_sample`. Note, however, that this strategy does not retain the market sample in memory in the interests of conserving memory and maintaining high performance (the user can specify that the market sample and enforcement statistics be stored to permanent storage; when saving to current PCIe NVMe storage, the performance penalty is slight, but can be considerable if saving to SATA storage).
68
-
69
- Enforcement statistics based on FTC investigations data and test data are tabulated using methods provided in :code:`.gen.enforcement_stats`.
70
-
71
- Programs demonstrating the use of this package are included in the sub-package, :code:`.demo`.
72
-
73
- This package includes a class, :code:`.core.pseudorandom_numbers.MultithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple CPU cores, be they virtual, logical, or physical cores. This class is an adaptation from the documentation for the external :code:`numpy.random` subpackage, from the discussion on, "`Multithreaded generation <https://numpy.org/doc/stable/reference/random/multithreading.html>`_"; the version included here permits selection of the distribution with pre-tests to catch and inform on common errors. To access these directly:
74
-
75
- .. code-block:: python
76
-
77
- import mergeron.core.pseudorandom_numbers as prng
78
-
79
- Documentation for this package is in the form of the API Reference. Documentation for individual functions and classes is accessible within a python shell. For example:
80
-
81
- .. code-block:: python
82
-
83
- import mergeron.core.data_generation as dgl
84
-
85
- help(dgl.MarketSample)
86
-
87
- .. rubric:: References
88
-
89
- .. _coate2011:
90
-
91
- Coate, M. B. (2011). Benchmarking the upward pricing pressure model with Federal Trade
92
- Commission evidence. Journal of Competition Law & Economics, 7(4), 825--846. URL: https://doi.org/10.1093/joclec/nhr014.
93
-
94
- .. _ftc_premerger_guide2:
95
-
96
- FTC Premerger Notification Office. “To File or Not to File: When You Must File a Premerger Notification Report Form”. 2008 (September, revised). URL: https://www.ftc.gov/sites/default/files/attachments/premerger-introductory-guides/guide2.pdf
97
-
98
-
99
- .. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
100
- :alt: Poetry
101
- :target: https://python-poetry.org/
102
-
103
- .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
104
- :alt: Ruff
105
- :target: https://github.com/astral-sh/ruff/
106
-
107
- .. image:: https://www.mypy-lang.org/static/mypy_badge.svg
108
- :alt: Checked with mypy
109
- :target: https://mypy-lang.org/
110
-
111
- .. image:: https://img.shields.io/badge/License-MIT-yellow.svg
112
- :alt: License: MIT
113
- :target: https://opensource.org/licenses/MIT/
114
-
115
-
@@ -1,22 +0,0 @@
1
- mergeron/__init__.py,sha256=RecBYFEM4d7Kue2c34rgPYJwoqZ13ectby7vKzdnKjs,5549
2
- mergeron/core/__init__.py,sha256=liYBlatU39hpdJijSzCDzZwRB90QqeQ2pYRdAb674UM,3113
3
- mergeron/core/empirical_margin_distribution.py,sha256=ktX0r5EHooXFkTed6iTzqkHw0DRv7KIDIcX3h2ukm2I,9313
4
- mergeron/core/ftc_merger_investigations_data.py,sha256=LCh9lTLeMcW_akL9cWU1qJm0kiYdD8UUnQKcvrBIMug,28461
5
- mergeron/core/guidelines_boundaries.py,sha256=yMFyI3RZg0UwBFpUmL6Qk1nUX7lI97dbz9I9a3Pxvdo,15247
6
- mergeron/core/guidelines_boundary_functions.py,sha256=Mxw9OE-pwMbTRNaJLVtx7AYfJeFJgAvFM1LrPuZrzpM,28877
7
- mergeron/core/guidelines_boundary_functions_extra.py,sha256=TnQcBVABvJulDIue3jUlVOaKmwu0EAME6z8RCf-W3Tc,16099
8
- mergeron/core/pseudorandom_numbers.py,sha256=YqcVwU-Pgc0F_pKzG9Osn14RnIuYOwE-q7GVDpCUtpI,9998
9
- mergeron/data/__init__.py,sha256=0JkbzzmzN5mgaLv76gdbcU-GYNizdIqhqxkMB6a-6Cs,1827
10
- mergeron/data/damodaran_margin_data.xls,sha256=Qggl1p5nkOMJI8YUXhkwXQRz-OhRSqBTzz57N0JQyYA,79360
11
- mergeron/data/ftc_merger_investigations_data.zip,sha256=5vqqYFb9iULON4SA1XA0M37N6EblyIYMltgnxELY8yA,15126
12
- mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
13
- mergeron/demo/visualize_empirical_margin_distribution.py,sha256=17awsa188r7uVDJuHuCWTYwlQbfaq4n8HEHF5jK-0Ic,2532
14
- mergeron/gen/__init__.py,sha256=9z2aLgsD9g5NZt7-jMZbb-nThIOXuAzyw4M5rCFVpOo,22620
15
- mergeron/gen/data_generation.py,sha256=LbtNg-3DKyqqzPDMFI2_cFIof3JdaVHwFqwifIH_AWc,17644
16
- mergeron/gen/data_generation_functions.py,sha256=UDh3B4FPwh4SxTdJs7-faLouf7cWUUjHarRkfJc9gjI,26408
17
- mergeron/gen/enforcement_stats.py,sha256=CsO5pk9lKV2xsdINukWL2DjEpt4Asq0YHHJw6zAziCc,10776
18
- mergeron/gen/upp_tests.py,sha256=tsQJYOE6CahyChq_y_LKtq6P3n3exlBiYncB1GYx0Hg,9986
19
- mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
20
- mergeron-2025.739290.6.dist-info/METADATA,sha256=VMQfZraRGyjQQFIdLPSk34C6ADlOAx54wPqhx1ul560,14512
21
- mergeron-2025.739290.6.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
22
- mergeron-2025.739290.6.dist-info/RECORD,,