mergeron 2024.738930.0__py3-none-any.whl → 2024.738936.2__py3-none-any.whl
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/core/__init__.py +1 -1
- mergeron/core/guidelines_standards.py +247 -57
- mergeron/core/proportions_tests.py +19 -19
- mergeron/core/pseudorandom_numbers.py +30 -29
- mergeron/examples/__init__.py +1 -1
- mergeron/examples/concentration_as_diversion.py +75 -88
- mergeron/examples/investigations_stats_obs_tables.py +119 -111
- mergeron/examples/investigations_stats_sim_tables.py +108 -87
- mergeron/examples/plotSafeHarbs_symbolically.py +2 -2
- mergeron/examples/safeharbor_boundaries_for_mergers_with_asymmetric_shares.py +35 -28
- mergeron/examples/safeharbor_boundaries_for_symmetric_firm_mergers.py +6 -13
- mergeron/examples/sound_guppi_safeharbor.py +23 -18
- mergeron/examples/testIntrinsicClearanceRates.py +5 -5
- mergeron/examples/visualize_empirical_margin_distribution.py +1 -1
- mergeron/examples/{visualize_guidelines_tests_scatterplots.py → visualize_guidelines_tests.py} +42 -48
- mergeron/ext/__init__.py +1 -1
- mergeron/gen/__init__.py +1 -1
- mergeron/gen/data_generation.py +25 -24
- mergeron/gen/guidelines_tests.py +47 -47
- mergeron/gen/investigations_stats.py +98 -46
- mergeron/jinja_LaTex_templates/clrrate_cis_summary_table_template.tex.jinja2 +2 -3
- mergeron/jinja_LaTex_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +2 -3
- mergeron/jinja_LaTex_templates/ftcinvdata_summary_table_template.tex.jinja2 +1 -2
- mergeron/jinja_LaTex_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +13 -14
- mergeron/jinja_LaTex_templates/mergeron.cls +161 -0
- mergeron/jinja_LaTex_templates/mergeron_table_collection_template.tex.jinja2 +90 -0
- {mergeron-2024.738930.0.dist-info → mergeron-2024.738936.2.dist-info}/METADATA +15 -18
- mergeron-2024.738936.2.dist-info/RECORD +41 -0
- mergeron-2024.738930.0.dist-info/RECORD +0 -39
- {mergeron-2024.738930.0.dist-info → mergeron-2024.738936.2.dist-info}/WHEEL +0 -0
|
@@ -18,24 +18,18 @@ from mergeron import DATA_DIR
|
|
|
18
18
|
if not sys.warnoptions:
|
|
19
19
|
warnings.simplefilter("ignore")
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"_".join((
|
|
24
|
-
"BenchmarkingGUPPISafeharbor",
|
|
25
|
-
"DRAFT",
|
|
26
|
-
"FTCMergerInvestigationsDataTables",
|
|
27
|
-
"{}",
|
|
28
|
-
"OBS",
|
|
29
|
-
))
|
|
21
|
+
INVRES_RATIO_FORMAT_STR = "{: >3.0f}/{:<3.0f}"
|
|
22
|
+
INVDATA_DOTTEX_FORMAT_STR = "{}.tex".format(
|
|
23
|
+
"_".join(("FTCMergerInvestigationsDataTables", "{}", "OBS"))
|
|
30
24
|
)
|
|
31
25
|
|
|
32
26
|
|
|
33
|
-
def
|
|
27
|
+
def invres_stats_odds_ratio_byhhianddelta(
|
|
34
28
|
_data_array_dict: Mapping,
|
|
35
29
|
_data_periods: tuple[str, str],
|
|
36
30
|
_merger_classes: Sequence[isl.INDGRPConstants | isl.EVIDENConstants],
|
|
37
31
|
/,
|
|
38
|
-
) ->
|
|
32
|
+
) -> tuple[str, ...]:
|
|
39
33
|
"""
|
|
40
34
|
Reconstruct tables by HHI and Delta.
|
|
41
35
|
|
|
@@ -49,16 +43,17 @@ def clrenf_stats_odds_ratio_byhhianddelta(
|
|
|
49
43
|
|
|
50
44
|
print("Odds ratios by HHI and Delta:")
|
|
51
45
|
_stats_group = isl.StatsGrpSelector.HD
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
_invres_rate_table_content = isl.StatsContainer()
|
|
47
|
+
_invres_rate_table_design = isl.latex_jinja_env.get_template(
|
|
54
48
|
"ftcinvdata_byhhianddelta_table_template.tex.jinja2"
|
|
55
49
|
)
|
|
56
|
-
|
|
50
|
+
_invres_rate_table_content.obs_summary_type = f"{_stats_group}"
|
|
57
51
|
|
|
52
|
+
_output_dottex_pathlist: tuple[str, ...] = ()
|
|
58
53
|
for _merger_class in _merger_classes:
|
|
59
54
|
_table_ind_group = (
|
|
60
55
|
_merger_class
|
|
61
|
-
if _merger_class
|
|
56
|
+
if isinstance(_merger_class, isl.INDGRPConstants)
|
|
62
57
|
else isl.INDGRPConstants.ALL
|
|
63
58
|
)
|
|
64
59
|
_table_evid_cond = (
|
|
@@ -66,7 +61,7 @@ def clrenf_stats_odds_ratio_byhhianddelta(
|
|
|
66
61
|
if isinstance(_merger_class, isl.EVIDENConstants)
|
|
67
62
|
else isl.EVIDENConstants.UR
|
|
68
63
|
)
|
|
69
|
-
|
|
64
|
+
_invres_rate_table_content.obs_merger_class = f"{_merger_class}"
|
|
70
65
|
|
|
71
66
|
for _data_period in _data_periods:
|
|
72
67
|
_data_array_dict_sub = _data_array_dict[_data_period][f"{_stats_group}"]
|
|
@@ -74,11 +69,11 @@ def clrenf_stats_odds_ratio_byhhianddelta(
|
|
|
74
69
|
_data_array_dict_sub, _table_ind_group, _table_evid_cond
|
|
75
70
|
)
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
_invres_rate_table_content.table_ref = _table_no
|
|
78
73
|
|
|
79
74
|
_data_period_0, _data_period_1 = (int(f) for f in _data_period.split("-"))
|
|
80
75
|
if _data_period_0 != 1996:
|
|
81
|
-
|
|
76
|
+
_invres_rate_table_content.invdata_notestr = " ".join((
|
|
82
77
|
"NOTES:",
|
|
83
78
|
isl.LTX_ARRAY_LINEEND,
|
|
84
79
|
R"\(\cdot\) Data for period, {}".format(
|
|
@@ -90,84 +85,92 @@ def clrenf_stats_odds_ratio_byhhianddelta(
|
|
|
90
85
|
isl.LTX_ARRAY_LINEEND,
|
|
91
86
|
))
|
|
92
87
|
|
|
93
|
-
|
|
88
|
+
_invres_rate_table_content.invdata_sourcestr = " ".join((
|
|
94
89
|
"\\(\\cdot\\) Fed. Trade Comm'n ({}), at~\\cref{{fn:{}}},".format(
|
|
95
90
|
_data_period_0, f"FTCInvData1996to{_data_period_0}"
|
|
96
91
|
),
|
|
97
92
|
isl.LTX_ARRAY_LINEEND,
|
|
98
93
|
))
|
|
99
|
-
|
|
94
|
+
_invres_rate_table_content.invdata_sourcestr += " ".join((
|
|
100
95
|
"\\(\\cdot\\) Fed. Trade Comm'n ({}), at~\\cref{{fn:{}}},".format(
|
|
101
96
|
_data_period_1, f"FTCInvData1996to{_data_period_1}"
|
|
102
97
|
),
|
|
103
98
|
isl.LTX_ARRAY_LINEEND,
|
|
104
99
|
))
|
|
105
100
|
else:
|
|
106
|
-
|
|
101
|
+
_invres_rate_table_content.invdata_sourcestr = " ".join((
|
|
107
102
|
"\\(\\cdot\\) Fed. Trade Comm'n ({}), at~\\cref{{fn:{}}},".format(
|
|
108
103
|
_data_period_1, f"FTCInvData1996to{_data_period_1}"
|
|
109
104
|
),
|
|
110
105
|
isl.LTX_ARRAY_LINEEND,
|
|
111
106
|
))
|
|
112
107
|
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
_invres_rate_table_content.obs_merger_class = f"{_merger_class}"
|
|
109
|
+
_invres_rate_table_content.obs_period = _data_period.split("-")
|
|
115
110
|
|
|
116
|
-
|
|
111
|
+
_invres_cnts_array = _data_array_dict_sub[_table_no][-1]
|
|
117
112
|
_odds_ratio_data_str = ""
|
|
118
|
-
for _hhi_range_it in unique(
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
for _hhi_range_it in unique(_invres_cnts_array[:, 0]):
|
|
114
|
+
_invres_cnts_row_for_hhi_range = _invres_cnts_array[
|
|
115
|
+
_invres_cnts_array[:, 0] == _hhi_range_it
|
|
121
116
|
][:, 2:]
|
|
122
117
|
_odds_ratio_data_str += " & ".join([
|
|
123
|
-
|
|
124
|
-
for g in
|
|
118
|
+
INVRES_RATIO_FORMAT_STR.format(*g)
|
|
119
|
+
for g in _invres_cnts_row_for_hhi_range
|
|
125
120
|
])
|
|
126
121
|
_odds_ratio_data_str += " & {}".format(
|
|
127
|
-
|
|
128
|
-
*einsum("ij->j",
|
|
122
|
+
INVRES_RATIO_FORMAT_STR.format(
|
|
123
|
+
*einsum("ij->j", _invres_cnts_row_for_hhi_range)
|
|
129
124
|
)
|
|
130
125
|
)
|
|
131
126
|
_odds_ratio_data_str += isl.LTX_ARRAY_LINEEND
|
|
132
127
|
|
|
133
|
-
|
|
134
|
-
einsum(
|
|
135
|
-
|
|
128
|
+
_invres_cnts_row_for_hhi_tots = row_stack([
|
|
129
|
+
einsum(
|
|
130
|
+
"ij->j", _invres_cnts_array[_invres_cnts_array[:, 1] == f][:, 2:]
|
|
131
|
+
)
|
|
132
|
+
for f in unique(_invres_cnts_array[:, 1])
|
|
136
133
|
])
|
|
137
134
|
_odds_ratio_data_str += " & ".join([
|
|
138
|
-
|
|
135
|
+
INVRES_RATIO_FORMAT_STR.format(*f)
|
|
136
|
+
for f in _invres_cnts_row_for_hhi_tots
|
|
139
137
|
])
|
|
140
138
|
_odds_ratio_data_str += " & {}".format(
|
|
141
|
-
|
|
142
|
-
*einsum("ij->j",
|
|
139
|
+
INVRES_RATIO_FORMAT_STR.format(
|
|
140
|
+
*einsum("ij->j", _invres_cnts_row_for_hhi_tots)
|
|
143
141
|
)
|
|
144
142
|
)
|
|
145
143
|
_odds_ratio_data_str += isl.LTX_ARRAY_LINEEND
|
|
146
|
-
|
|
144
|
+
_invres_rate_table_content.invdata_byhhianddelta = _odds_ratio_data_str
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
_output_dottex_path = DATA_DIR / INVDATA_DOTTEX_FORMAT_STR.format(
|
|
147
|
+
f"{_stats_group}_{_data_period_1}_{_merger_class.replace(' ', '')}"
|
|
148
|
+
)
|
|
149
|
+
with _output_dottex_path.open(
|
|
150
|
+
"w", encoding="utf8"
|
|
151
|
+
) as _invres_rate_table_dottex:
|
|
152
|
+
_invres_rate_table_dottex.write(
|
|
153
|
+
_invres_rate_table_design.render(
|
|
154
|
+
tmpl_data=_invres_rate_table_content
|
|
155
|
+
)
|
|
156
156
|
)
|
|
157
|
-
print("\n", file=
|
|
157
|
+
print("\n", file=_invres_rate_table_dottex)
|
|
158
158
|
|
|
159
|
+
_output_dottex_pathlist += (_output_dottex_path.name,)
|
|
159
160
|
print(_odds_ratio_data_str)
|
|
160
161
|
print()
|
|
161
162
|
del _odds_ratio_data_str
|
|
162
163
|
|
|
164
|
+
return _output_dottex_pathlist
|
|
165
|
+
|
|
163
166
|
|
|
164
|
-
def
|
|
167
|
+
def invres_stats_obs_setup(
|
|
165
168
|
_data_array_dict: Mapping,
|
|
166
169
|
_data_periods: tuple[str, str],
|
|
167
170
|
_merger_classes: Sequence[isl.INDGRPConstants | isl.EVIDENConstants],
|
|
168
|
-
|
|
171
|
+
_test_regime: isl.PolicySelector = isl.PolicySelector.CLRN,
|
|
169
172
|
/,
|
|
170
|
-
) ->
|
|
173
|
+
) -> tuple[str, ...]:
|
|
171
174
|
_notes_str_base = " ".join((
|
|
172
175
|
"NOTES:",
|
|
173
176
|
isl.LTX_ARRAY_LINEEND,
|
|
@@ -179,7 +182,7 @@ def clrenf_stats_obs_setup(
|
|
|
179
182
|
))
|
|
180
183
|
_stats_group_dict = {
|
|
181
184
|
isl.StatsGrpSelector.FC: {
|
|
182
|
-
"desc": f"{
|
|
185
|
+
"desc": f"{_test_regime.capitalize()} rates by Firm Count",
|
|
183
186
|
"title_str": "By Number of Significant Competitors",
|
|
184
187
|
"hval": "Firm Count",
|
|
185
188
|
"hcol_width": 54,
|
|
@@ -192,7 +195,7 @@ def clrenf_stats_obs_setup(
|
|
|
192
195
|
)),
|
|
193
196
|
},
|
|
194
197
|
isl.StatsGrpSelector.DL: {
|
|
195
|
-
"desc": Rf"{
|
|
198
|
+
"desc": Rf"{_test_regime.capitalize()} rates by range of \(\Delta HHI\)",
|
|
196
199
|
"title_str": R"By Change in Concentration (\Deltah{})",
|
|
197
200
|
"hval": R"$\Delta HHI$",
|
|
198
201
|
"hval_plus": R"{ $[\Delta_L, \Delta_H)$ pts.}",
|
|
@@ -214,7 +217,7 @@ def clrenf_stats_obs_setup(
|
|
|
214
217
|
)),
|
|
215
218
|
},
|
|
216
219
|
isl.StatsGrpSelector.ZN: {
|
|
217
|
-
"desc": f"{
|
|
220
|
+
"desc": f"{_test_regime.capitalize()} rates by Approximate Presumption Zone",
|
|
218
221
|
"title_str": R"By Approximate \textit{2010 Guidelines} Concentration-Based Standards",
|
|
219
222
|
"hval": "Approximate Standard",
|
|
220
223
|
"hcol_width": 190,
|
|
@@ -227,42 +230,48 @@ def clrenf_stats_obs_setup(
|
|
|
227
230
|
},
|
|
228
231
|
}
|
|
229
232
|
|
|
233
|
+
_output_dottex_pathlist = ()
|
|
230
234
|
for _stats_group_key in _stats_group_dict:
|
|
231
|
-
|
|
235
|
+
_output_dottex_path = _invres_stats_obs_render(
|
|
232
236
|
_data_array_dict,
|
|
233
237
|
_data_periods,
|
|
234
238
|
_merger_classes,
|
|
235
239
|
_stats_group_key,
|
|
236
240
|
_stats_group_dict[_stats_group_key],
|
|
237
|
-
|
|
241
|
+
_test_regime,
|
|
238
242
|
)
|
|
243
|
+
_output_dottex_pathlist += (_output_dottex_path,)
|
|
239
244
|
|
|
245
|
+
return _output_dottex_pathlist
|
|
240
246
|
|
|
241
|
-
|
|
247
|
+
|
|
248
|
+
def _invres_stats_obs_render(
|
|
242
249
|
_data_array_dict: Mapping,
|
|
243
250
|
_data_periods: tuple[str, str],
|
|
244
251
|
_merger_classes: Sequence[isl.INDGRPConstants | isl.EVIDENConstants],
|
|
245
252
|
_stats_group: isl.StatsGrpSelector,
|
|
246
253
|
_stats_group_dict: Mapping,
|
|
247
|
-
|
|
254
|
+
_test_regime: isl.PolicySelector = isl.PolicySelector.CLRN,
|
|
248
255
|
/,
|
|
249
|
-
) ->
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
) -> str:
|
|
257
|
+
_invres_rate_table_content = isl.StatsContainer()
|
|
258
|
+
_invres_rate_table_design = isl.latex_jinja_env.get_template(
|
|
252
259
|
"ftcinvdata_summarypaired_table_template.tex.jinja2"
|
|
253
260
|
)
|
|
254
261
|
|
|
255
262
|
print(
|
|
256
263
|
f'{_stats_group_dict["desc"]}:', ", ".join([f'"{g}"' for g in _merger_classes])
|
|
257
264
|
)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
265
|
+
_invres_rate_table_content.test_regime = _test_regime.capitalize()
|
|
266
|
+
_invres_rate_table_content.obs_summary_type = f"{_stats_group}"
|
|
267
|
+
_invres_rate_table_content.obs_summary_type_title = _stats_group_dict.get(
|
|
268
|
+
"title_str"
|
|
269
|
+
)
|
|
270
|
+
_invres_rate_table_content.hdrcol_raw_width = f'{_stats_group_dict["hcol_width"]}pt'
|
|
262
271
|
|
|
263
272
|
_hs1 = _stats_group_dict["hval"]
|
|
264
273
|
_hs2 = _h if (_h := _stats_group_dict.get("hval_plus", "")) else _hs1
|
|
265
|
-
|
|
274
|
+
_invres_rate_table_content.invdata_hdrcoldescstr = (
|
|
266
275
|
isl.latex_hrdcoldesc_format_str.format(
|
|
267
276
|
"hdrcol_raw",
|
|
268
277
|
f'{_stats_group_dict["hcol_width"]}pt',
|
|
@@ -278,16 +287,16 @@ def _inv_stats_obs_render(
|
|
|
278
287
|
)
|
|
279
288
|
del _hs1, _hs2
|
|
280
289
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
290
|
+
_invres_rate_table_content.obs_merger_class_0 = f"{_merger_classes[0]}"
|
|
291
|
+
_invres_rate_table_content.obs_merger_class_1 = f"{_merger_classes[1]}"
|
|
292
|
+
_invres_rate_table_content.obs_periods_str = (
|
|
284
293
|
Rf"{' & '.join(_data_periods)} \\".replace("-", "--")
|
|
285
294
|
)
|
|
286
295
|
|
|
287
|
-
|
|
288
|
-
|
|
296
|
+
_invres_rate_table_content.invdata_notewidth = _stats_group_dict["notewidth"]
|
|
297
|
+
_invres_rate_table_content.invdata_notestr = _stats_group_dict["notestr"]
|
|
289
298
|
if _n2 := _stats_group_dict.get("notestr_plus", ""):
|
|
290
|
-
|
|
299
|
+
_invres_rate_table_content.invdata_notestr += _n2
|
|
291
300
|
del _n2
|
|
292
301
|
|
|
293
302
|
_invdata_sourcestr_format_str = "{} {}".format(
|
|
@@ -305,16 +314,16 @@ def _inv_stats_obs_render(
|
|
|
305
314
|
*(4, 10) if _stats_group == "ByFirmCount" else (3, 9)
|
|
306
315
|
)
|
|
307
316
|
)
|
|
308
|
-
|
|
317
|
+
_invres_rate_table_content.invdata_sourcestr = _invdata_sourcestr_format_str.format(
|
|
309
318
|
"2003", "FTCInvData1996to2003"
|
|
310
319
|
)
|
|
311
|
-
|
|
312
|
-
"2011", "FTCInvData1996to2011"
|
|
320
|
+
_invres_rate_table_content.invdata_sourcestr += (
|
|
321
|
+
_invdata_sourcestr_format_str.format("2011", "FTCInvData1996to2011")
|
|
313
322
|
)
|
|
314
323
|
|
|
315
324
|
_invdata_hdr_list: list[str] = []
|
|
316
325
|
_invdata_dat_list: list[list[str]] = []
|
|
317
|
-
|
|
326
|
+
_invres_cnt_totals: list[str] = []
|
|
318
327
|
_sort_order = (
|
|
319
328
|
isl.SortSelector.UCH
|
|
320
329
|
if _stats_group == isl.StatsGrpSelector.FC
|
|
@@ -324,7 +333,7 @@ def _inv_stats_obs_render(
|
|
|
324
333
|
for _merger_class in _merger_classes:
|
|
325
334
|
_table_ind_group = (
|
|
326
335
|
_merger_class
|
|
327
|
-
if _merger_class
|
|
336
|
+
if isinstance(_merger_class, isl.INDGRPConstants)
|
|
328
337
|
else isl.INDGRPConstants.ALL
|
|
329
338
|
)
|
|
330
339
|
_table_evid_cond = (
|
|
@@ -333,26 +342,26 @@ def _inv_stats_obs_render(
|
|
|
333
342
|
else isl.EVIDENConstants.UR
|
|
334
343
|
)
|
|
335
344
|
for _data_period in _data_periods:
|
|
336
|
-
|
|
337
|
-
isl.
|
|
345
|
+
_invres_cnt_totals += [
|
|
346
|
+
isl.invres_stats_output(
|
|
338
347
|
_data_array_dict,
|
|
339
348
|
_data_period,
|
|
340
349
|
_table_ind_group,
|
|
341
350
|
_table_evid_cond,
|
|
342
351
|
_stats_group,
|
|
343
|
-
|
|
352
|
+
_test_regime,
|
|
344
353
|
return_type_sel=isl.StatsReturnSelector.CNT,
|
|
345
354
|
print_to_screen=False,
|
|
346
355
|
)[1][-1][0]
|
|
347
356
|
]
|
|
348
357
|
|
|
349
|
-
_invdata_hdr_list_it, _invdata_dat_list_it = isl.
|
|
358
|
+
_invdata_hdr_list_it, _invdata_dat_list_it = isl.invres_stats_output(
|
|
350
359
|
_data_array_dict,
|
|
351
360
|
_data_period,
|
|
352
361
|
_table_ind_group,
|
|
353
362
|
_table_evid_cond,
|
|
354
363
|
_stats_group,
|
|
355
|
-
|
|
364
|
+
_test_regime,
|
|
356
365
|
return_type_sel=isl.StatsReturnSelector.RPT,
|
|
357
366
|
sort_order=_sort_order,
|
|
358
367
|
print_to_screen=False,
|
|
@@ -380,29 +389,30 @@ def _inv_stats_obs_render(
|
|
|
380
389
|
])
|
|
381
390
|
|
|
382
391
|
(
|
|
383
|
-
|
|
384
|
-
|
|
392
|
+
_invres_rate_table_content.mkt_counts_str_class_0,
|
|
393
|
+
_invres_rate_table_content.mkt_counts_str_class_1,
|
|
385
394
|
) = (
|
|
386
395
|
R"{} \\".format(" & ".join([f"Obs. = {f}" for f in g]))
|
|
387
396
|
for g in [
|
|
388
|
-
|
|
389
|
-
|
|
397
|
+
_invres_cnt_totals[: len(_data_periods)],
|
|
398
|
+
_invres_cnt_totals[len(_data_periods) :],
|
|
390
399
|
]
|
|
391
400
|
)
|
|
392
401
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
402
|
+
_invres_rate_table_content.invdata_numrows = len(_invdata_hdr_list)
|
|
403
|
+
_invres_rate_table_content.invdata_hdrstr = _invdata_hdrstr
|
|
404
|
+
_invres_rate_table_content.invdata_datstr = _invdata_datstr
|
|
396
405
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
_inv_rate_table_design.render(tmpl_data=_inv_rate_table_content)
|
|
406
|
+
_output_dottex_path = DATA_DIR / INVDATA_DOTTEX_FORMAT_STR.format(_stats_group)
|
|
407
|
+
with _output_dottex_path.open("w", encoding="UTF-8") as _output_dottex_file:
|
|
408
|
+
_output_dottex_file.write(
|
|
409
|
+
_invres_rate_table_design.render(tmpl_data=_invres_rate_table_content)
|
|
402
410
|
)
|
|
403
|
-
print("\n", file=
|
|
411
|
+
print("\n", file=_output_dottex_file)
|
|
404
412
|
del _invdata_hdrstr, _invdata_datstr
|
|
405
413
|
|
|
414
|
+
return _output_dottex_path.name
|
|
415
|
+
|
|
406
416
|
|
|
407
417
|
def get_table_nos(
|
|
408
418
|
_data_array_dict: Mapping,
|
|
@@ -416,7 +426,7 @@ def get_table_nos(
|
|
|
416
426
|
)
|
|
417
427
|
|
|
418
428
|
_table_ind_groups = tuple(
|
|
419
|
-
(_m if _m
|
|
429
|
+
(_m if isinstance(_m, isl.INDGRPConstants) else isl.INDGRPConstants.ALL)
|
|
420
430
|
for _m in _merger_classes
|
|
421
431
|
)
|
|
422
432
|
_table_evid_conds = tuple(
|
|
@@ -449,22 +459,20 @@ if __name__ == "__main__":
|
|
|
449
459
|
isl.EVIDENConstants.ED,
|
|
450
460
|
) # clstl.INDGRPConstants.IID)
|
|
451
461
|
data_periods = ("1996-2003", "2004-2011")
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
# Write the TiKZ setup file to destination first, for rendering the
|
|
455
|
-
# .tex files of tables as PDF:
|
|
456
|
-
with (
|
|
457
|
-
DATA_DIR
|
|
458
|
-
/ "{}_{}_{}.tex".format(
|
|
459
|
-
*format_str_invdata_dottex_name.split("_")[:2], "TikZTableSettings"
|
|
460
|
-
)
|
|
461
|
-
).open("w", encoding="utf8") as _table_settings_dottex:
|
|
462
|
-
_table_settings_dottex.write(
|
|
463
|
-
isl.latex_jinja_env.get_template("setup_tikz_tables.tex.jinja2").render()
|
|
464
|
-
)
|
|
465
|
-
print("\n", file=_table_settings_dottex)
|
|
462
|
+
test_regime = isl.PolicySelector.ENFT
|
|
463
|
+
|
|
466
464
|
# Now generate the various tables summarizing merger investigations data
|
|
467
|
-
|
|
465
|
+
invres_stats_byhhianddelta_pathlist = invres_stats_odds_ratio_byhhianddelta(
|
|
468
466
|
invdata_array_dict, data_periods, merger_classes
|
|
469
467
|
)
|
|
470
|
-
|
|
468
|
+
print(invres_stats_byhhianddelta_pathlist)
|
|
469
|
+
invres_stats_allothers_pathlist = invres_stats_obs_setup(
|
|
470
|
+
invdata_array_dict, data_periods, merger_classes, test_regime
|
|
471
|
+
)
|
|
472
|
+
isl.render_table_pdf(
|
|
473
|
+
invres_stats_byhhianddelta_pathlist,
|
|
474
|
+
INVDATA_DOTTEX_FORMAT_STR.format("ByHHIandDelta"),
|
|
475
|
+
)
|
|
476
|
+
isl.render_table_pdf(
|
|
477
|
+
invres_stats_allothers_pathlist, INVDATA_DOTTEX_FORMAT_STR.format("AllOthers")
|
|
478
|
+
)
|