mergeron 2024.738936.2__py3-none-any.whl → 2024.738940.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 +4 -2
- mergeron/core/guidelines_standards.py +137 -83
- mergeron/examples/concentration_as_diversion.py +30 -30
- mergeron/examples/investigations_stats_sim_tables.py +22 -29
- mergeron/examples/safeharbor_boundaries_for_mergers_with_asymmetric_shares.py +13 -13
- mergeron/examples/safeharbor_boundaries_for_symmetric_firm_mergers.py +3 -3
- mergeron/examples/sound_guppi_safeharbor.py +31 -28
- mergeron/examples/testIntrinsicClearanceRates.py +12 -12
- mergeron/examples/visualize_guidelines_tests.py +34 -29
- mergeron/gen/__init__.py +463 -0
- mergeron/gen/_data_generation_functions_nonpublic.py +626 -0
- mergeron/gen/data_generation.py +45 -989
- mergeron/gen/guidelines_tests.py +122 -99
- mergeron/gen/investigations_stats.py +10 -12
- mergeron/jinja_LaTex_templates/clrrate_cis_summary_table_template.tex.jinja2 +1 -1
- mergeron/jinja_LaTex_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +1 -1
- {mergeron-2024.738936.2.dist-info → mergeron-2024.738940.0.dist-info}/METADATA +1 -1
- {mergeron-2024.738936.2.dist-info → mergeron-2024.738940.0.dist-info}/RECORD +19 -18
- {mergeron-2024.738936.2.dist-info → mergeron-2024.738940.0.dist-info}/WHEEL +0 -0
mergeron/gen/guidelines_tests.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Routines to
|
|
2
|
+
Routines to estimate intrinsic clearnace rates and intrinsic enforcement rates
|
|
3
3
|
from generated market data.
|
|
4
4
|
|
|
5
5
|
"""
|
|
@@ -10,19 +10,29 @@ from .. import _PKG_NAME # noqa: TID252
|
|
|
10
10
|
|
|
11
11
|
__version__ = version(_PKG_NAME)
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
import enum
|
|
15
14
|
from collections.abc import Mapping, Sequence
|
|
16
|
-
from
|
|
15
|
+
from dataclasses import fields
|
|
16
|
+
from typing import Any, Literal, TypeAlias
|
|
17
17
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
import tables as ptb # type: ignore
|
|
20
|
-
from attr import evolve
|
|
20
|
+
from attr import define, evolve, field, validators
|
|
21
21
|
from joblib import Parallel, cpu_count, delayed # type: ignore
|
|
22
22
|
from numpy.random import SeedSequence
|
|
23
23
|
from numpy.typing import NDArray
|
|
24
24
|
|
|
25
|
-
from ..core import guidelines_standards as
|
|
25
|
+
from ..core import guidelines_standards as gsl # noqa: TID252
|
|
26
|
+
from . import (
|
|
27
|
+
EMPTY_ARRAY_DEFAULT,
|
|
28
|
+
FCOUNT_WTS_DEFAULT,
|
|
29
|
+
DataclassInstance,
|
|
30
|
+
MarketDataSample,
|
|
31
|
+
MarketSampleSpec,
|
|
32
|
+
RECConstants,
|
|
33
|
+
UPPTestsCounts,
|
|
34
|
+
UPPTestsRaw,
|
|
35
|
+
)
|
|
26
36
|
from . import data_generation as dgl
|
|
27
37
|
from . import investigations_stats as isl
|
|
28
38
|
|
|
@@ -33,7 +43,7 @@ SaveData: TypeAlias = Literal[False] | tuple[Literal[True], ptb.File, str]
|
|
|
33
43
|
|
|
34
44
|
|
|
35
45
|
@enum.unique
|
|
36
|
-
class
|
|
46
|
+
class UPPAggrSelector(enum.StrEnum):
|
|
37
47
|
"""
|
|
38
48
|
Aggregator selection for GUPPI and diversion ratio
|
|
39
49
|
|
|
@@ -49,24 +59,28 @@ class GUPPIWghtngSelector(enum.StrEnum):
|
|
|
49
59
|
OSD = "own-share-weighted distance"
|
|
50
60
|
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
@define(slots=True, frozen=True)
|
|
63
|
+
class UPPTestRegime:
|
|
64
|
+
resolution: isl.PolicySelector = field( # type: ignore
|
|
65
|
+
default=isl.PolicySelector.ENFT,
|
|
66
|
+
validator=validators.instance_of(isl.PolicySelector), # type: ignore
|
|
67
|
+
)
|
|
68
|
+
primary_aggregator: UPPAggrSelector = field( # type: ignore
|
|
69
|
+
default=UPPAggrSelector.MAX,
|
|
70
|
+
validator=validators.instance_of(UPPAggrSelector | None), # type: ignore
|
|
71
|
+
)
|
|
72
|
+
secondary_aggregator: UPPAggrSelector | None = field( # type: ignore
|
|
73
|
+
default=primary_aggregator,
|
|
74
|
+
validator=validators.instance_of(UPPAggrSelector | None), # type: ignore
|
|
75
|
+
)
|
|
62
76
|
|
|
63
77
|
|
|
64
78
|
def sim_invres_cnts_ll(
|
|
65
|
-
_invres_parm_vec:
|
|
66
|
-
_mkt_sample_spec:
|
|
79
|
+
_invres_parm_vec: gsl.GuidelinesSTD,
|
|
80
|
+
_mkt_sample_spec: MarketSampleSpec,
|
|
67
81
|
_sim_invres_cnts_kwargs: Mapping[str, Any],
|
|
68
82
|
/,
|
|
69
|
-
) ->
|
|
83
|
+
) -> UPPTestsCounts:
|
|
70
84
|
"""
|
|
71
85
|
A function to parallelize simulations
|
|
72
86
|
|
|
@@ -87,6 +101,23 @@ def sim_invres_cnts_ll(
|
|
|
87
101
|
# Crate a copy, to avoid side effects in the outer scope
|
|
88
102
|
_mkt_sample_spec_here = evolve(_mkt_sample_spec, sample_size=_subsample_sz)
|
|
89
103
|
|
|
104
|
+
if (
|
|
105
|
+
_mkt_sample_spec.recapture_rate is None
|
|
106
|
+
and _mkt_sample_spec.share_spec.recapture_spec != RECConstants.OUTIN
|
|
107
|
+
):
|
|
108
|
+
_mkt_sample_spec_here = evolve(
|
|
109
|
+
_mkt_sample_spec_here, recapture_rate=_invres_parm_vec.rec
|
|
110
|
+
)
|
|
111
|
+
elif _mkt_sample_spec.recapture_rate != _invres_parm_vec.rec:
|
|
112
|
+
raise ValueError(
|
|
113
|
+
"{} {} {} {}".format(
|
|
114
|
+
f"Value, {_mkt_sample_spec.recapture_rate}",
|
|
115
|
+
"of recapture rate in the second positional argument",
|
|
116
|
+
f"must equal its value, {_invres_parm_vec.rec}",
|
|
117
|
+
"in the first positional argument.",
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
|
|
90
121
|
_rng_seed_seq_list = [None] * _iter_count
|
|
91
122
|
if _sim_invres_cnts_kwargs:
|
|
92
123
|
if _sseql := _sim_invres_cnts_kwargs.get("seed_seq_list", None):
|
|
@@ -113,50 +144,33 @@ def sim_invres_cnts_ll(
|
|
|
113
144
|
for _thread_id, _rng_seed_seq_list_ch in enumerate(_rng_seed_seq_list)
|
|
114
145
|
)
|
|
115
146
|
|
|
116
|
-
_res_list_stacks =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
) = (
|
|
147
|
+
_res_list_stacks = UPPTestsCounts(*[
|
|
148
|
+
np.stack([getattr(_j, _k) for _j in _res_list])
|
|
149
|
+
for _k in ("by_firm_count", "by_delta", "by_conczone")
|
|
150
|
+
])
|
|
151
|
+
upp_test_results = UPPTestsCounts(*[
|
|
122
152
|
np.column_stack((
|
|
123
|
-
_g[0, :, :_h],
|
|
124
|
-
np.einsum("ijk->jk", np.int64(1) *
|
|
153
|
+
(_gv := getattr(_res_list_stacks, _g.name))[0, :, :_h],
|
|
154
|
+
np.einsum("ijk->jk", np.int64(1) * _gv[:, :, _h:]),
|
|
125
155
|
))
|
|
126
|
-
for _g, _h in zip(_res_list_stacks, [1, 1, 3], strict=True)
|
|
127
|
-
)
|
|
156
|
+
for _g, _h in zip(fields(_res_list_stacks), [1, 1, 3], strict=True)
|
|
157
|
+
])
|
|
128
158
|
del _res_list, _res_list_stacks
|
|
129
159
|
|
|
130
|
-
return
|
|
131
|
-
_invres_cnts_sim_byfirmcount_array,
|
|
132
|
-
_invres_cnts_sim_bydelta_array,
|
|
133
|
-
_invres_cnts_sim_byconczone_array,
|
|
134
|
-
)
|
|
160
|
+
return upp_test_results
|
|
135
161
|
|
|
136
162
|
|
|
137
163
|
def sim_invres_cnts(
|
|
138
|
-
|
|
139
|
-
_mkt_sample_spec:
|
|
164
|
+
_upp_test_parms: gsl.GuidelinesSTD,
|
|
165
|
+
_mkt_sample_spec: MarketSampleSpec,
|
|
140
166
|
/,
|
|
141
167
|
*,
|
|
142
|
-
sim_test_regime:
|
|
143
|
-
isl.PolicySelector, GUPPIWghtngSelector, GUPPIWghtngSelector | None
|
|
144
|
-
],
|
|
168
|
+
sim_test_regime: UPPTestRegime,
|
|
145
169
|
saved_array_name_suffix: str = "",
|
|
146
170
|
save_data_to_file: SaveData = False,
|
|
147
171
|
seed_seq_list: list[SeedSequence] | None = None,
|
|
148
172
|
nthreads: int = 16,
|
|
149
|
-
) ->
|
|
150
|
-
if _mkt_sample_spec.recapture_rate != _guppi_test_parms.rec:
|
|
151
|
-
raise ValueError(
|
|
152
|
-
"{} {} {} {}".format(
|
|
153
|
-
f"Value, {_mkt_sample_spec.recapture_rate}",
|
|
154
|
-
"of recapture rate in the second positional argument",
|
|
155
|
-
f"must equal its value, {_guppi_test_parms.rec}",
|
|
156
|
-
"in the first positional argument.",
|
|
157
|
-
)
|
|
158
|
-
)
|
|
159
|
-
|
|
173
|
+
) -> UPPTestsCounts:
|
|
160
174
|
# Generate market data
|
|
161
175
|
_market_data = dgl.gen_market_sample(
|
|
162
176
|
_mkt_sample_spec, seed_seq_list=seed_seq_list, nthreads=nthreads
|
|
@@ -168,7 +182,7 @@ def sim_invres_cnts(
|
|
|
168
182
|
else ()
|
|
169
183
|
)
|
|
170
184
|
|
|
171
|
-
|
|
185
|
+
save_data_to_hdf5(
|
|
172
186
|
_market_data,
|
|
173
187
|
saved_array_name_suffix,
|
|
174
188
|
_invalid_array_names,
|
|
@@ -176,7 +190,7 @@ def sim_invres_cnts(
|
|
|
176
190
|
)
|
|
177
191
|
|
|
178
192
|
_upp_tests_data = gen_upp_arrays(
|
|
179
|
-
|
|
193
|
+
_upp_test_parms,
|
|
180
194
|
_market_data,
|
|
181
195
|
sim_test_regime,
|
|
182
196
|
saved_array_name_suffix=saved_array_name_suffix,
|
|
@@ -189,14 +203,13 @@ def sim_invres_cnts(
|
|
|
189
203
|
del _market_data
|
|
190
204
|
|
|
191
205
|
# Clearance/enforcement counts --- by firm count
|
|
192
|
-
# Accumulate firm_count, numobs, num_gmbound, num_gsf, num_cbound, num_ibound
|
|
193
206
|
_stats_rowlen = 6
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if _mkt_sample_spec.share_spec.
|
|
197
|
-
else _mkt_sample_spec.share_spec.
|
|
207
|
+
_firm_counts_weights: NDArray[np.float64 | np.int64] = (
|
|
208
|
+
FCOUNT_WTS_DEFAULT
|
|
209
|
+
if _mkt_sample_spec.share_spec.firm_counts_weights is None
|
|
210
|
+
else _mkt_sample_spec.share_spec.firm_counts_weights
|
|
198
211
|
)
|
|
199
|
-
_max_firm_count = len(
|
|
212
|
+
_max_firm_count = len(_firm_counts_weights)
|
|
200
213
|
|
|
201
214
|
_invres_cnts_sim_byfirmcount_array = -1 * np.ones(_stats_rowlen, np.int64)
|
|
202
215
|
for _firm_cnt in 2 + np.arange(_max_firm_count):
|
|
@@ -208,13 +221,17 @@ def sim_invres_cnts(
|
|
|
208
221
|
_firm_cnt,
|
|
209
222
|
np.einsum("ij->", 1 * _firm_count_test),
|
|
210
223
|
*[
|
|
211
|
-
np.einsum(
|
|
212
|
-
|
|
224
|
+
np.einsum(
|
|
225
|
+
"ij->",
|
|
226
|
+
1 * (_firm_count_test & getattr(_upp_tests_data, _f.name)),
|
|
227
|
+
)
|
|
228
|
+
for _f in fields(_upp_tests_data)
|
|
213
229
|
],
|
|
214
230
|
]),
|
|
215
231
|
))
|
|
216
232
|
_invres_cnts_sim_byfirmcount_array = _invres_cnts_sim_byfirmcount_array[1:]
|
|
217
233
|
|
|
234
|
+
# Clearance/enfrocement counts --- by delta
|
|
218
235
|
_hhi_delta_ranged = isl.hhi_delta_ranger(_hhi_delta)
|
|
219
236
|
_invres_cnts_sim_bydelta_array = -1 * np.ones(_stats_rowlen, np.int64)
|
|
220
237
|
for _hhi_delta_lim in isl.HHI_DELTA_KNOTS[:-1]:
|
|
@@ -226,15 +243,18 @@ def sim_invres_cnts(
|
|
|
226
243
|
_hhi_delta_lim,
|
|
227
244
|
np.einsum("ij->", 1 * _hhi_delta_test),
|
|
228
245
|
*[
|
|
229
|
-
np.einsum(
|
|
230
|
-
|
|
246
|
+
np.einsum(
|
|
247
|
+
"ij->",
|
|
248
|
+
1 * (_hhi_delta_test & getattr(_upp_tests_data, _f.name)),
|
|
249
|
+
)
|
|
250
|
+
for _f in fields(_upp_tests_data)
|
|
231
251
|
],
|
|
232
252
|
]),
|
|
233
253
|
))
|
|
234
254
|
|
|
235
255
|
_invres_cnts_sim_bydelta_array = _invres_cnts_sim_bydelta_array[1:]
|
|
236
256
|
|
|
237
|
-
# Clearance/enfrocement counts --- by zone
|
|
257
|
+
# Clearance/enfrocement counts --- by zone
|
|
238
258
|
try:
|
|
239
259
|
_hhi_zone_post_ranged = isl.hhi_zone_post_ranger(_hhi_post)
|
|
240
260
|
except ValueError as _err:
|
|
@@ -261,8 +281,10 @@ def sim_invres_cnts(
|
|
|
261
281
|
_hhi_zone_delta_knot,
|
|
262
282
|
np.einsum("ij->", 1 * _conc_test),
|
|
263
283
|
*[
|
|
264
|
-
np.einsum(
|
|
265
|
-
|
|
284
|
+
np.einsum(
|
|
285
|
+
"ij->", 1 * (_conc_test & getattr(_upp_tests_data, _f.name))
|
|
286
|
+
)
|
|
287
|
+
for _f in fields(_upp_tests_data)
|
|
266
288
|
],
|
|
267
289
|
]),
|
|
268
290
|
))
|
|
@@ -273,7 +295,7 @@ def sim_invres_cnts(
|
|
|
273
295
|
del _stats_byconczone_sim
|
|
274
296
|
del _hhi_delta, _hhi_post, _fcounts
|
|
275
297
|
|
|
276
|
-
return (
|
|
298
|
+
return UPPTestsCounts(
|
|
277
299
|
_invres_cnts_sim_byfirmcount_array,
|
|
278
300
|
_invres_cnts_sim_bydelta_array,
|
|
279
301
|
_invres_cnts_sim_byconczone_array,
|
|
@@ -281,21 +303,22 @@ def sim_invres_cnts(
|
|
|
281
303
|
|
|
282
304
|
|
|
283
305
|
def gen_upp_arrays(
|
|
284
|
-
|
|
285
|
-
_market_data:
|
|
286
|
-
_sim_test_regime:
|
|
287
|
-
isl.PolicySelector, GUPPIWghtngSelector, GUPPIWghtngSelector | None
|
|
288
|
-
],
|
|
306
|
+
_upp_test_parms: gsl.GuidelinesSTD,
|
|
307
|
+
_market_data: MarketDataSample,
|
|
308
|
+
_sim_test_regime: UPPTestRegime,
|
|
289
309
|
/,
|
|
290
310
|
*,
|
|
291
311
|
saved_array_name_suffix: str = "",
|
|
292
312
|
save_data_to_file: SaveData = False,
|
|
293
|
-
) ->
|
|
313
|
+
) -> UPPTestsRaw:
|
|
294
314
|
_g_bar, _divr_bar, _cmcr_bar, _ipr_bar = (
|
|
295
|
-
getattr(
|
|
315
|
+
getattr(_upp_test_parms, _f) for _f in ("guppi", "divr", "cmcr", "ipr")
|
|
296
316
|
)
|
|
297
317
|
|
|
298
|
-
|
|
318
|
+
_invres_resolution, _guppi_aggregator, _divr_aggregator = (
|
|
319
|
+
getattr(_sim_test_regime, _f)
|
|
320
|
+
for _f in ("resolution", "primary_aggregator", "secondary_aggregator")
|
|
321
|
+
)
|
|
299
322
|
|
|
300
323
|
_guppi_array = np.empty_like(_market_data.divr_array)
|
|
301
324
|
np.einsum(
|
|
@@ -329,50 +352,50 @@ def gen_upp_arrays(
|
|
|
329
352
|
_wt_array = (
|
|
330
353
|
_market_data.frmshr_array
|
|
331
354
|
/ np.einsum("ij->i", _market_data.frmshr_array)[:, None]
|
|
332
|
-
if
|
|
355
|
+
if _guppi_aggregator
|
|
333
356
|
in (
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
357
|
+
UPPAggrSelector.CPA,
|
|
358
|
+
UPPAggrSelector.CPD,
|
|
359
|
+
UPPAggrSelector.OSA,
|
|
360
|
+
UPPAggrSelector.OSD,
|
|
338
361
|
)
|
|
339
|
-
else
|
|
362
|
+
else EMPTY_ARRAY_DEFAULT
|
|
340
363
|
)
|
|
341
364
|
|
|
342
|
-
match
|
|
343
|
-
case
|
|
365
|
+
match _guppi_aggregator:
|
|
366
|
+
case UPPAggrSelector.AVG:
|
|
344
367
|
_test_value_seq = (
|
|
345
368
|
1 / 2 * np.einsum("ij->i", _g)[:, None] for _g in _test_measure_seq
|
|
346
369
|
)
|
|
347
|
-
case
|
|
370
|
+
case UPPAggrSelector.CPA:
|
|
348
371
|
_test_value_seq = (
|
|
349
372
|
np.einsum("ij,ij->i", _wt_array[:, ::-1], _g)[:, None]
|
|
350
373
|
for _g in _test_measure_seq
|
|
351
374
|
)
|
|
352
|
-
case
|
|
375
|
+
case UPPAggrSelector.CPD:
|
|
353
376
|
_test_value_seq = (
|
|
354
377
|
np.sqrt(np.einsum("ij,ij,ij->i", _wt_array[:, ::-1], _g, _g))[:, None]
|
|
355
378
|
for _g in _test_measure_seq
|
|
356
379
|
)
|
|
357
|
-
case
|
|
380
|
+
case UPPAggrSelector.DIS:
|
|
358
381
|
_test_value_seq = (
|
|
359
382
|
np.sqrt(1 / 2 * np.einsum("ij,ij->i", _g, _g))[:, None]
|
|
360
383
|
for _g in _test_measure_seq
|
|
361
384
|
)
|
|
362
|
-
case
|
|
385
|
+
case UPPAggrSelector.MAX:
|
|
363
386
|
_test_value_seq = (
|
|
364
387
|
_g.max(axis=1, keepdims=True) for _g in _test_measure_seq
|
|
365
388
|
)
|
|
366
|
-
case
|
|
389
|
+
case UPPAggrSelector.MIN:
|
|
367
390
|
_test_value_seq = (
|
|
368
391
|
_g.min(axis=1, keepdims=True) for _g in _test_measure_seq
|
|
369
392
|
)
|
|
370
|
-
case
|
|
393
|
+
case UPPAggrSelector.OSA:
|
|
371
394
|
_test_value_seq = (
|
|
372
395
|
np.einsum("ij,ij->i", _wt_array, _g)[:, None]
|
|
373
396
|
for _g in _test_measure_seq
|
|
374
397
|
)
|
|
375
|
-
case
|
|
398
|
+
case UPPAggrSelector.OSD:
|
|
376
399
|
_test_value_seq = (
|
|
377
400
|
np.sqrt(np.einsum("ij,ij,ij->i", _wt_array, _g, _g))[:, None]
|
|
378
401
|
for _g in _test_measure_seq
|
|
@@ -384,18 +407,18 @@ def gen_upp_arrays(
|
|
|
384
407
|
_test_value_seq
|
|
385
408
|
)
|
|
386
409
|
|
|
387
|
-
if
|
|
410
|
+
if _divr_aggregator == UPPAggrSelector.MAX:
|
|
388
411
|
_divr_test_vector = _market_data.divr_array.max(axis=1, keepdims=True)
|
|
389
412
|
|
|
390
|
-
if
|
|
391
|
-
_upp_tests_data =
|
|
413
|
+
if _invres_resolution == isl.PolicySelector.ENFT:
|
|
414
|
+
_upp_tests_data = UPPTestsRaw(
|
|
392
415
|
_guppi_test_vector >= _g_bar,
|
|
393
416
|
(_guppi_test_vector >= _g_bar) | (_divr_test_vector >= _divr_bar),
|
|
394
417
|
_cmcr_test_vector >= _cmcr_bar,
|
|
395
418
|
_ipr_test_vector >= _ipr_bar,
|
|
396
419
|
)
|
|
397
420
|
else:
|
|
398
|
-
_upp_tests_data =
|
|
421
|
+
_upp_tests_data = UPPTestsRaw(
|
|
399
422
|
_guppi_test_vector < _g_bar,
|
|
400
423
|
(_guppi_test_vector < _g_bar) & (_divr_test_vector < _divr_bar),
|
|
401
424
|
_cmcr_test_vector < _cmcr_bar,
|
|
@@ -403,7 +426,7 @@ def gen_upp_arrays(
|
|
|
403
426
|
)
|
|
404
427
|
del _guppi_test_vector, _divr_test_vector, _cmcr_test_vector, _ipr_test_vector
|
|
405
428
|
|
|
406
|
-
|
|
429
|
+
save_data_to_hdf5(
|
|
407
430
|
_upp_tests_data,
|
|
408
431
|
saved_array_name_suffix,
|
|
409
432
|
(),
|
|
@@ -413,8 +436,8 @@ def gen_upp_arrays(
|
|
|
413
436
|
return _upp_tests_data
|
|
414
437
|
|
|
415
438
|
|
|
416
|
-
def
|
|
417
|
-
_dclass:
|
|
439
|
+
def save_data_to_hdf5(
|
|
440
|
+
_dclass: DataclassInstance,
|
|
418
441
|
_saved_array_name_suffix: str,
|
|
419
442
|
_excl_attrs: Sequence[str] = (),
|
|
420
443
|
/,
|
|
@@ -424,12 +447,12 @@ def save_namedtuple_to_hdf5(
|
|
|
424
447
|
if save_data_to_file:
|
|
425
448
|
_, _h5_datafile, _h5_hier = save_data_to_file
|
|
426
449
|
# Save market data arrays
|
|
427
|
-
for _array_name in _dclass
|
|
450
|
+
for _array_name in fields(_dclass):
|
|
428
451
|
if _excl_attrs and _array_name in _excl_attrs:
|
|
429
452
|
pass
|
|
430
453
|
save_to_hdf(
|
|
431
454
|
_dclass,
|
|
432
|
-
_array_name,
|
|
455
|
+
_array_name.name,
|
|
433
456
|
_h5_datafile,
|
|
434
457
|
_h5_hier,
|
|
435
458
|
saved_array_name_suffix=_saved_array_name_suffix,
|
|
@@ -437,7 +460,7 @@ def save_namedtuple_to_hdf5(
|
|
|
437
460
|
|
|
438
461
|
|
|
439
462
|
def save_to_hdf(
|
|
440
|
-
_dclass:
|
|
463
|
+
_dclass: DataclassInstance,
|
|
441
464
|
_array_name: str,
|
|
442
465
|
_h5_datafile: ptb.File,
|
|
443
466
|
_h5_hier: str,
|
|
@@ -15,20 +15,16 @@ import enum
|
|
|
15
15
|
from collections.abc import Mapping, Sequence
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
from types import SimpleNamespace
|
|
18
|
-
from typing import TypeVar
|
|
19
18
|
|
|
20
19
|
import numpy as np
|
|
21
20
|
import re2 as re # type: ignore
|
|
22
21
|
from jinja2 import Environment, FileSystemLoader, Template, select_autoescape
|
|
23
|
-
from numpy.typing import
|
|
22
|
+
from numpy.typing import NDArray
|
|
24
23
|
from scipy.interpolate import interp1d # type: ignore
|
|
25
24
|
|
|
26
25
|
from ..core import ftc_merger_investigations_data as fid # noqa: TID252
|
|
27
26
|
from ..core.proportions_tests import propn_ci # noqa: TID252
|
|
28
|
-
|
|
29
|
-
T = TypeVar("T", bound=NBitBase)
|
|
30
|
-
TF = TypeVar("TF", bound=NBitBase)
|
|
31
|
-
TI = TypeVar("TI", bound=NBitBase)
|
|
27
|
+
from . import TF, TI
|
|
32
28
|
|
|
33
29
|
|
|
34
30
|
@enum.unique
|
|
@@ -409,7 +405,7 @@ def table_no_lku(
|
|
|
409
405
|
|
|
410
406
|
|
|
411
407
|
def invres_cnts_byfirmcount(
|
|
412
|
-
_cnts_array: NDArray[np.integer[
|
|
408
|
+
_cnts_array: NDArray[np.integer[TI]], /
|
|
413
409
|
) -> NDArray[np.int64]:
|
|
414
410
|
_ndim_in = 1
|
|
415
411
|
return np.row_stack([
|
|
@@ -421,7 +417,7 @@ def invres_cnts_byfirmcount(
|
|
|
421
417
|
])
|
|
422
418
|
|
|
423
419
|
|
|
424
|
-
def invres_cnts_bydelta(_cnts_array: NDArray[np.integer[
|
|
420
|
+
def invres_cnts_bydelta(_cnts_array: NDArray[np.integer[TI]], /) -> NDArray[np.int64]:
|
|
425
421
|
_ndim_in = 2
|
|
426
422
|
return np.row_stack([
|
|
427
423
|
np.concatenate([
|
|
@@ -432,7 +428,9 @@ def invres_cnts_bydelta(_cnts_array: NDArray[np.integer[T]], /) -> NDArray[np.in
|
|
|
432
428
|
])
|
|
433
429
|
|
|
434
430
|
|
|
435
|
-
def invres_cnts_byconczone(
|
|
431
|
+
def invres_cnts_byconczone(
|
|
432
|
+
_cnts_array: NDArray[np.integer[TI]], /
|
|
433
|
+
) -> NDArray[np.int64]:
|
|
436
434
|
# Prepare to tag clearance stats by presumption zone
|
|
437
435
|
_hhi_zone_post_ranged = hhi_zone_post_ranger(_cnts_array[:, 0] / 1e4)
|
|
438
436
|
_hhi_delta_ranged = hhi_delta_ranger(_cnts_array[:, 1] / 1e4)
|
|
@@ -519,7 +517,7 @@ def latex_tbl_invres_stats_1dim(
|
|
|
519
517
|
_v: (
|
|
520
518
|
"{[2500, 5000]}"
|
|
521
519
|
if _k == "2,500 +"
|
|
522
|
-
else f"{{[{_k.replace(
|
|
520
|
+
else f"{{[{_k.replace(",", "").replace(" - ", ", ")})}}"
|
|
523
521
|
)
|
|
524
522
|
for _k, _v in fid.CONC_DELTA_DICT.items()
|
|
525
523
|
if _k != "TOTAL"
|
|
@@ -623,8 +621,8 @@ def latex_tbl_invres_stats_byzone(
|
|
|
623
621
|
|
|
624
622
|
|
|
625
623
|
def _stats_formatted_row(
|
|
626
|
-
_stats_row_cnt: NDArray[np.integer[
|
|
627
|
-
_stats_row_tot: NDArray[np.integer[
|
|
624
|
+
_stats_row_cnt: NDArray[np.integer[TI]],
|
|
625
|
+
_stats_row_tot: NDArray[np.integer[TI]],
|
|
628
626
|
_return_type_sel: StatsReturnSelector,
|
|
629
627
|
/,
|
|
630
628
|
) -> list[list[str]]:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
((* set table_ref, obs_merger_class_desc = "3.1", tmpl_data.obs_merger_class *))
|
|
8
8
|
((* endif *))
|
|
9
9
|
|
|
10
|
-
((* if tmpl_data.
|
|
10
|
+
((* if tmpl_data.test_res == 'Enforcement' *))
|
|
11
11
|
((* set prop_title = "Proportion Enforced" *))
|
|
12
12
|
((* else *))
|
|
13
13
|
((* set prop_title = "Proportion Cleared" *))
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
((* set obs_merger_class_0 = "Markets with, ``" + tmpl_data.obs_merger_class_0 + "''" *))
|
|
6
6
|
((* endif *))
|
|
7
7
|
|
|
8
|
-
((* if tmpl_data.
|
|
8
|
+
((* if tmpl_data.test_res == 'Enforcement' *))
|
|
9
9
|
((* set prop_title = "Proportion Enforced" *))
|
|
10
10
|
((* else *))
|
|
11
11
|
((* set prop_title = "Proportion Cleared" *))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.738940.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
|
|
@@ -3,39 +3,40 @@ 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=Sf0EPQ18UNG_sxa4c2iqcJyP0aNc5sYedn8oetQ1S5o,7539
|
|
7
7
|
mergeron/core/ftc_merger_investigations_data.py,sha256=C37gFwSSgUFu98FW8ZDlUTgEaz4qYa1aKPC3SPtXChU,26553
|
|
8
|
-
mergeron/core/guidelines_standards.py,sha256=
|
|
8
|
+
mergeron/core/guidelines_standards.py,sha256=EgwUjutfegZGg_P42hk1dmHJwfE0D0TxLySKgPUXZ7Y,44576
|
|
9
9
|
mergeron/core/proportions_tests.py,sha256=zALaWNrGOltsCp2ZSP4pcUfrOCaOoR5YDavqxQHADKA,15275
|
|
10
10
|
mergeron/core/pseudorandom_numbers.py,sha256=ZnIE1ixp3JcgJjlulgMsIcWFVAxeyjC9lsiMIk7OHlM,9430
|
|
11
11
|
mergeron/examples/__init__.py,sha256=iyfxkX3-SoMS4ZQZKHKPn8JEMN536vpty9oSZf0LHv8,115
|
|
12
|
-
mergeron/examples/concentration_as_diversion.py,sha256=
|
|
12
|
+
mergeron/examples/concentration_as_diversion.py,sha256=RqUkF5N-uBKb3VdiuOeSAqStdPScint1BPruj5uD84c,20575
|
|
13
13
|
mergeron/examples/example_parameterizations.py,sha256=VP-hi7L0j30ffcEzmJ3P8mOj1VjwEWKCTZSx_CaVQxA,4197
|
|
14
14
|
mergeron/examples/guidelines_enforcement_patterns.py,sha256=gpAW9jLLg3bbf4ueCu71QUKIca_eb3tTtAuTwY14m3c,2235
|
|
15
15
|
mergeron/examples/investigations_stats_obs_tables.py,sha256=IDUZqZHiNvyO05d-yaYUJ_3-G_tchA4Z4MTaEICV9g0,17801
|
|
16
|
-
mergeron/examples/investigations_stats_sim_tables.py,sha256=
|
|
16
|
+
mergeron/examples/investigations_stats_sim_tables.py,sha256=Qb7SiFZuDQVt1aBzl8lS5XnzDkOaUtPgWcgSZm6xXh8,15537
|
|
17
17
|
mergeron/examples/plotSafeHarbs_symbolically.py,sha256=PgBQ6MMapE5LYHpvR_0iuMCuRPpK-dSea493mT2kU-o,1527
|
|
18
|
-
mergeron/examples/safeharbor_boundaries_for_mergers_with_asymmetric_shares.py,sha256=
|
|
19
|
-
mergeron/examples/safeharbor_boundaries_for_symmetric_firm_mergers.py,sha256=
|
|
20
|
-
mergeron/examples/sound_guppi_safeharbor.py,sha256=
|
|
18
|
+
mergeron/examples/safeharbor_boundaries_for_mergers_with_asymmetric_shares.py,sha256=HWVb-B3R4e0E2Ozt7LGYPzUGjAOsYV_doFPsmTeCqL0,15594
|
|
19
|
+
mergeron/examples/safeharbor_boundaries_for_symmetric_firm_mergers.py,sha256=1hnG-MaE7e8wI2-R21oBcBZT8iKwYlr8ljqU4bbQmHg,5778
|
|
20
|
+
mergeron/examples/sound_guppi_safeharbor.py,sha256=E66B7kp-CT9aS7uSaTsFo3zeGOWNAXo-XECoRLOqwsg,5818
|
|
21
21
|
mergeron/examples/summarize_ftc_investigations_data.py,sha256=gdArFnmiX08RHPu1uns3tUI4HlRORzaP4a3QfJd4n8o,1356
|
|
22
|
-
mergeron/examples/testIntrinsicClearanceRates.py,sha256=
|
|
22
|
+
mergeron/examples/testIntrinsicClearanceRates.py,sha256=T0-6m-SEPVy-mY8gZY2HlJO4ncBa47r87bERhhANLFs,5378
|
|
23
23
|
mergeron/examples/visualize_empirical_margin_distribution.py,sha256=lBA38XVqiI7NsEtO--C37azrMRjzOVi1Fm5-_QV4DAk,2901
|
|
24
|
-
mergeron/examples/visualize_guidelines_tests.py,sha256=
|
|
24
|
+
mergeron/examples/visualize_guidelines_tests.py,sha256=AiTZq-eBmbfszaYiAInZLSoO6FCM4M0YEjuxIFwqZ6s,9216
|
|
25
25
|
mergeron/ext/__init__.py,sha256=iyfxkX3-SoMS4ZQZKHKPn8JEMN536vpty9oSZf0LHv8,115
|
|
26
26
|
mergeron/ext/tol_colors.py,sha256=wFOHZXWZonbp9mhmSGu9mVujBYhdTsvx9_WikMpoCmo,22229
|
|
27
|
-
mergeron/gen/__init__.py,sha256=
|
|
28
|
-
mergeron/gen/
|
|
29
|
-
mergeron/gen/
|
|
30
|
-
mergeron/gen/
|
|
31
|
-
mergeron/
|
|
27
|
+
mergeron/gen/__init__.py,sha256=ClrPKh2Bhe4_zGcBYGJkMff-XDZo1VNkq3oVQPLB334,15119
|
|
28
|
+
mergeron/gen/_data_generation_functions_nonpublic.py,sha256=V-PC75Ye_tujPaXaCqXWvgffDh94DMoR2ShhlSQWJtw,21365
|
|
29
|
+
mergeron/gen/data_generation.py,sha256=dGEwt_GGToOIY4jhsRzva_1OS2Zff4nmkldn9UxLEHM,8917
|
|
30
|
+
mergeron/gen/guidelines_tests.py,sha256=jJ1YAWcBhnGzR7pC0vjzGEsxqAsb2WTix8g6KGkd130,15971
|
|
31
|
+
mergeron/gen/investigations_stats.py,sha256=5eKFzLAzjtGL76MOEtnGcZI_d0fiKi66qLBxPUp8WWs,22896
|
|
32
|
+
mergeron/jinja_LaTex_templates/clrrate_cis_summary_table_template.tex.jinja2,sha256=ae4JiciU-pt8YAM8mRbsmt4W6ePuN1y1NPCWD95oXIo,4833
|
|
32
33
|
mergeron/jinja_LaTex_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2,sha256=ODEurkC0UHuWpjRUiQpeW85njSeUEUJYRdYg8gqoEq0,3642
|
|
33
34
|
mergeron/jinja_LaTex_templates/ftcinvdata_summary_table_template.tex.jinja2,sha256=h8_DEE0iskT9tnga5lZtxcoevN7pY4iKF-maErt4UU4,2906
|
|
34
|
-
mergeron/jinja_LaTex_templates/ftcinvdata_summarypaired_table_template.tex.jinja2,sha256=
|
|
35
|
+
mergeron/jinja_LaTex_templates/ftcinvdata_summarypaired_table_template.tex.jinja2,sha256=Ox0ctiyW_hoOPzoWskOpuygomuV6XWhLeLo40KGRy2U,5224
|
|
35
36
|
mergeron/jinja_LaTex_templates/mergeron.cls,sha256=AV2mk4-uERvAuMkE95Ka7el6LZsb0JZKP4ieiNCnfMU,4562
|
|
36
37
|
mergeron/jinja_LaTex_templates/mergeron_table_collection_template.tex.jinja2,sha256=nr6xUI0_2KHG4Sz9k1JFVQjs2h9qS9BGt1MeE6Tygs8,2429
|
|
37
38
|
mergeron/jinja_LaTex_templates/setup_tikz_tables.tex.jinja2,sha256=WKVxtp3eoMchfGliQAJMj4w2FtBkWG5z2V3-hBYUYUQ,3292
|
|
38
39
|
mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
39
|
-
mergeron-2024.
|
|
40
|
-
mergeron-2024.
|
|
41
|
-
mergeron-2024.
|
|
40
|
+
mergeron-2024.738940.0.dist-info/METADATA,sha256=snMq9DvwPjDmZgQlLDhksCUUbhIqxYwq4J_hPJEaUkQ,6452
|
|
41
|
+
mergeron-2024.738940.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
42
|
+
mergeron-2024.738940.0.dist-info/RECORD,,
|
|
File without changes
|