mergeron 2024.739099.2__py3-none-any.whl → 2024.739104.1__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
@@ -11,19 +11,16 @@ from typing import Literal, TypeAlias, TypedDict
11
11
 
12
12
  import numpy as np
13
13
  import tables as ptb # type: ignore
14
- from joblib import Parallel, cpu_count, delayed # type: ignore
15
14
  from numpy.random import SeedSequence
16
15
 
17
- from .. import ( # noqa: TID252
18
- TF,
19
- TI,
16
+ from .. import ( # noqa
20
17
  VERSION,
21
18
  ArrayBIGINT,
22
19
  ArrayBoolean,
23
20
  ArrayDouble,
24
21
  ArrayFloat,
25
22
  ArrayINT,
26
- RECConstants,
23
+ RECTypes,
27
24
  UPPAggrSelector,
28
25
  )
29
26
  from ..core import guidelines_boundaries as gbl # noqa: TID252
@@ -32,12 +29,10 @@ from . import (
32
29
  DataclassInstance,
33
30
  INVResolution,
34
31
  MarketDataSample,
35
- MarketSpec,
36
32
  UPPTestRegime,
37
33
  UPPTestsCounts,
38
34
  UPPTestsRaw,
39
35
  )
40
- from . import data_generation as dgl
41
36
  from . import enforcement_stats as esl
42
37
 
43
38
  __version__ = VERSION
@@ -58,169 +53,37 @@ class INVRESCntsArgs(TypedDict, total=False):
58
53
  saved_array_name_suffix: str
59
54
 
60
55
 
61
- def sim_enf_cnts_ll(
62
- _mkt_sample_spec: MarketSpec,
63
- _enf_parm_vec: gbl.HMGThresholds,
64
- _sim_test_regime: UPPTestRegime,
56
+ def enf_cnts(
57
+ _market_data_sample: MarketDataSample,
58
+ _upp_test_parms: gbl.HMGThresholds,
59
+ _upp_test_regime: UPPTestRegime,
65
60
  /,
66
- *,
67
- sample_size: int = 10**6,
68
- seed_seq_list: list[SeedSequence] | None = None,
69
- nthreads: int = 16,
70
- save_data_to_file: SaveData = False,
71
- saved_array_name_suffix: str = "",
72
61
  ) -> UPPTestsCounts:
73
- """A function to parallelize data-generation and testing
74
-
75
- The parameters `_sim_enf_cnts_kwargs` are passed unaltered to
76
- the parent function, `sim_enf_cnts()`, except that, if provided,
77
- `seed_seq_list` is used to spawn a seed sequence for each thread,
78
- to assure independent samples in each thread, and `nthreads` defines
79
- the number of parallel processes used. The number of draws in
80
- each thread may be tuned, by trial and error, to the amount of
81
- memory (RAM) available.
62
+ """Estimate enforcement and clearance counts from market data sample
82
63
 
83
64
  Parameters
84
65
  ----------
66
+ _market_data_sample
67
+ Market data sample
85
68
 
86
- _enf_parm_vec
87
- Guidelines thresholds to test against
88
-
89
- _mkt_sample_spec
90
- Configuration to use for generating sample data to test
91
-
92
- _sim_test_regime
93
- Configuration to use for testing
94
-
95
- saved_array_name_suffix
96
- Suffix to add to the array names in the HDF5 file
97
-
98
- save_data_to_file
99
- Whether to save data to an HDF5 file, and where to save it
100
-
101
- sample_size
102
- Number of draws to simulate
103
-
104
- seed_seq_list
105
- List of seed sequences, to assure independent samples in each thread
69
+ _upp_test_parms
70
+ Threshold values for various Guidelines criteria
106
71
 
107
- nthreads
108
- Number of parallel processes to use
72
+ _upp_test_regime
73
+ Specifies whether to analyze enforcement, clearance, or both
74
+ and the GUPPI and diversion ratio aggregators employed, with
75
+ default being to analyze enforcement based on the maximum
76
+ merging-firm GUPPI and maximum diversion ratio between the
77
+ merging firms
109
78
 
110
79
  Returns
111
80
  -------
112
- Arrays of UPPTestCounts
81
+ UPPTestsCounts
82
+ Enforced and cleared counts
113
83
 
114
84
  """
115
- _sample_sz = sample_size
116
- _subsample_sz = 10**6
117
- _iter_count = int(_sample_sz / _subsample_sz) if _subsample_sz < _sample_sz else 1
118
- _thread_count = cpu_count()
119
-
120
- if (
121
- _mkt_sample_spec.share_spec.recapture_form != RECConstants.OUTIN
122
- and _mkt_sample_spec.share_spec.recapture_rate != _enf_parm_vec.rec
123
- ):
124
- raise ValueError(
125
- "{} {} {}".format(
126
- f"Recapture rate from market sample spec, {_mkt_sample_spec.share_spec.recapture_rate}",
127
- f"must match the value, {_enf_parm_vec.rec}",
128
- "the guidelines thresholds vector.",
129
- )
130
- )
131
-
132
- _rng_seed_seq_list = [None] * _iter_count
133
- if seed_seq_list:
134
- _rng_seed_seq_list = list(
135
- zip(*[g.spawn(_iter_count) for g in seed_seq_list], strict=True) # type: ignore
136
- )
137
-
138
- _sim_enf_cnts_kwargs: INVRESCntsArgs = INVRESCntsArgs({
139
- "sample_size": _subsample_sz,
140
- "save_data_to_file": save_data_to_file,
141
- "nthreads": nthreads,
142
- })
143
-
144
- _res_list = Parallel(n_jobs=_thread_count, prefer="threads")(
145
- delayed(sim_enf_cnts)(
146
- _mkt_sample_spec,
147
- _enf_parm_vec,
148
- _sim_test_regime,
149
- **_sim_enf_cnts_kwargs,
150
- saved_array_name_suffix=f"{saved_array_name_suffix}_{_iter_id:0{2 + int(np.ceil(np.log10(_iter_count)))}d}",
151
- seed_seq_list=_rng_seed_seq_list_ch,
152
- )
153
- for _iter_id, _rng_seed_seq_list_ch in enumerate(_rng_seed_seq_list)
154
- )
155
-
156
- _res_list_stacks = UPPTestsCounts(*[
157
- np.stack([getattr(_j, _k) for _j in _res_list])
158
- for _k in ("by_firm_count", "by_delta", "by_conczone")
159
- ])
160
- upp_test_results = UPPTestsCounts(*[
161
- np.column_stack((
162
- (_gv := getattr(_res_list_stacks, _g))[0, :, :_h],
163
- np.einsum("ijk->jk", np.int64(1) * _gv[:, :, _h:]),
164
- ))
165
- for _g, _h in zip(
166
- _res_list_stacks.__dataclass_fields__.keys(), [1, 1, 3], strict=True
167
- )
168
- ])
169
- del _res_list, _res_list_stacks
170
-
171
- return upp_test_results
172
-
173
-
174
- def sim_enf_cnts(
175
- _mkt_sample_spec: MarketSpec,
176
- _upp_test_parms: gbl.HMGThresholds,
177
- _sim_test_regime: UPPTestRegime,
178
- /,
179
- *,
180
- sample_size: int = 10**6,
181
- seed_seq_list: list[SeedSequence] | None = None,
182
- nthreads: int = 16,
183
- save_data_to_file: SaveData = False,
184
- saved_array_name_suffix: str = "",
185
- ) -> UPPTestsCounts:
186
- # Generate market data
187
- _market_data_sample = dgl.gen_market_sample(
188
- _mkt_sample_spec,
189
- sample_size=sample_size,
190
- seed_seq_list=seed_seq_list,
191
- nthreads=nthreads,
192
- )
193
-
194
- _invalid_array_names = (
195
- ("fcounts", "choice_prob_outgd", "nth_firm_share", "hhi_post")
196
- if _mkt_sample_spec.share_spec.dist_type == "Uniform"
197
- else ()
198
- )
199
-
200
- save_data_to_hdf5(
201
- _market_data_sample,
202
- saved_array_name_suffix=saved_array_name_suffix,
203
- excluded_attrs=_invalid_array_names,
204
- save_data_to_file=save_data_to_file,
205
- )
206
-
207
- _upp_test_arrays = enf_cnts(_market_data_sample, _upp_test_parms, _sim_test_regime)
208
-
209
- save_data_to_hdf5(
210
- _upp_test_arrays,
211
- saved_array_name_suffix=saved_array_name_suffix,
212
- save_data_to_file=save_data_to_file,
213
- )
214
-
215
- return _upp_test_arrays
216
-
217
85
 
218
- def enf_cnts(
219
- _market_data_sample: MarketDataSample,
220
- _upp_test_parms: gbl.HMGThresholds,
221
- _upp_test_regime: UPPTestRegime,
222
- /,
223
- ) -> UPPTestsCounts:
86
+ _enf_cnts_sim_array = -1 * np.ones((6, 2), np.int64)
224
87
  _upp_test_arrays = gen_upp_test_arrays(
225
88
  _market_data_sample, _upp_test_parms, _upp_test_regime
226
89
  )
@@ -231,12 +94,13 @@ def enf_cnts(
231
94
 
232
95
  _stats_rowlen = 6
233
96
  # Clearance/enforcement counts --- by firm count
234
- _firm_counts_weights = np.unique(_fcounts)
235
- if _firm_counts_weights is not None and np.all(_firm_counts_weights >= 0):
236
- _max_firm_count = len(_firm_counts_weights)
97
+ _firm_counts_list = np.unique(_fcounts)
98
+ if _firm_counts_list is not None and np.all(_firm_counts_list >= 0):
99
+ # _max_firm_count = len(_firm_counts_list)
100
+ _max_firm_count = max(_firm_counts_list)
237
101
 
238
102
  _enf_cnts_sim_byfirmcount_array = -1 * np.ones(_stats_rowlen, np.int64)
239
- for _firm_cnt in 2 + np.arange(_max_firm_count):
103
+ for _firm_cnt in 1 + np.arange(1, _max_firm_count):
240
104
  _firm_count_test = _fcounts == _firm_cnt
241
105
 
242
106
  _enf_cnts_sim_byfirmcount_array = np.vstack((
@@ -353,12 +217,10 @@ def gen_upp_test_arrays(
353
217
  getattr(_upp_test_parms, _f) for _f in ("guppi", "divr", "cmcr", "ipr")
354
218
  )
355
219
 
356
- _enf_resolution, _guppi_aggregator, _divr_aggregator = (
357
- getattr(_sim_test_regime, _f)
358
- for _f in ("resolution", "guppi_aggregator", "divr_aggregator")
220
+ _guppi_array, _ipr_array, _cmcr_array = (
221
+ np.empty_like(_market_data.price_array) for _ in range(3)
359
222
  )
360
223
 
361
- _guppi_array = np.empty_like(_market_data.divr_array)
362
224
  np.einsum(
363
225
  "ij,ij,ij->ij",
364
226
  _market_data.divr_array,
@@ -367,18 +229,53 @@ def gen_upp_test_arrays(
367
229
  out=_guppi_array,
368
230
  )
369
231
 
370
- _ipr_array = np.empty_like(_market_data.divr_array)
371
- np.divide(_guppi_array, (1 - _market_data.divr_array[:, ::-1]), out=_ipr_array)
232
+ np.divide(
233
+ np.einsum("ij,ij->ij", _market_data.pcm_array, _market_data.divr_array),
234
+ 1 - _market_data.divr_array,
235
+ out=_ipr_array,
236
+ )
372
237
 
373
- _cmcr_array = np.empty_like(_market_data.divr_array)
374
238
  np.divide(_ipr_array, 1 - _market_data.pcm_array, out=_cmcr_array)
375
239
 
376
- _test_measure_seq = (_market_data.divr_array, _guppi_array, _cmcr_array, _ipr_array)
240
+ (_divr_test_vector,) = _compute_test_value_seq(
241
+ (_market_data.divr_array,),
242
+ _market_data.frmshr_array,
243
+ _sim_test_regime.divr_aggregator,
244
+ )
245
+
246
+ (_guppi_test_vector, _cmcr_test_vector, _ipr_test_vector) = _compute_test_value_seq(
247
+ (_guppi_array, _cmcr_array, _ipr_array),
248
+ _market_data.frmshr_array,
249
+ _sim_test_regime.guppi_aggregator,
250
+ )
251
+ del _cmcr_array, _ipr_array, _guppi_array
377
252
 
253
+ if _sim_test_regime.resolution == INVResolution.ENFT:
254
+ _upp_test_arrays = UPPTestsRaw(
255
+ _guppi_test_vector >= _g_bar,
256
+ (_guppi_test_vector >= _g_bar) | (_divr_test_vector >= _divr_bar),
257
+ _cmcr_test_vector >= _cmcr_bar,
258
+ _ipr_test_vector >= _ipr_bar,
259
+ )
260
+ else:
261
+ _upp_test_arrays = UPPTestsRaw(
262
+ _guppi_test_vector < _g_bar,
263
+ (_guppi_test_vector < _g_bar) & (_divr_test_vector < _divr_bar),
264
+ _cmcr_test_vector < _cmcr_bar,
265
+ _ipr_test_vector < _ipr_bar,
266
+ )
267
+
268
+ return _upp_test_arrays
269
+
270
+
271
+ def _compute_test_value_seq(
272
+ _test_measure_seq: tuple[ArrayDouble, ...],
273
+ _wt_array: ArrayDouble,
274
+ _aggregator: UPPAggrSelector,
275
+ ) -> tuple[ArrayDouble, ...]:
378
276
  _wt_array = (
379
- _market_data.frmshr_array
380
- / np.einsum("ij->i", _market_data.frmshr_array)[:, None]
381
- if _guppi_aggregator
277
+ _wt_array / np.einsum("ij->i", _wt_array)[:, None]
278
+ if _aggregator
382
279
  in (
383
280
  UPPAggrSelector.CPA,
384
281
  UPPAggrSelector.CPD,
@@ -388,7 +285,7 @@ def gen_upp_test_arrays(
388
285
  else EMPTY_ARRAY_DEFAULT
389
286
  )
390
287
 
391
- match _guppi_aggregator:
288
+ match _aggregator:
392
289
  case UPPAggrSelector.AVG:
393
290
  _test_value_seq = (
394
291
  1 / 2 * np.einsum("ij->i", _g)[:, None] for _g in _test_measure_seq
@@ -428,30 +325,7 @@ def gen_upp_test_arrays(
428
325
  )
429
326
  case _:
430
327
  raise ValueError("GUPPI/diversion ratio aggregation method is invalid.")
431
- del _cmcr_array, _guppi_array
432
- (_divr_test_vector, _guppi_test_vector, _cmcr_test_vector, _ipr_test_vector) = (
433
- _test_value_seq
434
- )
435
-
436
- if _divr_aggregator == UPPAggrSelector.MAX:
437
- _divr_test_vector = _market_data.divr_array.max(axis=1, keepdims=True)
438
-
439
- if _enf_resolution == INVResolution.ENFT:
440
- _upp_test_arrays = UPPTestsRaw(
441
- _guppi_test_vector >= _g_bar,
442
- (_guppi_test_vector >= _g_bar) | (_divr_test_vector >= _divr_bar),
443
- _cmcr_test_vector >= _cmcr_bar,
444
- _ipr_test_vector >= _ipr_bar,
445
- )
446
- else:
447
- _upp_test_arrays = UPPTestsRaw(
448
- _guppi_test_vector < _g_bar,
449
- (_guppi_test_vector < _g_bar) & (_divr_test_vector < _divr_bar),
450
- _cmcr_test_vector < _cmcr_bar,
451
- _ipr_test_vector < _ipr_bar,
452
- )
453
-
454
- return _upp_test_arrays
328
+ return tuple(_test_value_seq)
455
329
 
456
330
 
457
331
  def initialize_hd5(
@@ -494,11 +368,7 @@ def save_data_to_hdf5(
494
368
 
495
369
 
496
370
  def save_array_to_hdf5(
497
- _array_obj: ArrayFloat[TF]
498
- | ArrayINT[TI]
499
- | ArrayDouble
500
- | ArrayBIGINT
501
- | ArrayBoolean,
371
+ _array_obj: ArrayFloat | ArrayINT | ArrayDouble | ArrayBIGINT | ArrayBoolean,
502
372
  _array_name: str,
503
373
  _h5_group: ptb.Group,
504
374
  _h5_file: ptb.File,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.739099.2
3
+ Version: 2024.739104.1
4
4
  Summary: Merger Policy Analysis using Python
5
5
  License: MIT
6
6
  Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
@@ -1,9 +1,9 @@
1
1
  mergeron/License.txt,sha256=7iX-y0EyjkbVJKJLS4ZKzuuE1wd0lryfsD_IytLG8lQ,1246
2
- mergeron/__init__.py,sha256=A0iVjdlUd_UZWbclyBnPrbCH-JYk_JaMxVv8Dp5y-yU,1541
2
+ mergeron/__init__.py,sha256=MXow5RSpGz49ggTHygQKv5TIJd5iRpTKyQyT9sYGdm4,1455
3
3
  mergeron/core/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
4
4
  mergeron/core/damodaran_margin_data.py,sha256=rMrgN1Qtw572a0ftY97OOj4otq8ldlLrcOi-bcE-org,8554
5
- mergeron/core/ftc_merger_investigations_data.py,sha256=oL_4yrNPpjuNIluBsDc51lYd2Z4NBBrd7-sHKd3FCbg,28129
6
- mergeron/core/guidelines_boundaries.py,sha256=Lv-7EE7b2SiudpRjW3gFY1uHu-K0UdesewwiqaqjcOw,15585
5
+ mergeron/core/ftc_merger_investigations_data.py,sha256=qGAjjXEyqwS1PKKxvJGsSkr0sfI--4oyLss9I1qCNR4,28247
6
+ mergeron/core/guidelines_boundaries.py,sha256=Iu7MBg3WzaRUALOobNmzmv_g7l-Njk1k7Y-esLBZBbk,15541
7
7
  mergeron/core/guidelines_boundary_functions.py,sha256=gohb7Uj1AjJQtD5ew7bVZZjGhJEYCjNNAPB1o6TsA9M,29683
8
8
  mergeron/core/guidelines_boundary_functions_extra.py,sha256=t84dMsaMKnYUNuvvGrMCP6vI8MDn88PJOgGZlNe1Zts,11280
9
9
  mergeron/core/pseudorandom_numbers.py,sha256=cJEWDTfy9CUTzR_di6Fm1Vl1Le6xWoU8wFHbYVMEuLI,9225
@@ -20,13 +20,12 @@ mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinj
20
20
  mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex,sha256=1hw3RINDtBrh9ZEToMIiNFIu9rozcPwRly69-5O_0UQ,3207
21
21
  mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
22
22
  mergeron/demo/visualize_empirical_margin_distribution.py,sha256=v1xFJumBX2Ooye82kSSgly-_GpFVkYSDqBwM__rcmZY,2363
23
- mergeron/gen/__init__.py,sha256=a60dpqC8G8J518Tb3qEJvTvFnVTYSmgZfhciVckokfw,17051
24
- mergeron/gen/_data_generation_functions.py,sha256=tBdzpo-6WjwnHTB3uy2B6TE0e0Ajx0rgi6fVtW9I1b4,27386
25
- mergeron/gen/data_generation.py,sha256=dj9otFi1OE3Eo7f32BD0ZXm9Xvlg0fCp4DDQ_XhDN_w,8479
26
- mergeron/gen/enforcement_stats.py,sha256=p-CgaOo2qh5G9QZjCxZdbVazXeb_AJ_ABDOc2Kdtt-Q,27438
27
- mergeron/gen/market_sample.py,sha256=HkzRFTKBXYIs2HbAyVDUiUHo9nCtAciSn5sohR-34cM,4282
28
- mergeron/gen/upp_tests.py,sha256=ZnV_x2TQqhJuWnnG9aTLnw1OBisgHCwHYxy94OK8W9E,16846
23
+ mergeron/gen/__init__.py,sha256=A-co8RQL-QTsgfErF2O6qC3zcYYR56F6m9PBjH_M1kk,16564
24
+ mergeron/gen/data_generation.py,sha256=_sjFm426uIj0MkoMIWQyL8hq3P4XbBIKe0kMUy7aVps,16449
25
+ mergeron/gen/data_generation_functions.py,sha256=Pglv9rzeb2mG1SKp01AtkILJdvggDQvDnK-u90019po,28505
26
+ mergeron/gen/enforcement_stats.py,sha256=ANnviFnoSUAwZOM5cMG1WrZwbkjuUohplRn5fQmd8Bs,27410
27
+ mergeron/gen/upp_tests.py,sha256=iDtfy-lc7uSnBK37f_AxDIz3mO7Gf7-G5tHbX3QRDI0,12647
29
28
  mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
30
- mergeron-2024.739099.2.dist-info/METADATA,sha256=dyRrp-CAzkssNWLw44aQ-AbKKeuPFleWqEYaRPxaLG0,10922
31
- mergeron-2024.739099.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- mergeron-2024.739099.2.dist-info/RECORD,,
29
+ mergeron-2024.739104.1.dist-info/METADATA,sha256=A4K7HcIzkIoT7KUmlNOqUic42V1psF1kxNgtIih5l68,10922
30
+ mergeron-2024.739104.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
+ mergeron-2024.739104.1.dist-info/RECORD,,
@@ -1,143 +0,0 @@
1
- """
2
- Methods to generate data for analyzing merger enforcement policy.
3
-
4
- """
5
-
6
- from __future__ import annotations
7
-
8
- from attrs import define
9
- from numpy.random import SeedSequence
10
-
11
- from .. import VERSION # noqa: TID252
12
- from ..core.guidelines_boundaries import HMGThresholds # noqa: TID252
13
- from . import MarketSpec, UPPTestRegime
14
- from .data_generation import gen_market_sample
15
- from .upp_tests import SaveData, enf_cnts, save_data_to_hdf5, sim_enf_cnts_ll
16
-
17
- __version__ = VERSION
18
-
19
-
20
- @define(slots=False)
21
- class MarketSample(MarketSpec):
22
- def generate_sample(
23
- self,
24
- /,
25
- *,
26
- sample_size: int,
27
- seed_seq_list: list[SeedSequence] | None,
28
- nthreads: int,
29
- save_data_to_file: SaveData,
30
- ) -> None:
31
- """Generate market data
32
-
33
- Parameters
34
- ----------
35
- sample_size
36
- Size of the market sample drawn
37
-
38
- seed_seq_list
39
- List of :code:`numpy.random.SeedSequence` objects
40
-
41
- nthreads
42
- Number of threads to use
43
-
44
- save_data_to_file
45
- Save data to given HDF5 file, at specified group node
46
-
47
- Returns
48
- -------
49
- None
50
-
51
- Notes
52
- -----
53
- See documentation for :class:`mergeron.gen.data_generation.gen_market_sample`
54
- for more information, and :func:`mergeron.gen.data_generation.parse_seed_seq_list`
55
- on the specification of :code:`seed_seq_list`.
56
-
57
- """
58
- self.data = gen_market_sample(
59
- self,
60
- sample_size=sample_size,
61
- seed_seq_list=seed_seq_list,
62
- nthreads=nthreads,
63
- )
64
-
65
- _invalid_array_names = (
66
- ("fcounts", "choice_prob_outgd", "nth_firm_share", "hhi_post")
67
- if self.share_spec.dist_type == "Uniform"
68
- else ()
69
- )
70
-
71
- if save_data_to_file:
72
- save_data_to_hdf5(
73
- self.data,
74
- excluded_attrs=_invalid_array_names,
75
- save_data_to_file=save_data_to_file,
76
- )
77
-
78
- def estimate_enf_counts(
79
- self,
80
- _enf_parm_vec: HMGThresholds,
81
- _upp_test_regime: UPPTestRegime,
82
- /,
83
- *,
84
- sample_size: int = 10**6,
85
- seed_seq_list: list[SeedSequence] | None,
86
- nthreads: int,
87
- save_data_to_file: SaveData = False,
88
- ) -> None:
89
- """Generate market data
90
-
91
- Parameters
92
- ----------
93
- _enf_parm_vec
94
- Threshold values for various Guidelines criteria
95
-
96
- _upp_test_regime
97
- Specifies whether to analyze enforcement, clearance, or both
98
- and the GUPPI and diversion ratio aggregators employed, with
99
- default being to analyze enforcement based on the maximum
100
- merging-firm GUPPI and maximum diversion ratio between the
101
- merging firms
102
-
103
- sample_size
104
- Size of the market sample drawn
105
-
106
- seed_seq_list
107
- List of :code:`numpy.random.SeedSequence` objects
108
-
109
- nthreads
110
- Number of threads to use
111
-
112
- save_data_to_file
113
- Save data to given HDF5 file, at specified group node
114
-
115
- Returns
116
- -------
117
- None
118
-
119
- Notes
120
- -----
121
- See documentation for :class:`mergeron.gen.MarketSpec` for details on specifying
122
- how shares, margins, prices, and diversion ratios are generated, and whether to restrict
123
- the sample to draws representing mergers that meet the HSR filing requirements. See
124
- :class:`mergeron.gen.MarketDataSample` on the sample data generated; see,
125
- :func:`mergeron.gen.data_generation.parse_seed_seq_list` on
126
- the specification of :code:`seed_seq_list`.
127
-
128
- """
129
-
130
- if getattr(self, "market_data_sample", None) is None:
131
- self.enf_counts = sim_enf_cnts_ll(
132
- self,
133
- _enf_parm_vec,
134
- _upp_test_regime,
135
- sample_size=sample_size,
136
- seed_seq_list=seed_seq_list,
137
- nthreads=nthreads,
138
- save_data_to_file=save_data_to_file,
139
- )
140
- else:
141
- self.enf_counts = enf_cnts(self.data, _enf_parm_vec, _upp_test_regime)
142
- if save_data_to_file:
143
- save_data_to_hdf5(self.enf_counts, save_data_to_file=save_data_to_file)