ETable
ETable(
models,
*,
signif_code=None,
coef_fmt=None,
model_stats=None,
model_stats_labels=None,
custom_stats=None,
custom_model_stats=None,
keep=None,
drop=None,
exact_match=False,
labels=None,
cat_template=None,
show_fe=None,
felabels=None,
notes='',
model_heads=None,
head_order=None,
caption=None,
tab_label=None,
digits=None,
**kwargs,
)Regression table builder on top of MTable.
ETable extracts coefficients and model statistics from supported model objects (e.g., pyfixest Feols/Fepois/Feiv, FixestMulti, and statsmodels fitted results such as OLS/GLM), assembles a publication-style table, and delegates rendering/export to MTable.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| models | FixestMulti | Feols | Fepois | Feiv | statsmodels results | list[…] | One or more fitted models. A FixestMulti is expanded into its models. Statsmodels support includes fitted results. | required |
| signif_code | list[float] | Three ascending p-value cutoffs for significance stars, default ETable.DEFAULT_SIGNIF_CODE = [0.001, 0.01, 0.05]. | None |
| coef_fmt | str | Cell layout for each coefficient. Tokens: - ‘b’ (estimate), ‘se’ (std. error), ‘t’ (t value), ‘p’ (p-value), - whitespace, ‘,’, parentheses ‘(’, ‘)’, brackets ‘[’, ’]’, and - ‘\n’ for line breaks. You may also reference keys from custom_stats to inject custom values. Format specifiers can be added after tokens (e.g., ‘b:.3f’, ‘se:.2e’, ‘N:,.0f’): - ‘.Nf’ for N decimal places (e.g., ‘.3f’ for 3 decimals) - ‘.Ne’ for scientific notation with N decimals (e.g., ‘.2e’) - ‘,.Nf’ for comma thousands separator (e.g., ‘,.0f’) - ‘:d’ for integer formatting Default ETable.DEFAULT_COEF_FMT = “b \n (se)”. | None |
| model_stats | list[str] | Bottom panel statistics to display (order is kept). Examples: ‘N’, ‘r2’, ‘adj_r2’, ‘r2_within’, ‘se_type’. If None, defaults to ETable.DEFAULT_MODEL_STATS (currently [‘N’,‘r2’]). | None |
| model_stats_labels | dict[str, str] | Mapping from stat key to display label (e.g., {‘N’: ‘Observations’}). Defaults come from ETable.DEFAULT_STAT_LABELS; user-provided entries override. | None |
| custom_stats | dict | Custom per-coefficient values to splice into coef cells via coef_fmt. Shape: {key: list_of_per_model_lists}, where for each key in coef_fmt, custom_stats[key][i] is a list aligned to model i’s coefficient index. | None |
| custom_model_stats | dict | Additional bottom rows. Shape: {‘Row label’: [val_m1, val_m2, …]}. | None |
| keep | list[str] | str | Regex patterns (or exact names with exact_match=True) to keep and order coefficients. If provided, output order follows the pattern order. | None |
| drop | list[str] | str | Regex patterns (or exact names with exact_match=True) to exclude after applying keep. | None |
| exact_match | bool | If True, treat keep/drop patterns as exact names (no regex). | False |
| labels | dict | Variable labels for relabeling dependent vars, regressors, and (if not provided in felabels) fixed effects. If None, labels are collected from each model’s source DataFrame via the extractor (e.g., PyFixest: model._data; Statsmodels: result.model.data.frame), merged across models (first seen wins), and any missing entries are filled from MTable.DEFAULT_LABELS. | None |
| cat_template | str | Template to relabel categorical terms, using placeholders ‘{variable}’ and ‘{value}’. Default ETable.DEFAULT_CAT_TEMPLATE = “{variable}={value}”. Use “{value}” to show only category names. | None |
| show_fe | bool | Whether to add a fixed-effects presence panel. Defaults to ETable.DEFAULT_SHOW_FE (True). | None |
| felabels | dict | Custom labels for the fixed-effects rows; falls back to labels when not provided. | None |
| notes | str | Table notes. If ““, a default note with significance levels and the coef cell format is generated. | '' |
| model_heads | list[str] | Optional model headers (e.g., country names). | None |
| head_order | (dh, hd, d, h, '') | Header level order: d=dep var, h=model header. “” shows only model numbers. Default ETable.DEFAULT_HEAD_ORDER = “dh”. | "dh","hd","d","h","" |
| caption | str | Table caption (passed to MTable). | None |
| tab_label | str | Label/anchor for LaTeX/HTML (passed to MTable). | None |
| digits | int | Number of decimal places for coefficient display. This parameter is only applied when coef_fmt does not already contain format specifiers. If coef_fmt contains format specifiers (e.g., ‘b:.3f’), this parameter is ignored. For precise control, use format specifiers in coef_fmt directly. | None |
| **kwargs | Forwarded to MTable (e.g., rgroup_display, rendering options). | {} |
Notes
- To display the SE type, include “se_type” in model_stats.
- Categorical term relabeling applies to plain categorical columns and to formula encodings that expose variable/value names.
- When labels is None, labels are sourced from each model’s DataFrame (if available) and supplemented by MTable.DEFAULT_LABELS. Use set_var_labels() or import_dta() to populate df.attrs[‘variable_labels’].
- Supported model types are automatically detected via their extractor.
Returns
| Name | Type | Description |
|---|---|---|
| ETable | An object holding the assembled table data (as a DataFrame in MTable) and rendering helpers (via MTable.make/save). |