mergeron 2024.739125.3__tar.gz → 2024.739127.1__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.739125.3 → mergeron-2024.739127.1}/PKG-INFO +6 -6
  2. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/README.rst +5 -5
  3. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/pyproject.toml +3 -1
  4. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/__init__.py +8 -9
  5. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/ftc_merger_investigations_data.py +2 -2
  6. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/guidelines_boundaries.py +2 -2
  7. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/demo/visualize_empirical_margin_distribution.py +2 -3
  8. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/gen/data_generation.py +21 -21
  9. mergeron-2024.739127.1/src/mergeron/gen/enforcement_stats.py +355 -0
  10. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/gen/upp_tests.py +19 -18
  11. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -121
  12. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -82
  13. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -57
  14. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tabularray.tex.jinja2 +0 -81
  15. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tikz.tex.jinja2 +0 -142
  16. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/mergeron.cls +0 -155
  17. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2 +0 -93
  18. mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.sty +0 -129
  19. mergeron-2024.739125.3/src/mergeron/gen/enforcement_stats.py +0 -890
  20. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/License.txt +0 -0
  21. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/__init__.py +0 -0
  22. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/damodaran_margin_data.py +0 -0
  23. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/guidelines_boundary_functions.py +0 -0
  24. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/guidelines_boundary_functions_extra.py +0 -0
  25. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/core/pseudorandom_numbers.py +0 -0
  26. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/data/__init__.py +0 -0
  27. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/data/damodaran_margin_data.xls +0 -0
  28. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/data/damodaran_margin_data_dict.msgpack +0 -0
  29. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/data/ftc_invdata.msgpack +0 -0
  30. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/demo/__init__.py +0 -0
  31. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/gen/__init__.py +0 -0
  32. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/gen/data_generation_functions.py +0 -0
  33. {mergeron-2024.739125.3 → mergeron-2024.739127.1}/src/mergeron/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.739125.3
3
+ Version: 2024.739127.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
@@ -41,16 +41,16 @@ Description-Content-Type: text/x-rst
41
41
  mergeron: Merger Policy Analysis using Python
42
42
  =============================================
43
43
 
44
- 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.
44
+ Visualize the sets of mergers conforming to concentration and diversion-ratio standards. Estimate intrinsic enforcement rates, and intrinsic clearance rates, under concentration, diversion ratio, GUPPI, CMCR, and IPR bounds using generated data with specified distributions of market shares, price-cost margins, firm counts, and prices, optionally imposing restrictions implied by statutory filing thresholds and/or Bertrand-Nash oligopoly with MNL demand. Download and analyze merger investigations data published by the U.S. Federal Trade Commission in various reports on extended merger investigations (Second Requests) during 1996 to 2011.
45
45
 
46
46
  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.
47
47
 
48
48
  Introduction
49
49
  ------------
50
50
 
51
- 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.
51
+ 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.
52
52
 
53
- 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`
53
+ Module :code:`.gen.data_generation` includes the :code:`.gen.data_generation.MarketSample` which provides for a rich specification of shares and diversion ratios (:code:`.gen.data_generation.MarketSample.share_spec`), margins (:code:`.gen.data_generation.MarketSample.pcm_spec`, prices (:code:`.gen.data_generation.MarketSample.price_spec`), and HSR filing requirements (:code:`.gen.data_generation.MarketSample.hsr_filing_test_type`), and with methods for, (i) generating sample data (:code:`.gen.data_generation.MarketSample.generate_sample`), and (ii) computing the intrinsic enforcement rate and intrinsic clearance rate for the generated sample, given a method (:code:`.UPPAggrSelector`) of aggregating diversion ratio or GUPPI estimates for the firms in a merger (:code:`.gen.data_generation.MarketSample.estimate_enf_counts`). While the latter populate the properties, :code:`.gen.data_generation.MarketSample.data`
54
54
  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`.
55
55
 
56
56
  By default, merging-firm shares are drawn with uniform distribution over the space :math:`s_1 + s_2 \leqslant 1` for an unspecified number of firms. Alternatively, shares may be drawn from the Dirichlet distribution (see property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec`, of type, :code:`.gen.SHRDistribution`), with specified shape parameters (property `dist_parms` of :code:`.gen.data_generation.MarketSample.share_spec`. When drawing shares from the Dirichlet distribution, the user specifies the `firm_count_weights` property of :code:`.gen.data_generation.MarketSample.share_spec`, as a vector of weights specifying the frequency distribution over sequential firm counts, e.g., :code:`[133, 184, 134, 52, 32, 10, 12, 4, 3]` to specify shares drawn from Dirichlet distributions with 2 to 10 pre-merger firms distributed as in data for FTC merger investigations during 1996--2003 (See, for example, Table 4.1 of `FTC, Horizontal Merger Investigations Data, Fiscal Years 1996--2003 (Revised: August 31, 2004) <https://www.ftc.gov/sites/default/files/documents/reports/horizontal-merger-investigation-data-fiscal-years-1996-2003/040831horizmergersdata96-03.pdf>`_). If the property `firm_count_weights` is not explicitly assigned a value when defining :code:`.gen.data_generation.MarketSample.share_spec`, the default values is used, which results in a sample of markets with 2 to 7 firms with relative frequency in inverse proportion to firm-count, with 2-firm markets being 6 times as likely to be drawn as 7-firm markets.
@@ -65,11 +65,11 @@ The market sample may be restricted to mergers meeting the HSR filing requiremen
65
65
 
66
66
  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).
67
67
 
68
- 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`.
68
+ Enforcement statistics based on FTC investigations data and test data are tabulated using methods provided in :code:`.gen.enforcement_stats`.
69
69
 
70
70
  Programs demonstrating the use of this package are included in the sub-package, :code:`.demo`.
71
71
 
72
- This package includes a class, :code:`.core.pseudorandom_numbers.MultithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple 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:
72
+ This package includes a class, :code:`.core.pseudorandom_numbers.MultithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple CPU cores, be they virtual, logical, or physical cores. This class is an adaptation from the documentation for the external :code:`numpy.random` subpackage, from the discussion on, "`Multithreaded generation <https://numpy.org/doc/stable/reference/random/multithreading.html>`_"; the version included here permits selection of the distribution with pre-tests to catch and inform on common errors. To access these directly:
73
73
 
74
74
  .. code-block:: python
75
75
 
@@ -1,16 +1,16 @@
1
1
  mergeron: Merger Policy Analysis using Python
2
2
  =============================================
3
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.
4
+ Visualize the sets of mergers conforming to concentration and diversion-ratio standards. Estimate intrinsic enforcement rates, and intrinsic clearance rates, under concentration, diversion ratio, GUPPI, CMCR, and IPR bounds using generated data with specified distributions of market shares, price-cost margins, firm counts, and prices, optionally imposing restrictions implied by statutory filing thresholds and/or Bertrand-Nash oligopoly with MNL demand. Download and analyze merger investigations data published by the U.S. Federal Trade Commission in various reports on extended merger investigations (Second Requests) during 1996 to 2011.
5
5
 
6
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
7
 
8
8
  Introduction
9
9
  ------------
10
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.
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
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`
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) computing the intrinsic enforcement rate and intrinsic clearance rate for the generated sample, given a method (:code:`.UPPAggrSelector`) of aggregating diversion ratio or GUPPI estimates for the firms in a merger (:code:`.gen.data_generation.MarketSample.estimate_enf_counts`). While the latter populate the properties, :code:`.gen.data_generation.MarketSample.data`
14
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
15
 
16
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 (see property `dist_type` of :code:`.gen.data_generation.MarketSample.share_spec`, of type, :code:`.gen.SHRDistribution`), with specified shape parameters (property `dist_parms` of :code:`.gen.data_generation.MarketSample.share_spec`. When drawing shares from the Dirichlet distribution, the user specifies the `firm_count_weights` property of :code:`.gen.data_generation.MarketSample.share_spec`, as a vector of weights specifying the frequency distribution over sequential firm counts, e.g., :code:`[133, 184, 134, 52, 32, 10, 12, 4, 3]` to specify shares drawn from Dirichlet distributions with 2 to 10 pre-merger firms distributed as in data for FTC merger investigations during 1996--2003 (See, for example, Table 4.1 of `FTC, Horizontal Merger Investigations Data, Fiscal Years 1996--2003 (Revised: August 31, 2004) <https://www.ftc.gov/sites/default/files/documents/reports/horizontal-merger-investigation-data-fiscal-years-1996-2003/040831horizmergersdata96-03.pdf>`_). If the property `firm_count_weights` is not explicitly assigned a value when defining :code:`.gen.data_generation.MarketSample.share_spec`, the default values is used, which results in a sample of markets with 2 to 7 firms with relative frequency in inverse proportion to firm-count, with 2-firm markets being 6 times as likely to be drawn as 7-firm markets.
@@ -25,11 +25,11 @@ The market sample may be restricted to mergers meeting the HSR filing requiremen
25
25
 
26
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
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`.
28
+ Enforcement statistics based on FTC investigations data and test data are tabulated using methods provided in :code:`.gen.enforcement_stats`.
29
29
 
30
30
  Programs demonstrating the use of this package are included in the sub-package, :code:`.demo`.
31
31
 
32
- This package includes a class, :code:`.core.pseudorandom_numbers.MultithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple 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:
32
+ This package includes a class, :code:`.core.pseudorandom_numbers.MultithreadedRNG` for generating random numbers with selected continuous distribution over specified parameters, and with CPU multithreading on machines with multiple CPU cores, be they virtual, logical, or physical cores. This class is an adaptation from the documentation for the external :code:`numpy.random` subpackage, from the discussion on, "`Multithreaded generation <https://numpy.org/doc/stable/reference/random/multithreading.html>`_"; the version included here permits selection of the distribution with pre-tests to catch and inform on common errors. To access these directly:
33
33
 
34
34
  .. code-block:: python
35
35
 
@@ -13,7 +13,7 @@ keywords = [
13
13
  "upward pricing pressure",
14
14
  "GUPPI",
15
15
  ]
16
- version = "2024.739125.3"
16
+ version = "2024.739127.1"
17
17
 
18
18
  # Classifiers list: https://pypi.org/classifiers/
19
19
  classifiers = [
@@ -180,6 +180,8 @@ allow_redefinition = true
180
180
 
181
181
  plugins = "numpy.typing.mypy_plugin"
182
182
 
183
+ enable_incomplete_feature = "NewGenericSyntax"
184
+
183
185
  [tool.pytest.ini_options]
184
186
  log_auto_indent = 4
185
187
  minversion = "8.0"
@@ -2,14 +2,13 @@ from __future__ import annotations
2
2
 
3
3
  import enum
4
4
  from pathlib import Path
5
- from typing import TypeAlias
6
5
 
7
6
  import numpy as np
8
7
  from numpy.typing import NDArray
9
8
 
10
9
  _PKG_NAME: str = Path(__file__).parent.stem
11
10
 
12
- VERSION = "2024.739125.3"
11
+ VERSION = "2024.739127.1"
13
12
 
14
13
  __version__ = VERSION
15
14
 
@@ -25,21 +24,21 @@ if not DATA_DIR.is_dir():
25
24
  np.set_printoptions(precision=18)
26
25
 
27
26
 
28
- ArrayINT = NDArray[np.intp]
29
- ArrayFloat = NDArray[np.half | np.single | np.double]
27
+ type ArrayINT = NDArray[np.intp]
28
+ type ArrayFloat = NDArray[np.half | np.single | np.double]
30
29
 
31
30
 
32
- ArrayBoolean: TypeAlias = NDArray[np.bool_]
31
+ type ArrayBoolean = NDArray[np.bool_]
33
32
 
34
- ArrayDouble: TypeAlias = NDArray[np.double]
35
- ArrayBIGINT: TypeAlias = NDArray[np.int64]
33
+ type ArrayDouble = NDArray[np.double]
34
+ type ArrayBIGINT = NDArray[np.int64]
36
35
 
37
36
  DEFAULT_REC_RATE = 0.85
38
37
 
39
38
 
40
39
  @enum.unique
41
40
  class RECForm(enum.StrEnum):
42
- """Recapture rate - derivation methods."""
41
+ """For derivation of recapture rate from market shares."""
43
42
 
44
43
  INOUT = "inside-out"
45
44
  OUTIN = "outside-in"
@@ -49,7 +48,7 @@ class RECForm(enum.StrEnum):
49
48
  @enum.unique
50
49
  class UPPAggrSelector(enum.StrEnum):
51
50
  """
52
- Aggregator selection for GUPPI and diversion ratio
51
+ Aggregator for GUPPI and diversion ratio estimates.
53
52
 
54
53
  """
55
54
 
@@ -14,7 +14,7 @@ from importlib import resources
14
14
  from operator import itemgetter
15
15
  from pathlib import Path
16
16
  from types import MappingProxyType
17
- from typing import Any, NamedTuple, TypeAlias
17
+ from typing import Any, NamedTuple
18
18
 
19
19
  import msgpack # type: ignore
20
20
  import msgpack_numpy as m # type: ignore
@@ -95,7 +95,7 @@ class INVTableData(NamedTuple):
95
95
  data_array: ArrayBIGINT
96
96
 
97
97
 
98
- INVData: TypeAlias = Mapping[str, Mapping[str, Mapping[str, INVTableData]]]
98
+ type INVData = Mapping[str, Mapping[str, Mapping[str, INVTableData]]]
99
99
 
100
100
 
101
101
  def construct_data(
@@ -7,7 +7,7 @@ with a canvas on which to draw boundaries for Guidelines standards.
7
7
  from __future__ import annotations
8
8
 
9
9
  from dataclasses import dataclass
10
- from typing import Literal, TypeAlias
10
+ from typing import Literal
11
11
 
12
12
  import numpy as np
13
13
  from attrs import Attribute, field, frozen, validators
@@ -28,7 +28,7 @@ __version__ = VERSION
28
28
  mp.prec = 80
29
29
  mp.trap_complex = True
30
30
 
31
- HMGPubYear: TypeAlias = Literal[1992, 2004, 2010, 2023]
31
+ type HMGPubYear = Literal[1992, 2004, 2010, 2023]
32
32
 
33
33
 
34
34
  @dataclass(frozen=True)
@@ -48,10 +48,9 @@ with warnings.catch_warnings():
48
48
  mgn_kde = stats.gaussian_kde(mgn_data_obs, weights=mgn_data_wts, bw_method="silverman")
49
49
  mgn_kde.set_bandwidth(bw_method=mgn_kde.factor / 3.0)
50
50
 
51
- mgn_xvec = np.linspace(0, BIN_COUNT, 10**5) / BIN_COUNT
52
51
  mgn_ax.plot(
53
- mgn_xvec,
54
- mgn_kde(mgn_xvec),
52
+ (_xv := np.linspace(0, BIN_COUNT, 10**5) / BIN_COUNT),
53
+ mgn_kde(_xv),
55
54
  color="#004488",
56
55
  rasterized=True,
57
56
  label="Estimated Density",
@@ -34,7 +34,7 @@ from .data_generation_functions import (
34
34
  gen_share_data,
35
35
  parse_seed_seq_list,
36
36
  )
37
- from .upp_tests import SaveData, enf_cnts, save_data_to_hdf5
37
+ from .upp_tests import SaveData, compute_upp_test_counts, save_data_to_hdf5
38
38
 
39
39
  __version__ = VERSION
40
40
 
@@ -113,15 +113,13 @@ class MarketSample:
113
113
 
114
114
  enf_counts: UPPTestsCounts = field(default=None)
115
115
 
116
- def gen_market_sample(
116
+ def _gen_market_sample(
117
117
  self,
118
118
  /,
119
119
  *,
120
- sample_size: int = 10**6,
121
- seed_seq_list: Sequence[SeedSequence] | None = None,
122
- nthreads: int = 16,
123
- save_data_to_file: SaveData = False,
124
- saved_array_name_suffix: str = "",
120
+ sample_size: int,
121
+ seed_seq_list: Sequence[SeedSequence] | None,
122
+ nthreads: int,
125
123
  ) -> MarketDataSample:
126
124
  """
127
125
  Generate share, diversion ratio, price, and margin data for MarketSpec.
@@ -242,11 +240,11 @@ class MarketSample:
242
240
  self,
243
241
  /,
244
242
  *,
245
- sample_size: int,
246
- seed_seq_list: Sequence[SeedSequence],
247
- nthreads: int,
248
- save_data_to_file: SaveData,
249
- saved_array_name_suffix: str,
243
+ sample_size: int = 10**6,
244
+ seed_seq_list: Sequence[SeedSequence] | None = None,
245
+ nthreads: int = 16,
246
+ save_data_to_file: SaveData = False,
247
+ saved_array_name_suffix: str = "",
250
248
  ) -> None:
251
249
  """Populate :attr:`data` with generated data
252
250
 
@@ -258,7 +256,7 @@ class MarketSample:
258
256
 
259
257
  """
260
258
 
261
- self.data = self.gen_market_sample(
259
+ self.data = self._gen_market_sample(
262
260
  sample_size=sample_size, seed_seq_list=seed_seq_list, nthreads=nthreads
263
261
  )
264
262
 
@@ -275,7 +273,7 @@ class MarketSample:
275
273
  save_data_to_file=save_data_to_file,
276
274
  )
277
275
 
278
- def sim_enf_cnts(
276
+ def _sim_enf_cnts(
279
277
  self,
280
278
  _upp_test_parms: gbl.HMGThresholds,
281
279
  _sim_test_regime: UPPTestRegime,
@@ -322,7 +320,7 @@ class MarketSample:
322
320
 
323
321
  """
324
322
 
325
- _market_data_sample = self.gen_market_sample(
323
+ _market_data_sample = self._gen_market_sample(
326
324
  sample_size=sample_size, seed_seq_list=seed_seq_list, nthreads=nthreads
327
325
  )
328
326
 
@@ -339,7 +337,7 @@ class MarketSample:
339
337
  save_data_to_file=save_data_to_file,
340
338
  )
341
339
 
342
- _upp_test_arrays = enf_cnts(
340
+ _upp_test_arrays = compute_upp_test_counts(
343
341
  _market_data_sample, _upp_test_parms, _sim_test_regime
344
342
  )
345
343
 
@@ -351,7 +349,7 @@ class MarketSample:
351
349
 
352
350
  return _upp_test_arrays
353
351
 
354
- def sim_enf_cnts_ll(
352
+ def _sim_enf_cnts_ll(
355
353
  self,
356
354
  _enf_parm_vec: gbl.HMGThresholds,
357
355
  _sim_test_regime: UPPTestRegime,
@@ -435,7 +433,7 @@ class MarketSample:
435
433
  })
436
434
 
437
435
  _res_list = Parallel(n_jobs=_thread_count, prefer="threads")(
438
- delayed(self.sim_enf_cnts)(
436
+ delayed(self._sim_enf_cnts)(
439
437
  _enf_parm_vec,
440
438
  _sim_test_regime,
441
439
  **_sim_enf_cnts_kwargs,
@@ -474,7 +472,7 @@ class MarketSample:
474
472
  save_data_to_file: SaveData = False,
475
473
  saved_array_name_suffix: str = "",
476
474
  ) -> None:
477
- """Populate :attr:`enf_counts` etimated test counts.
475
+ """Populate :attr:`enf_counts` with estimated UPP test counts.
478
476
 
479
477
  Parameters
480
478
  ----------
@@ -510,7 +508,7 @@ class MarketSample:
510
508
  """
511
509
 
512
510
  if self.data is None:
513
- self.enf_counts = self.sim_enf_cnts_ll(
511
+ self.enf_counts = self._sim_enf_cnts_ll(
514
512
  _enf_parm_vec,
515
513
  _upp_test_regime,
516
514
  sample_size=sample_size,
@@ -520,7 +518,9 @@ class MarketSample:
520
518
  saved_array_name_suffix=saved_array_name_suffix,
521
519
  )
522
520
  else:
523
- self.enf_counts = enf_cnts(self.data, _enf_parm_vec, _upp_test_regime)
521
+ self.enf_counts = compute_upp_test_counts(
522
+ self.data, _enf_parm_vec, _upp_test_regime
523
+ )
524
524
  if save_data_to_file:
525
525
  save_data_to_hdf5(
526
526
  self.enf_counts,