mergeron 2024.739104.1__tar.gz → 2024.739105.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mergeron might be problematic. Click here for more details.
- mergeron-2024.739105.4/PKG-INFO +115 -0
- mergeron-2024.739105.4/README.rst +73 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/pyproject.toml +2 -2
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/__init__.py +4 -2
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/guidelines_boundaries.py +30 -19
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/guidelines_boundary_functions.py +5 -5
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/guidelines_boundary_functions_extra.py +3 -3
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/gen/__init__.py +31 -28
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/gen/data_generation.py +44 -33
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/gen/data_generation_functions.py +50 -43
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/gen/enforcement_stats.py +12 -12
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/gen/upp_tests.py +9 -10
- mergeron-2024.739104.1/PKG-INFO +0 -102
- mergeron-2024.739104.1/README.rst +0 -60
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/License.txt +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/__init__.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/damodaran_margin_data.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/ftc_merger_investigations_data.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/pseudorandom_numbers.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/__init__.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/damodaran_margin_data.xls +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/damodaran_margin_data_dict.msgpack +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/ftc_invdata.msgpack +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/mergeron.cls +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2 +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/demo/__init__.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/demo/visualize_empirical_margin_distribution.py +0 -0
- {mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/py.typed +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: mergeron
|
|
3
|
+
Version: 2024.739105.4
|
|
4
|
+
Summary: Merger Policy Analysis 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 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Requires-Dist: aenum (>=3.1.15,<4.0.0)
|
|
22
|
+
Requires-Dist: attrs (>=23.2)
|
|
23
|
+
Requires-Dist: bs4 (>=0.0.1)
|
|
24
|
+
Requires-Dist: certifi (>=2023.11.17)
|
|
25
|
+
Requires-Dist: google-re2 (>=1.1)
|
|
26
|
+
Requires-Dist: jinja2 (>=3.1)
|
|
27
|
+
Requires-Dist: joblib (>=1.3)
|
|
28
|
+
Requires-Dist: matplotlib (>=3.8)
|
|
29
|
+
Requires-Dist: mpmath (>=1.3)
|
|
30
|
+
Requires-Dist: msgpack (>=1.0)
|
|
31
|
+
Requires-Dist: msgpack-numpy (>=0.4)
|
|
32
|
+
Requires-Dist: numpy (>=1.26,<2)
|
|
33
|
+
Requires-Dist: scipy (>=1.12)
|
|
34
|
+
Requires-Dist: sympy (>=1.12)
|
|
35
|
+
Requires-Dist: tables (>=3.8)
|
|
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
|
+
Analyze the sets of mergers conforming to concentration and diversion ratio bounds. Analyze 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) estimating enforcement or clearance rates under specified enforcement regimes given a method 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, with specified shape parameters (see property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec`, of type, :code:`.gen.SHRDistribution`). 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 rates can be specified as, "proportional", "inside-out", "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 merging-firms' in-market shares and a default recapture rate. 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, from which are derived market shares and recapture rates for the :math:`N` goods in the putative market (see, :code:`.gen.ShareSpec`). The "outside-in" specification is invalid when the distribution of markets over firm-count is unspecified, i.e., when the property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec` is assigned :code:`.gen.ShareDistributions.UNI`, raising a :code:`ValueError` exception. The "proportional" form (`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 an empirical distribution (see, :code:`.gen.PCMSpec`). The 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 price 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 printed to screen or rendered to LaTex files (for processing into publication-quality tables) 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.MulithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple virtual, logical, or physical CPU cores. This class is an adaptation from the documentation of the :code:`numpy` package, from the discussion on `multithreaded random-number 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.market_sample as market_sample
|
|
84
|
+
|
|
85
|
+
help(market_sample.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
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
mergeron: Merger Policy Analysis using Python
|
|
2
|
+
=============================================
|
|
3
|
+
|
|
4
|
+
Analyze the sets of mergers conforming to concentration and diversion ratio bounds. Analyze 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.
|
|
5
|
+
|
|
6
|
+
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.
|
|
7
|
+
|
|
8
|
+
Introduction
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
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) estimating enforcement or clearance rates under specified enforcement regimes given a method 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`
|
|
14
|
+
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`.
|
|
15
|
+
|
|
16
|
+
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, with specified shape parameters (see property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec`, of type, :code:`.gen.SHRDistribution`). 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.
|
|
17
|
+
|
|
18
|
+
Recapture rates can be specified as, "proportional", "inside-out", "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 merging-firms' in-market shares and a default recapture rate. 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, from which are derived market shares and recapture rates for the :math:`N` goods in the putative market (see, :code:`.gen.ShareSpec`). The "outside-in" specification is invalid when the distribution of markets over firm-count is unspecified, i.e., when the property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec` is assigned :code:`.gen.ShareDistributions.UNI`, raising a :code:`ValueError` exception. The "proportional" form (`recapture_form` = :code:`.RECForm.FIXED`) is often used in the literature, as an approximation to the "inside-out" calibration. See, for example, Coate (2011).
|
|
19
|
+
|
|
20
|
+
Price-cost-margins may be specified as having uniform distribution, Beta distribution (including a bounded Beta distribution with specified mean and variance), or an empirical distribution (see, :code:`.gen.PCMSpec`). The 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`).
|
|
21
|
+
|
|
22
|
+
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 price equal :math:`1 / (1 - \pmb{m})`, where :math:`\pmb{m}` represents the array of margins for firms in the sample.
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
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).
|
|
27
|
+
|
|
28
|
+
Enforcement statistics based on FTC investigations data and test data are printed to screen or rendered to LaTex files (for processing into publication-quality tables) using methods provided in :code:`.gen.enforcement_stats`.
|
|
29
|
+
|
|
30
|
+
Programs demonstrating the use of this package are included in the sub-package, :code:`.demo`.
|
|
31
|
+
|
|
32
|
+
This package includes a class, :code:`.core.pseudorandom_numbers.MulithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple virtual, logical, or physical CPU cores. This class is an adaptation from the documentation of the :code:`numpy` package, from the discussion on `multithreaded random-number 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:
|
|
33
|
+
|
|
34
|
+
.. code-block:: python
|
|
35
|
+
|
|
36
|
+
import mergeron.core.pseudorandom_numbers as prng
|
|
37
|
+
|
|
38
|
+
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:
|
|
39
|
+
|
|
40
|
+
.. code-block:: python
|
|
41
|
+
|
|
42
|
+
import mergeron.core.market_sample as market_sample
|
|
43
|
+
|
|
44
|
+
help(market_sample.MarketSample)
|
|
45
|
+
|
|
46
|
+
.. rubric:: References
|
|
47
|
+
|
|
48
|
+
.. _coate2011:
|
|
49
|
+
|
|
50
|
+
Coate, M. B. (2011). Benchmarking the upward pricing pressure model with Federal Trade
|
|
51
|
+
Commission evidence. Journal of Competition Law & Economics, 7(4), 825--846. URL: https://doi.org/10.1093/joclec/nhr014.
|
|
52
|
+
|
|
53
|
+
.. _ftc_premerger_guide2:
|
|
54
|
+
|
|
55
|
+
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
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
.. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
|
|
59
|
+
:alt: Poetry
|
|
60
|
+
:target: https://python-poetry.org/
|
|
61
|
+
|
|
62
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
63
|
+
:alt: Ruff
|
|
64
|
+
:target: https://github.com/astral-sh/ruff
|
|
65
|
+
|
|
66
|
+
.. image:: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
67
|
+
:alt: Checked with mypy
|
|
68
|
+
:target: https://mypy-lang.org/
|
|
69
|
+
|
|
70
|
+
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
71
|
+
:alt: License: MIT
|
|
72
|
+
:target: https://opensource.org/licenses/MIT
|
|
73
|
+
|
|
@@ -13,7 +13,7 @@ keywords = [
|
|
|
13
13
|
"upward pricing pressure",
|
|
14
14
|
"GUPPI",
|
|
15
15
|
]
|
|
16
|
-
version = "2024.
|
|
16
|
+
version = "2024.739105.4"
|
|
17
17
|
|
|
18
18
|
# Classifiers list: https://pypi.org/classifiers/
|
|
19
19
|
classifiers = [
|
|
@@ -68,8 +68,8 @@ pendulum = ">=3.0.0"
|
|
|
68
68
|
ruff = ">=0.5"
|
|
69
69
|
poetry-plugin-export = "^1.8.0"
|
|
70
70
|
pytest = ">=8.0"
|
|
71
|
+
Sphinx = ">=7.2, <8.0"
|
|
71
72
|
semver = ">=3.0"
|
|
72
|
-
sphinx = ">=7.2"
|
|
73
73
|
sphinx-autodoc-typehints = ">=2.0.0"
|
|
74
74
|
sphinx-autoapi = ">=3.0"
|
|
75
75
|
sphinx-immaterial = ">=0.11"
|
|
@@ -9,7 +9,7 @@ from numpy.typing import NDArray
|
|
|
9
9
|
|
|
10
10
|
_PKG_NAME: str = Path(__file__).parent.stem
|
|
11
11
|
|
|
12
|
-
VERSION = "2024.
|
|
12
|
+
VERSION = "2024.739105.4"
|
|
13
13
|
|
|
14
14
|
__version__ = VERSION
|
|
15
15
|
|
|
@@ -34,9 +34,11 @@ ArrayBoolean: TypeAlias = NDArray[np.bool_]
|
|
|
34
34
|
ArrayDouble: TypeAlias = NDArray[np.double]
|
|
35
35
|
ArrayBIGINT: TypeAlias = NDArray[np.int64]
|
|
36
36
|
|
|
37
|
+
DEFAULT_REC_RATE = 0.85
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
@enum.unique
|
|
39
|
-
class
|
|
41
|
+
class RECForm(enum.StrEnum):
|
|
40
42
|
"""Recapture rate - derivation methods."""
|
|
41
43
|
|
|
42
44
|
INOUT = "inside-out"
|
{mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/guidelines_boundaries.py
RENAMED
|
@@ -13,7 +13,13 @@ import numpy as np
|
|
|
13
13
|
from attrs import Attribute, field, frozen, validators
|
|
14
14
|
from mpmath import mp, mpf # type: ignore
|
|
15
15
|
|
|
16
|
-
from .. import
|
|
16
|
+
from .. import ( # noqa: TID252
|
|
17
|
+
DEFAULT_REC_RATE,
|
|
18
|
+
VERSION,
|
|
19
|
+
ArrayDouble,
|
|
20
|
+
RECForm,
|
|
21
|
+
UPPAggrSelector,
|
|
22
|
+
)
|
|
17
23
|
from . import guidelines_boundary_functions as gbfn
|
|
18
24
|
|
|
19
25
|
__version__ = VERSION
|
|
@@ -86,7 +92,7 @@ class GuidelinesThresholds:
|
|
|
86
92
|
"""
|
|
87
93
|
|
|
88
94
|
def __attrs_post_init__(self, /) -> None:
|
|
89
|
-
# In the 2023
|
|
95
|
+
# In the 2023 Guidelines, the agencies do not define a
|
|
90
96
|
# negative presumption, or safeharbor. Practically speaking,
|
|
91
97
|
# given resource constraints and loss aversion, it is likely
|
|
92
98
|
# that staff only investigates mergers that meet the presumption;
|
|
@@ -128,7 +134,7 @@ class GuidelinesThresholds:
|
|
|
128
134
|
)
|
|
129
135
|
|
|
130
136
|
# imputed_presumption is relevant for 2010 Guidelines
|
|
131
|
-
# merger to
|
|
137
|
+
# merger to symmetry in numbers-equivalent of post-merger HHI
|
|
132
138
|
object.__setattr__(
|
|
133
139
|
self,
|
|
134
140
|
"imputed_presumption",
|
|
@@ -223,14 +229,14 @@ def _divr_value_validator(
|
|
|
223
229
|
|
|
224
230
|
def _rec_spec_validator(
|
|
225
231
|
_instance: DiversionRatioBoundary,
|
|
226
|
-
_attribute: Attribute[
|
|
227
|
-
_value:
|
|
232
|
+
_attribute: Attribute[RECForm],
|
|
233
|
+
_value: RECForm,
|
|
228
234
|
/,
|
|
229
235
|
) -> None:
|
|
230
|
-
if _value ==
|
|
236
|
+
if _value == RECForm.OUTIN and _instance.recapture_rate:
|
|
231
237
|
raise ValueError(
|
|
232
238
|
f"Invalid recapture specification, {_value!r}. "
|
|
233
|
-
"You may consider specifying `mergeron.
|
|
239
|
+
"You may consider specifying `mergeron.RECForm.INOUT` here, and "
|
|
234
240
|
'assigning the default recapture rate as attribute, "recapture_rate" of '
|
|
235
241
|
"this `DiversionRatioBoundarySpec` object."
|
|
236
242
|
)
|
|
@@ -262,27 +268,24 @@ class DiversionRatioBoundary:
|
|
|
262
268
|
)
|
|
263
269
|
|
|
264
270
|
recapture_rate: float = field(
|
|
265
|
-
kw_only=False, default=
|
|
271
|
+
kw_only=False, default=DEFAULT_REC_RATE, validator=validators.instance_of(float)
|
|
266
272
|
)
|
|
267
273
|
|
|
268
|
-
recapture_form:
|
|
274
|
+
recapture_form: RECForm | None = field(
|
|
269
275
|
kw_only=True,
|
|
270
|
-
default=
|
|
271
|
-
validator=(
|
|
272
|
-
validators.instance_of((type(None), RECTypes)),
|
|
273
|
-
_rec_spec_validator,
|
|
274
|
-
),
|
|
276
|
+
default=RECForm.INOUT,
|
|
277
|
+
validator=(validators.instance_of((type(None), RECForm)), _rec_spec_validator),
|
|
275
278
|
)
|
|
276
279
|
"""
|
|
277
280
|
The form of the recapture rate.
|
|
278
281
|
|
|
279
|
-
When :attr:`mergeron.
|
|
282
|
+
When :attr:`mergeron.RECForm.INOUT`, the recapture rate for
|
|
280
283
|
he product having the smaller market-share is assumed to equal the default,
|
|
281
284
|
and the recapture rate for the product with the larger market-share is
|
|
282
285
|
computed assuming MNL demand. Fixed recapture rates are specified as
|
|
283
|
-
:attr:`mergeron.
|
|
286
|
+
:attr:`mergeron.RECForm.FIXED`. (To specify that recapture rates be
|
|
284
287
|
constructed from the generated purchase-probabilities for products in
|
|
285
|
-
the market and for the outside good, specify :attr:`mergeron.
|
|
288
|
+
the market and for the outside good, specify :attr:`mergeron.RECForm.OUTIN`.)
|
|
286
289
|
|
|
287
290
|
The GUPPI boundary is a continuum of diversion ratio boundaries conditional on
|
|
288
291
|
price-cost margins, :math:`d_{ij} = g_i * p_i / (m_j * p_j)`,
|
|
@@ -373,7 +376,11 @@ class DiversionRatioBoundary:
|
|
|
373
376
|
|
|
374
377
|
|
|
375
378
|
def guppi_from_delta(
|
|
376
|
-
_delta_bound: float = 0.01,
|
|
379
|
+
_delta_bound: float = 0.01,
|
|
380
|
+
/,
|
|
381
|
+
*,
|
|
382
|
+
m_star: float = 1.00,
|
|
383
|
+
r_bar: float = DEFAULT_REC_RATE,
|
|
377
384
|
) -> float:
|
|
378
385
|
"""
|
|
379
386
|
Translate ∆HHI bound to GUPPI bound.
|
|
@@ -431,7 +438,11 @@ def critical_share_ratio(
|
|
|
431
438
|
|
|
432
439
|
|
|
433
440
|
def share_from_guppi(
|
|
434
|
-
_guppi_bound: float = 0.065,
|
|
441
|
+
_guppi_bound: float = 0.065,
|
|
442
|
+
/,
|
|
443
|
+
*,
|
|
444
|
+
m_star: float = 1.00,
|
|
445
|
+
r_bar: float = DEFAULT_REC_RATE,
|
|
435
446
|
) -> float:
|
|
436
447
|
"""
|
|
437
448
|
Symmetric-firm share for given GUPPI, margin, and recapture rate.
|
{mergeron-2024.739104.1 → mergeron-2024.739105.4}/src/mergeron/core/guidelines_boundary_functions.py
RENAMED
|
@@ -5,7 +5,7 @@ from typing import Any, Literal, TypedDict
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
from mpmath import mp, mpf # type: ignore
|
|
7
7
|
|
|
8
|
-
from .. import VERSION, ArrayBIGINT, ArrayDouble # noqa: TID252
|
|
8
|
+
from .. import DEFAULT_REC_RATE, VERSION, ArrayBIGINT, ArrayDouble # noqa: TID252
|
|
9
9
|
|
|
10
10
|
__version__ = VERSION
|
|
11
11
|
|
|
@@ -211,7 +211,7 @@ def hhi_post_contrib_boundary(
|
|
|
211
211
|
|
|
212
212
|
def shrratio_boundary_wtd_avg(
|
|
213
213
|
_delta_star: float = 0.075,
|
|
214
|
-
_r_val: float =
|
|
214
|
+
_r_val: float = DEFAULT_REC_RATE,
|
|
215
215
|
/,
|
|
216
216
|
*,
|
|
217
217
|
agg_method: Literal[
|
|
@@ -420,7 +420,7 @@ def shrratio_boundary_wtd_avg(
|
|
|
420
420
|
|
|
421
421
|
def shrratio_boundary_xact_avg(
|
|
422
422
|
_delta_star: float = 0.075,
|
|
423
|
-
_r_val: float =
|
|
423
|
+
_r_val: float = DEFAULT_REC_RATE,
|
|
424
424
|
/,
|
|
425
425
|
*,
|
|
426
426
|
recapture_form: Literal["inside-out", "proportional"] = "inside-out",
|
|
@@ -579,7 +579,7 @@ def shrratio_boundary_xact_avg(
|
|
|
579
579
|
|
|
580
580
|
def shrratio_boundary_min(
|
|
581
581
|
_delta_star: float = 0.075,
|
|
582
|
-
_r_val: float =
|
|
582
|
+
_r_val: float = DEFAULT_REC_RATE,
|
|
583
583
|
/,
|
|
584
584
|
*,
|
|
585
585
|
recapture_form: str = "inside-out",
|
|
@@ -645,7 +645,7 @@ def shrratio_boundary_min(
|
|
|
645
645
|
|
|
646
646
|
|
|
647
647
|
def shrratio_boundary_max(
|
|
648
|
-
_delta_star: float = 0.075, _r_val: float =
|
|
648
|
+
_delta_star: float = 0.075, _r_val: float = DEFAULT_REC_RATE, /, *, prec: int = 10
|
|
649
649
|
) -> GuidelinesBoundary:
|
|
650
650
|
"""
|
|
651
651
|
Share combinations on the minimum GUPPI boundary with symmetric
|
|
@@ -16,7 +16,7 @@ from mpmath import mp, mpf # type: ignore
|
|
|
16
16
|
from scipy.spatial.distance import minkowski as distance_function # type: ignore
|
|
17
17
|
from sympy import lambdify, simplify, solve, symbols # type: ignore
|
|
18
18
|
|
|
19
|
-
from .. import VERSION, ArrayDouble # noqa: TID252
|
|
19
|
+
from .. import DEFAULT_REC_RATE, VERSION, ArrayDouble # noqa: TID252
|
|
20
20
|
from .guidelines_boundary_functions import (
|
|
21
21
|
GuidelinesBoundary,
|
|
22
22
|
_shrratio_boundary_intcpt,
|
|
@@ -105,7 +105,7 @@ def hhi_delta_boundary_qdtr(_dh_val: float = 0.01, /) -> GuidelinesBoundaryCalla
|
|
|
105
105
|
|
|
106
106
|
def shrratio_boundary_qdtr_wtd_avg(
|
|
107
107
|
_delta_star: float = 0.075,
|
|
108
|
-
_r_val: float =
|
|
108
|
+
_r_val: float = DEFAULT_REC_RATE,
|
|
109
109
|
/,
|
|
110
110
|
*,
|
|
111
111
|
weighting: Literal["own-share", "cross-product-share"] | None = "own-share",
|
|
@@ -224,7 +224,7 @@ def shrratio_boundary_qdtr_wtd_avg(
|
|
|
224
224
|
|
|
225
225
|
def shrratio_boundary_distance(
|
|
226
226
|
_delta_star: float = 0.075,
|
|
227
|
-
_r_val: float =
|
|
227
|
+
_r_val: float = DEFAULT_REC_RATE,
|
|
228
228
|
/,
|
|
229
229
|
*,
|
|
230
230
|
agg_method: Literal["arithmetic mean", "distance"] = "arithmetic mean",
|
|
@@ -15,13 +15,14 @@ from attrs import Attribute, cmp_using, field, frozen, validators
|
|
|
15
15
|
from numpy.random import SeedSequence
|
|
16
16
|
|
|
17
17
|
from .. import ( # noqa: TID252
|
|
18
|
+
DEFAULT_REC_RATE,
|
|
18
19
|
VERSION,
|
|
19
20
|
ArrayBIGINT,
|
|
20
21
|
ArrayBoolean,
|
|
21
22
|
ArrayDouble,
|
|
22
23
|
ArrayFloat,
|
|
23
24
|
ArrayINT,
|
|
24
|
-
|
|
25
|
+
RECForm,
|
|
25
26
|
UPPAggrSelector,
|
|
26
27
|
)
|
|
27
28
|
from ..core.pseudorandom_numbers import DIST_PARMS_DEFAULT # noqa: TID252
|
|
@@ -57,7 +58,7 @@ class PriceSpec(tuple[bool, str | None], enum.ReprEnum):
|
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
@enum.unique
|
|
60
|
-
class
|
|
61
|
+
class SHRDistribution(enum.StrEnum):
|
|
61
62
|
"""Market share distributions."""
|
|
62
63
|
|
|
63
64
|
UNI = "Uniform"
|
|
@@ -98,26 +99,26 @@ class ShareSpec:
|
|
|
98
99
|
A key feature of market-share specification in this package is that
|
|
99
100
|
the draws represent markets with multiple different firm-counts.
|
|
100
101
|
Firm-counts are unspecified if the share distribution is
|
|
101
|
-
:attr:`mergeron.
|
|
102
|
+
:attr:`mergeron.SHRDistribution.UNI`, for Dirichlet-distributed market-shares,
|
|
102
103
|
the default specification is that firm-counts vary between
|
|
103
104
|
2 and 7 firms with each value equally likely.
|
|
104
105
|
|
|
105
106
|
Notes
|
|
106
107
|
-----
|
|
107
|
-
If :attr:`mergeron.gen.ShareSpec.dist_type`:code:` == `:attr:`mergeron.gen.
|
|
108
|
+
If :attr:`mergeron.gen.ShareSpec.dist_type`:code:` == `:attr:`mergeron.gen.SHRDistribution.UNI`,
|
|
108
109
|
then it is infeasible that
|
|
109
|
-
:attr:`mergeron.gen.ShareSpec.recapture_form`:code:` == `:attr:`mergeron.
|
|
110
|
+
:attr:`mergeron.gen.ShareSpec.recapture_form`:code:` == `:attr:`mergeron.RECForm.OUTIN`.
|
|
110
111
|
In other words, if firm-counts are unspecified, the recapture rate cannot be
|
|
111
112
|
estimated using outside good choice probabilities.
|
|
112
113
|
|
|
113
114
|
For a sample with explicit firm counts, market shares must
|
|
114
115
|
be specified as having a supported Dirichlet distribution
|
|
115
|
-
(see :class:`mergeron.gen.
|
|
116
|
+
(see :class:`mergeron.gen.SHRDistribution`).
|
|
116
117
|
|
|
117
118
|
"""
|
|
118
119
|
|
|
119
|
-
dist_type:
|
|
120
|
-
"""See :class:`
|
|
120
|
+
dist_type: SHRDistribution
|
|
121
|
+
"""See :class:`SHRDistribution`"""
|
|
121
122
|
|
|
122
123
|
dist_parms: ArrayDouble | None = field(
|
|
123
124
|
default=None, eq=cmp_using(eq=np.array_equal)
|
|
@@ -143,32 +144,32 @@ class ShareSpec:
|
|
|
143
144
|
|
|
144
145
|
@firm_counts_weights.validator
|
|
145
146
|
def _check_fcw(_i: ShareSpec, _a: Attribute[ArrayDouble], _v: ArrayDouble) -> None:
|
|
146
|
-
if _v is not None and _i.dist_type ==
|
|
147
|
+
if _v is not None and _i.dist_type == SHRDistribution.UNI:
|
|
147
148
|
raise ValueError(
|
|
148
149
|
"Generated data for markets with specified firm-counts or "
|
|
149
150
|
"varying firm counts are not feasible for market shares "
|
|
150
151
|
"with Uniform distribution. Consider revising the "
|
|
151
|
-
r"distribution type to {
|
|
152
|
+
r"distribution type to {SHRDistribution.DIR_FLAT}, which gives "
|
|
152
153
|
"uniformly distributed draws on the :math:`n+1` simplex "
|
|
153
154
|
"for firm-count, :math:`n`."
|
|
154
155
|
)
|
|
155
156
|
|
|
156
|
-
recapture_form:
|
|
157
|
-
"""See :class:`mergeron.
|
|
157
|
+
recapture_form: RECForm = field(default=RECForm.INOUT)
|
|
158
|
+
"""See :class:`mergeron.RECForm`"""
|
|
158
159
|
|
|
159
160
|
@recapture_form.validator
|
|
160
|
-
def _check_rf(_i: ShareSpec, _a: Attribute[
|
|
161
|
-
if _v ==
|
|
161
|
+
def _check_rf(_i: ShareSpec, _a: Attribute[RECForm], _v: RECForm) -> None:
|
|
162
|
+
if _v == RECForm.OUTIN and _i.dist_type == SHRDistribution.UNI:
|
|
162
163
|
raise ValueError(
|
|
163
164
|
"Market share specification requires estimation of recapture rate from "
|
|
164
165
|
"generated data. Either delete recapture rate specification or set it to None."
|
|
165
166
|
)
|
|
166
167
|
|
|
167
|
-
recapture_rate: float | None = field(default=
|
|
168
|
-
"""A value between 0 and 1
|
|
168
|
+
recapture_rate: float | None = field(default=DEFAULT_REC_RATE)
|
|
169
|
+
"""A value between 0 and 1.
|
|
169
170
|
|
|
170
171
|
:code:`None` if market share specification requires direct generation of
|
|
171
|
-
outside good choice probabilities (:attr:`mergeron.
|
|
172
|
+
outside good choice probabilities (:attr:`mergeron.RECForm.OUTIN`).
|
|
172
173
|
|
|
173
174
|
The recapture rate is usually calibrated to the numbers-equivalent of the
|
|
174
175
|
HHI threshold for the presumtion of harm from unilateral competitive effects
|
|
@@ -191,7 +192,7 @@ class ShareSpec:
|
|
|
191
192
|
def _check_rr(_i: ShareSpec, _a: Attribute[float], _v: float) -> None:
|
|
192
193
|
if _v and not (0 < _v <= 1):
|
|
193
194
|
raise ValueError("Recapture rate must lie in the interval, [0, 1).")
|
|
194
|
-
elif _v is None and _i.recapture_form !=
|
|
195
|
+
elif _v is None and _i.recapture_form != RECForm.OUTIN:
|
|
195
196
|
raise ValueError(
|
|
196
197
|
f"Recapture specification, {_i.recapture_form!r} requires that "
|
|
197
198
|
"the market sample specification inclues a recapture rate in the "
|
|
@@ -200,7 +201,7 @@ class ShareSpec:
|
|
|
200
201
|
|
|
201
202
|
|
|
202
203
|
@enum.unique
|
|
203
|
-
class
|
|
204
|
+
class PCMDistribution(enum.StrEnum):
|
|
204
205
|
"""Margin distributions."""
|
|
205
206
|
|
|
206
207
|
UNI = "Uniform"
|
|
@@ -210,7 +211,7 @@ class PCMDistributions(enum.StrEnum):
|
|
|
210
211
|
|
|
211
212
|
|
|
212
213
|
@enum.unique
|
|
213
|
-
class
|
|
214
|
+
class FM2Constraint(enum.StrEnum):
|
|
214
215
|
"""Firm 2 margins - derivation methods."""
|
|
215
216
|
|
|
216
217
|
IID = "i.i.d"
|
|
@@ -234,8 +235,8 @@ class PCMSpec:
|
|
|
234
235
|
|
|
235
236
|
"""
|
|
236
237
|
|
|
237
|
-
dist_type:
|
|
238
|
-
"""See :class:`
|
|
238
|
+
dist_type: PCMDistribution = field(kw_only=False, default=PCMDistribution.UNI)
|
|
239
|
+
"""See :class:`PCMDistribution`"""
|
|
239
240
|
|
|
240
241
|
dist_parms: ArrayDouble | None = field(kw_only=False, default=None)
|
|
241
242
|
"""Parameter specification for tailoring PCM distribution
|
|
@@ -260,9 +261,9 @@ class PCMSpec:
|
|
|
260
261
|
"are not valid with margin distribution, {_dist_type_pcm!r}"
|
|
261
262
|
)
|
|
262
263
|
elif (
|
|
263
|
-
_i.dist_type ==
|
|
264
|
+
_i.dist_type == PCMDistribution.BETA and len(_v) != len(("a", "b"))
|
|
264
265
|
) or (
|
|
265
|
-
_i.dist_type ==
|
|
266
|
+
_i.dist_type == PCMDistribution.BETA_BND
|
|
266
267
|
and len(_v) != len(("mu", "sigma", "max", "min"))
|
|
267
268
|
):
|
|
268
269
|
raise ValueError(
|
|
@@ -270,18 +271,20 @@ class PCMSpec:
|
|
|
270
271
|
f'for PCM with distribution, "{_i.dist_type}" is incorrect.'
|
|
271
272
|
)
|
|
272
273
|
|
|
273
|
-
elif _i.dist_type ==
|
|
274
|
+
elif _i.dist_type == PCMDistribution.EMPR and _v is not None:
|
|
274
275
|
raise ValueError(
|
|
275
276
|
f"Empirical distribution does not require additional parameters; "
|
|
276
277
|
f'"given value, {_v!r} is ignored."'
|
|
277
278
|
)
|
|
278
279
|
|
|
279
|
-
firm2_pcm_constraint:
|
|
280
|
-
|
|
280
|
+
firm2_pcm_constraint: FM2Constraint = field(
|
|
281
|
+
kw_only=False, default=FM2Constraint.IID
|
|
282
|
+
)
|
|
283
|
+
"""See :class:`FM2Constraint`"""
|
|
281
284
|
|
|
282
285
|
|
|
283
286
|
@enum.unique
|
|
284
|
-
class
|
|
287
|
+
class SSZConstant(float, enum.ReprEnum):
|
|
285
288
|
"""
|
|
286
289
|
Scale factors to offset sample size reduction.
|
|
287
290
|
|