mergeron.gen.data_generation_functions¶
Non-public functions called in data_generation.py.
Module Contents¶
Generate share data.
Class specifying parameters for generating market share data
Seed sequence for assuring independent and, optionally, redundant streams
Seed sequence for assuring independent and, optionally, redundant streams
Must be specified for generating repeatable random streams
Arrays representing shares, diversion ratios, etc. structured as a :MarketSharesData:
Generate merging-firm shares from Uniform distribution on the 3-D simplex.
size of sample to be drawn
seed for rng, so results can be made replicable
number of threads for random number generation
market shares and other market statistics for each draw (market)
Dirichlet-distributed shares with fixed firm-count.
Shape parameters for Dirichlet distribution
sample size to be drawn
r_1 = r_2 if RECForm.FIXED, otherwise MNL-consistent. If RECForm.OUTIN; the number of columns in the output share array is len(_dir_alphas) - 1.
seed market share rng, for replicable results
number of threads for parallelized random number generation
array of market shares and other market statistics
- mergeron.gen.data_generation_functions.diversion_ratios_builder(_recapture_form, _recapture_rate, _frmshr_array, _aggregate_purchase_prob, /)[source]¶
Given merging-firm shares and related parameters, return diversion ratios.
If recapture is specified as
mergeron.RECForm.OUTIN, then the choice-probability for the outside good must be supplied.- Parameters:¶
- _recapture_form : mergeron.RECForm¶
Enum specifying Fixed (proportional), Inside-out, or Outside-in
- _recapture_rate : float | None¶
If recapture is proportional or inside-out, the recapture rate for the firm with the smaller share.
- _frmshr_array : mergeron.ArrayDouble¶
Merging-firm shares.
- _aggregate_purchase_prob : mergeron.ArrayDouble¶
1 minus probability that the outside good is chosen; converts market shares to choice probabilities by multiplication.
- Raises:¶
ValueError – If the firm with the smaller share does not have the larger diversion ratio between the merging firms.
- Returns:¶
Merging-firm diversion ratios for mergers in the sample.
- Return type:¶
mergeron.ArrayDouble
- mergeron.gen.data_generation_functions.prices_sampler(_frmshr_array, _nth_firm_share, _aggregate_purchase_prob, _pcm_spec, _price_spec, _hsr_filing_test_type, _pcm_rng_seed_seq, _pr_rng_seed_seq, _nthreads, /)[source]¶
Generate margin and price data for mergers in the sample.
- Parameters:¶
- _frmshr_array : mergeron.ArrayDouble¶
Merging-firm shares; see
mergeron.gen.MarketShareSpec.Share of the nth firm in the sample.
- _aggregate_purchase_prob : mergeron.ArrayDouble¶
1 minus probability that the outside good is chosen; converts market shares to choice probabilities by multiplication.
- _pcm_spec : mergeron.gen.PCMSpec¶
Enum specifying whether to use asymmetric or flat margins. see
mergeron.gen.PCMSpec.- _price_spec : mergeron.gen.PriceSpec¶
Enum specifying whether to use symmetric, positive, or negative margins; see
mergeron.gen.PriceSpec.- _hsr_filing_test_type : mergeron.gen.SSZConstant¶
Enum specifying restriction, if any, to impose on market data sample to model HSR filing requirements; see
mergeron.gen.SSZConstant.- _pcm_rng_seed_seq : numpy.random.SeedSequence¶
Seed sequence for generating margin data.
- _pr_rng_seed_seq : numpy.random.SeedSequence | None¶
Seed sequence for generating price data.
- _nthreads : int¶
Number of threads to use in generating price data.
- Returns:¶
Simulated margin- and price-data arrays for mergers in the sample.
- Return type:¶
- mergeron.gen.data_generation_functions.beta_located_bound(_dist_parms, /)[source]¶
Return shape parameters for a non-standard beta, given mean, stddev, and range.
Recover the r.v.s as \(\min + (\max - \min) \cdot \symup{Β}(a, b)\), with a and b calculated from the specified mean (\(\mu\)) and variance (\(\sigma\)). [1]
- Parameters:¶
- _dist_parms : mergeron.ArrayDouble¶
vector of \(\mu\), \(\sigma\), \(\mathtt{\min}\), and \(\mathtt{\max}\) values
- Returns:¶
shape parameters for Beta distribution
- Return type:¶
mergeron.ArrayDouble
Notes
For example,
beta_located_bound(np.array([0.5, 0.2887, 0.0, 1.0])).References