mergeron

Variables, types, objects and functions used throughout the package.

Submodules

Package Contents

mergeron.VERSION = '2025.739439.25'[source]
mergeron.WORK_DIR[source]

If defined, the global variable WORK_DIR is used as a data store.

If the user does not define WORK_DIR, a subdirectory in the user’s home directory, named for this package, is created/reused.

mergeron.DEFAULT_REC = 0.85[source]
mergeron.EMPTY_ARRAYDOUBLE[source]
mergeron.EMPTY_ARRAYINT[source]
mergeron.NTHREADS[source]
mergeron.PKG_ATTRS_MAP : dict[str, type][source]
type mergeron.PubYear = 1992 | 2010 | 2023[source]
type mergeron.ArrayBoolean = NDArray[np.bool_][source]
type mergeron.ArrayFloat = NDArray[np.floating][source]
type mergeron.ArrayINT = NDArray[np.integer][source]
type mergeron.ArrayDouble = NDArray[np.float64][source]
type mergeron.ArrayBIGINT = NDArray[np.int64][source]
mergeron.allclose(_a, _b, /, *, rtol=1e-14, atol=1e-15, equal_nan=True)[source]

Redefine native numpy function with updated default tolerances.

mergeron.assert_allclose(_a, _b, /, *, rtol=1e-14, atol=1e-15, equal_nan=True, err_msg='', verbose=False, strict=True)[source]

Redefine native numpy function with updated default tolerances, type-enforcing.

mergeron.this_yaml[source]
mergeron.yaml_rt_mapper(_c, _n)[source]

Construct mapping from a mapping node with the RoundTripConstructor.

mergeron.yamelize_attrs(_typ, /, *, attr_map=PKG_ATTRS_MAP)[source]

Add yaml representer, constructor for attrs-defined class.

Attributes with property, init=False are not serialized/deserialized to YAML by the functions defined here. These attributes can, of course, be dumped to stand-alone (YAML) representation, and deserialized from there.

class mergeron.Enameled(*args, **kwds)[source]

Bases: enum.Enum

Add YAML representer, constructor for enum.Enum.

classmethod to_yaml(_r, _d)[source]

Serialize enumerations by .name, not .value.

classmethod from_yaml(_c, _n)[source]

Deserialize enumeration.

class mergeron.RECForm[source]

Bases: str, Enameled

For derivation of recapture rate from market shares.

With \(\mathscr{N}\) a set of firms, each supplying a single differentiated product, and \(\mathscr{M} \subset \mathscr{N}\) a putative relevant product market, with \(d_{ij}\) denoting diversion ratio from good \(i\) to good \(j\), \(s_i\) denoting market shares, and \(\overline{r}\) the default market recapture rate, market recapture rates for the respective products may be specified as having one of the following forms:

FIXED = 'fixed'[source]

Given, \(\overline{r}\),

\[REC_i = \overline{r} {\ } \forall {\ } i \in \mathscr{M}\]
INOUT = 'inside-out'[source]

Given, \(\overline{r}, s_i {\ } \forall {\ } i \in \mathscr{M}\), with \(s_{min} = \min(s_1, s_2)\),

\[REC_i = \frac{\overline{r} (1 - s_i)}{1 - (1 - \overline{r}) s_{min} - \overline{r} s_i} {\ } \forall {\ } i \in \mathscr{M}\]
OUTIN = 'outside-in'[source]

Given, \(d_{ij} {\ } \forall {\ } i, j \in \mathscr{M}, i \neq j\),

\[REC_i = {\sum_{j \in \mathscr{M}}^{j \neq i} d_{ij}} {\ } \forall {\ } i \in \mathscr{M}\]
class mergeron.UPPAggrSelector[source]

Bases: str, Enameled

Aggregator for GUPPI and diversion ratio estimates.

AVG = 'average'[source]
CPA = 'cross-product-share weighted average'[source]
CPD = 'cross-product-share weighted distance'[source]
CPG = 'cross-product-share weighted geometric mean'[source]
DIS = 'symmetrically-weighted distance'[source]
GMN = 'geometric mean'[source]
MAX = 'max'[source]
MIN = 'min'[source]
OSA = 'own-share weighted average'[source]
OSD = 'own-share weighted distance'[source]
OSG = 'own-share weighted geometric mean'[source]