mergeron 2024.738953.1__tar.gz → 2024.738973.0__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.

Files changed (33) hide show
  1. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/PKG-INFO +32 -17
  2. mergeron-2024.738973.0/README.rst +64 -0
  3. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/pyproject.toml +1 -1
  4. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/License.txt +1 -1
  5. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/__init__.py +19 -9
  6. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/excel_helper.py +3 -1
  7. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/ftc_merger_investigations_data.py +13 -16
  8. mergeron-2024.738973.0/src/mergeron/core/guidelines_boundaries.py +439 -0
  9. mergeron-2024.738953.1/src/mergeron/core/guidelines_boundaries.py → mergeron-2024.738973.0/src/mergeron/core/guidelines_boundary_functions.py +600 -1023
  10. mergeron-2024.738953.1/src/mergeron/core/guidelines_boundaries_specialized_functions.py → mergeron-2024.738973.0/src/mergeron/core/guidelines_boundary_functions_extra.py +59 -22
  11. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/gen/__init__.py +70 -87
  12. mergeron-2024.738953.1/src/mergeron/gen/_data_generation_functions_nonpublic.py → mergeron-2024.738973.0/src/mergeron/gen/_data_generation_functions.py +103 -47
  13. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/gen/data_generation.py +42 -42
  14. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/gen/investigations_stats.py +1 -1
  15. mergeron-2024.738973.0/src/mergeron/gen/market_sample.py +79 -0
  16. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/gen/upp_tests.py +143 -98
  17. mergeron-2024.738953.1/README.rst +0 -49
  18. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/__init__.py +0 -0
  19. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/InCommon RSA Server CA cert chain.pem +0 -0
  20. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/damodaran_margin_data.py +0 -0
  21. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/ftc_invdata.msgpack +0 -0
  22. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/proportions_tests.py +0 -0
  23. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/core/pseudorandom_numbers.py +0 -0
  24. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/ext/__init__.py +0 -0
  25. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/ext/tol_colors.py +0 -0
  26. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -0
  27. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -0
  28. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -0
  29. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +0 -0
  30. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/mergeron.cls +0 -0
  31. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/mergeron_table_collection_template.tex.jinja2 +0 -0
  32. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/jinja_LaTex_templates/setup_tikz_tables.tex.jinja2 +0 -0
  33. {mergeron-2024.738953.1 → mergeron-2024.738973.0}/src/mergeron/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.738953.1
3
+ Version: 2024.738973.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
@@ -51,43 +51,58 @@ Intrinsic clearance and enforcement rates are distinguished from *observed* clea
51
51
  Modules of primary interest
52
52
  ---------------------------
53
53
 
54
- Routines for downloading and organizing FTC merger investigtions data published in 2004, 2007, 2008, and 2013. Includes a routine for constructing investigations data for non-overlapping periods, and other partitions on the data, subject to the constraints of the reported data.
55
54
 
56
- mergeron.core.ftc_merger_investigations_data
57
55
 
58
- Routines for plotting boundaries of (sets of mergers falling within) specified concentration and diversion ratio boundaries and for calibrating GUPPI thresholds to concentration (ΔHHI) thresholds, and vice-versa.
56
+ Methods for plotting boundaries of (sets of mergers falling within) specified concentration and share-ratio boundaries, are in :code:`mergeron.core.guidelines_boundaries`, where share-ratio, :math:`\delta_{ij}` is defined as :math:`\delta_{ij} = d_{ij} / r_i` with :math:`d_{ij}, r_i` a diversion ratio and recapture rate. This module also includes functions for calibrating GUPPI thresholds to concentration (ΔHHI) thresholds, and vice-versa.
59
57
 
60
- mergeron.core.guidelines_boundaries
58
+ Methods for generating industry data under various distributions of shares, prices, and margins are included in, :code:`mergeron.gen.data_generation`. The user can specify whether rates are specified as, "proportional", "inside-out" (i.e., consistent with merging-firms' in-market shares and a default recapture rate), or "outside-in", (i.e., purchase probabilities are 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). Price-cost-margins may be specified as symmetric, i.i.d, or consistent with equilibrium conditions for (profit-mazimization in) Bertrand-Nash oligopoly with MNL demand. 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. Two alternative approaches for modeling statutory filing requirements (HSR filing thresholds) are implemented.
61
59
 
62
- Routines for generating industry data under various distributions of shares, prices, and margins. The user can specify whether rates are specified as, "proportional", "inside-out" (i.e., consistent with merging-firms' in-market shares and a default recapture rate), or "outside-in", (i.e., purchase probabilities are 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). Price-cost-margins may be specified as symmetric, i.i.d, or consistent with equilibrium conditions for (profit-mazimization in) Bertrand-Nash oligopoly with MNL demand. 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. Two alternative approaches for modeling statutory filing requirements (HSR filing thresholds) are implemented.
60
+ Methods for testing generated industry data against criteria on diversion ratio, gross upward pricing pressure ("GUPPI"), critical marginal cost reduction ("CMCR"), and indicative price rise ("IPR")/partial merger simulation are included in the module, :code:`mergeron.gen.guidelines_tests`. Test data are constructed in parallel and the user can specify number of `threads` and sub-sample size for each thread to manage CPU and memory utilization.
63
61
 
64
- mergeron.gen.data_generation
62
+ FTC investigations data and test data are printed to screen or rendered in LaTex to text files (for processing into publication-quality tables) using methods provided in :code:`mergeron.gen.investigations_stats`.
65
63
 
66
- Routines for testing generated industry data against criteria on diversion ratio, gross upward pricing pressure ("GUPPI"), critical marginal cost reduction ("CMCR"), and indicative price rise ("IPR")/partial merger simulation. Test data are constructed in parallel and the user can specify number of `threads` and sub-sample size for each thread to manage CPU and memory utilization.
64
+ Programs demonstrating the analysis and reporting facilites provided by the sub-package, :code:`mergeron.examples`.
67
65
 
68
- mergeron.gen.guidelines_tests
66
+ This package exposes methods employed 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. To access these directly:
69
67
 
70
- FTC investigations data and test data are printed to screen or rendered in LaTex to text files (for processing into publication-quality tables) using routines provided in :code:`mergeron.gen.investigations_stats`.
71
-
72
- Programs demonstrating the analysis and reporting facilites provided by the package.
73
-
74
- mergeron.examples
75
-
76
- This package exposes routines employed 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. To access these directly:
68
+ .. code-block:: python
77
69
 
78
70
  import mergeron.core.pseudorandom_numbers as prng
79
71
 
80
- Also included are routines for estimating confidence intervals for proportions and for contrasts (differences) in proportions. (Although coded from scratch using the source literature, the APIs implemented in the module included here are designed for consistency with the APIs in, :code:`statsmodels.stats.proportion` from the package, :code:`statsmodels` (https://pypi.org/project/statsmodels/).) To access these directly:
72
+ Also included are methods for estimating confidence intervals for proportions and for contrasts (differences) in proportions. (Although coded from scratch using the source literature, the APIs implemented in the module included here are designed for consistency with the APIs in, :code:`statsmodels.stats.proportion` from the package, :code:`statsmodels` (https://pypi.org/project/statsmodels/).) To access these directly:
73
+
74
+ .. code-block:: python
81
75
 
82
76
  import mergeron.core.proportions_tests as prci
83
77
 
84
78
  A recent version of Paul Tol's python module, :code:`tol_colors.py` is redistributed within this package. Other than re-formatting and type annotation, the :code:`tol_colors` module is re-distributed as downloaded from, https://personal.sron.nl/~pault/data/tol_colors.py. The tol_colors.py module is distributed under the Standard 3-clause BSD license. To access the tol_colors module directly:
85
79
 
80
+ .. code-block:: python
81
+
86
82
  import mergeron.ext.tol_colors
87
83
 
88
84
  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:
89
85
 
86
+ .. code-block:: python
87
+
90
88
  import mergeron.core.data_generation as dgl
91
89
 
92
90
  help(dgl.gen_market_sample)
93
91
 
92
+
93
+ .. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
94
+ :alt: Poetry
95
+ :target: https://python-poetry.org/
96
+
97
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
98
+ :alt: Ruff
99
+ :target: https://github.com/astral-sh/ruff
100
+
101
+ .. image:: https://www.mypy-lang.org/static/mypy_badge.svg
102
+ :alt: Checked with mypy
103
+ :target: https://mypy-lang.org/
104
+
105
+ .. image:: https://img.shields.io/badge/License-MIT-yellow.svg
106
+ :alt: License: MIT
107
+ :target: https://opensource.org/licenses/MIT
108
+
@@ -0,0 +1,64 @@
1
+ mergeron: Merger Policy Analysis with Python
2
+ ============================================
3
+
4
+ Download and analyze merger investigations data published by the U.S. Federal Trade Commission in various reports on extended merger investigations during 1996 to 2011. Model the sets of mergers conforming to various U.S. Horizontal Merger Guidelines standards. Analyze intrinsic clearance rates and intrinsic enforcement rates under Guidelines standards using generated data with specified distributions of market shares, price-cost margins, firm counts, and prices, optionally imposing restrictions impled by statutory filing thresholds and/or Bertrand-Nash oligopoly with MNL demand.
5
+
6
+ Intrinsic clearance and enforcement rates are distinguished from *observed* clearance and enforcement rates in that the former do not reflect the effects of screening and deterrence as do the latter.
7
+
8
+ Modules of primary interest
9
+ ---------------------------
10
+
11
+
12
+
13
+ Methods for plotting boundaries of (sets of mergers falling within) specified concentration and share-ratio boundaries, are in :code:`mergeron.core.guidelines_boundaries`, where share-ratio, :math:`\delta_{ij}` is defined as :math:`\delta_{ij} = d_{ij} / r_i` with :math:`d_{ij}, r_i` a diversion ratio and recapture rate. This module also includes functions for calibrating GUPPI thresholds to concentration (ΔHHI) thresholds, and vice-versa.
14
+
15
+ Methods for generating industry data under various distributions of shares, prices, and margins are included in, :code:`mergeron.gen.data_generation`. The user can specify whether rates are specified as, "proportional", "inside-out" (i.e., consistent with merging-firms' in-market shares and a default recapture rate), or "outside-in", (i.e., purchase probabilities are 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). Price-cost-margins may be specified as symmetric, i.i.d, or consistent with equilibrium conditions for (profit-mazimization in) Bertrand-Nash oligopoly with MNL demand. 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. Two alternative approaches for modeling statutory filing requirements (HSR filing thresholds) are implemented.
16
+
17
+ Methods for testing generated industry data against criteria on diversion ratio, gross upward pricing pressure ("GUPPI"), critical marginal cost reduction ("CMCR"), and indicative price rise ("IPR")/partial merger simulation are included in the module, :code:`mergeron.gen.guidelines_tests`. Test data are constructed in parallel and the user can specify number of `threads` and sub-sample size for each thread to manage CPU and memory utilization.
18
+
19
+ FTC investigations data and test data are printed to screen or rendered in LaTex to text files (for processing into publication-quality tables) using methods provided in :code:`mergeron.gen.investigations_stats`.
20
+
21
+ Programs demonstrating the analysis and reporting facilites provided by the sub-package, :code:`mergeron.examples`.
22
+
23
+ This package exposes methods employed 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. To access these directly:
24
+
25
+ .. code-block:: python
26
+
27
+ import mergeron.core.pseudorandom_numbers as prng
28
+
29
+ Also included are methods for estimating confidence intervals for proportions and for contrasts (differences) in proportions. (Although coded from scratch using the source literature, the APIs implemented in the module included here are designed for consistency with the APIs in, :code:`statsmodels.stats.proportion` from the package, :code:`statsmodels` (https://pypi.org/project/statsmodels/).) To access these directly:
30
+
31
+ .. code-block:: python
32
+
33
+ import mergeron.core.proportions_tests as prci
34
+
35
+ A recent version of Paul Tol's python module, :code:`tol_colors.py` is redistributed within this package. Other than re-formatting and type annotation, the :code:`tol_colors` module is re-distributed as downloaded from, https://personal.sron.nl/~pault/data/tol_colors.py. The tol_colors.py module is distributed under the Standard 3-clause BSD license. To access the tol_colors module directly:
36
+
37
+ .. code-block:: python
38
+
39
+ import mergeron.ext.tol_colors
40
+
41
+ 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:
42
+
43
+ .. code-block:: python
44
+
45
+ import mergeron.core.data_generation as dgl
46
+
47
+ help(dgl.gen_market_sample)
48
+
49
+
50
+ .. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
51
+ :alt: Poetry
52
+ :target: https://python-poetry.org/
53
+
54
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
55
+ :alt: Ruff
56
+ :target: https://github.com/astral-sh/ruff
57
+
58
+ .. image:: https://www.mypy-lang.org/static/mypy_badge.svg
59
+ :alt: Checked with mypy
60
+ :target: https://mypy-lang.org/
61
+
62
+ .. image:: https://img.shields.io/badge/License-MIT-yellow.svg
63
+ :alt: License: MIT
64
+ :target: https://opensource.org/licenses/MIT
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "mergeron"
3
3
  # See ./get_version_str.py
4
- version = "2024.738953.1"
4
+ version = "2024.738973.0"
5
5
  description = "Analysis of standards defined in Horizontal Merger Guidelines"
6
6
  keywords = [
7
7
  "merger policy analysis",
@@ -1,7 +1,7 @@
1
1
  mergeron
2
2
  ========
3
3
 
4
- Copyright 2017-2023 S. Murthy Kambhampaty
4
+ Copyright 2017-2024 S. Murthy Kambhampaty
5
5
 
6
6
  MIT License
7
7
  -----------
@@ -1,15 +1,24 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from dataclasses import dataclass
3
4
  from importlib.metadata import version
4
5
 
5
- from attrs import Attribute, define, field, validators
6
+ import numpy as np
7
+ from attrs import Attribute, field, frozen, validators
8
+ from numpy.typing import NDArray
6
9
 
7
10
  from .. import _PKG_NAME, RECConstants, UPPAggrSelector # noqa: TID252
8
11
 
9
12
  __version__ = version(_PKG_NAME)
10
13
 
11
14
 
12
- def _delta_value_validator(
15
+ @dataclass(frozen=True)
16
+ class GuidelinesBoundary:
17
+ coordinates: NDArray[np.float64]
18
+ area: float
19
+
20
+
21
+ def _divr_value_validator(
13
22
  _instance: UPPBoundarySpec, _attribute: Attribute[float], _value: float, /
14
23
  ) -> None:
15
24
  if not 0 <= _value <= 1:
@@ -38,15 +47,15 @@ def _rec_spec_validator(
38
47
  )
39
48
 
40
49
 
41
- @define(slots=True, frozen=True)
50
+ @frozen
42
51
  class UPPBoundarySpec:
43
- share_ratio: float = field(
52
+ diversion_ratio: float = field(
44
53
  kw_only=False,
45
- default=0.075,
46
- validator=(validators.instance_of(float), _delta_value_validator),
54
+ default=0.045,
55
+ validator=(validators.instance_of(float), _divr_value_validator),
47
56
  )
48
57
  rec: float = field(
49
- kw_only=False, default=0.80, validator=validators.instance_of(float)
58
+ kw_only=False, default=0.855, validator=validators.instance_of(float)
50
59
  )
51
60
 
52
61
  agg_method: UPPAggrSelector = field(
@@ -54,11 +63,12 @@ class UPPBoundarySpec:
54
63
  default=UPPAggrSelector.MAX,
55
64
  validator=validators.instance_of(UPPAggrSelector),
56
65
  )
57
- recapture_spec: RECConstants | None = field(
66
+
67
+ recapture_form: RECConstants | None = field(
58
68
  kw_only=True,
59
69
  default=RECConstants.INOUT,
60
70
  validator=(
61
- validators.optional(validators.instance_of(RECConstants)), # type: ignore
71
+ validators.instance_of((type(None), RECConstants)),
62
72
  _rec_spec_validator,
63
73
  ),
64
74
  )
@@ -1,5 +1,5 @@
1
1
  """
2
- Routines for writing data from Python to fresh Excel workbooks using
2
+ Methods for writing data from Python to fresh Excel workbooks using
3
3
  the third-party package, `xlsxwriter`.
4
4
 
5
5
  Includes a flexible system of defining cell formats.
@@ -27,6 +27,8 @@ __version__ = version(_PKG_NAME)
27
27
  class CFmtParent(dict[str, Any], enum.ReprEnum): # type: ignore
28
28
  """Unique mappings defining xlsxwirter Workbook formats"""
29
29
 
30
+ ...
31
+
30
32
 
31
33
  class CFmt(CFmtParent):
32
34
  """
@@ -1,5 +1,5 @@
1
1
  """
2
- Routines to parse FTC Merger Investigations Data, downloading source documents
2
+ Methods to parse FTC Merger Investigations Data, downloading source documents
3
3
  as necessary
4
4
 
5
5
  NOTES
@@ -16,7 +16,6 @@ from pathlib import Path
16
16
  from types import MappingProxyType
17
17
  from typing import Any, NamedTuple, TypeAlias
18
18
 
19
- import fitz # type: ignore
20
19
  import msgpack # type: ignore
21
20
  import msgpack_numpy as m # type: ignore
22
21
  import numpy as np
@@ -146,7 +145,7 @@ def construct_data(
146
145
  )
147
146
  return MappingProxyType(_invdata)
148
147
 
149
- _invdata = dict(parse_invdata()) # Convert immutable to mutable
148
+ _invdata = dict(_parse_invdata()) # Convert immutable to mutable
150
149
 
151
150
  # Add some data periods (
152
151
  # only periods ending in 2011, others have few observations and
@@ -385,21 +384,9 @@ def _invdata_build_aggregate_table(
385
384
  )
386
385
 
387
386
 
388
- def parse_invdata(
389
- _invdata_docnames: Sequence[str] = (
390
- "040831horizmergersdata96-03.pdf",
391
- "p035603horizmergerinvestigationdata1996-2005.pdf",
392
- "081201hsrmergerdata.pdf",
393
- "130104horizontalmergerreport.pdf",
394
- ),
395
- ) -> INVData:
387
+ def _parse_invdata() -> INVData:
396
388
  """Parse FTC merger investigations data reports to structured data.
397
389
 
398
- Parameters
399
- ----------
400
- _invdata_docnames
401
- Names of PDF files reporting FTC merger investigations data.
402
-
403
390
  Returns
404
391
  -------
405
392
  Immutable dictionary of merger investigations data, keyed to
@@ -408,6 +395,16 @@ def parse_invdata(
408
395
  by range of HHI and ∆HHI.
409
396
 
410
397
  """
398
+ import fitz # type: ignore
399
+ # user must install pymupdf to make this function operable
400
+
401
+ _invdata_docnames: Sequence[str] = (
402
+ "040831horizmergersdata96-03.pdf",
403
+ "p035603horizmergerinvestigationdata1996-2005.pdf",
404
+ "081201hsrmergerdata.pdf",
405
+ "130104horizontalmergerreport.pdf",
406
+ )
407
+
411
408
  _invdata: dict[str, dict[str, dict[str, INVTableData]]] = {}
412
409
 
413
410
  for _invdata_docname in _invdata_docnames: