report.etable

report.etable(
    models,
    type='gt',
    signif_code=None,
    coef_fmt='b \n (se)',
    custom_stats=None,
    keep=None,
    drop=None,
    exact_match=False,
    labels=None,
    show_fe=True,
    show_se_type=True,
    felabels=None,
    notes='',
    model_heads=None,
    head_order='dh',
    custom_model_stats=None,
    filename=None,
    print_tex=False,
    **kwargs,
)

Create an esttab-like table from a list of models.

Parameters

Name Type Description Default
models A supported model object (Feols, Fepois, Feiv, FixestMulti) or a list of Feols, Fepois & Feiv models. required
type str Type of output. Either “df” for pandas DataFrame, “md” for markdown, “gt” for great_tables, or “tex” for LaTeX table. Default is “gt”. 'gt'
signif_code list Significance levels for the stars. Default is None, which sets [0.001, 0.01, 0.05]. If None, no stars are printed. None
coef_fmt str The format of the coefficient (b), standard error (se), t-stats (t), and p-value (p). Default is "b \n (se)". Spaces , parentheses (), brackets [], newlines \n are supported. 'b \n (se)'
custom_stats Optional[dict] A dictionary of custom statistics. “b”, “se”, “t”, or “p” are reserved. None
keep Optional[Union[list, str]] The pattern for retaining coefficient names. You can pass a string (one pattern) or a list (multiple patterns). Default is keeping all coefficients. You should use regular expressions to select coefficients. “age”, # would keep all coefficients containing age r”^tr”, # would keep all coefficients starting with tr r”\d$“, # would keep all coefficients ending with number Output will be in the order of the patterns. None
drop Optional[Union[list, str]] The pattern for excluding coefficient names. You can pass a string (one pattern) or a list (multiple patterns). Syntax is the same as for keep. Default is keeping all coefficients. Parameter keep and drop can be used simultaneously. None
exact_match Optional[bool] Whether to use exact match for keep and drop. Default is False. If True, the pattern will be matched exactly to the coefficient name instead of using regular expressions. False
labels Optional[dict] A dictionary to relabel the variables. The keys are the original variable names and the values the new names. Note that interaction terms will also be relabeled using the labels of the individual variables. The command is applied after the keep and drop commands. None
show_fe Optional[bool] Whether to show the rows with fixed effects markers. Default is True. True
show_se_type Optional[bool] Whether to show the rows with standard error type. Default is True. True
felabels Optional[dict] A dictionary to relabel the fixed effects. Only needed if you want to relabel the FE lines with a different label than the one specied for the respective variable in the labels dictionary. The command is applied after the keep and drop commands. None
digits The number of digits to round to. required
thousands_sep The thousands separator. Default is False. required
scientific_notation Whether to use scientific notation. Default is True. required
scientific_notation_threshold The threshold for using scientific notation. Default is 10_000. required
notes str Custom table notes. Default shows the significance levels and the format of the coefficient cell. ''
model_heads Optional[list] Add custom headlines to models when output as df or latex. Length of list must correspond to number of models. Default is None. None
head_order Optional[str] String to determine the display of the table header when output as df or latex. Allowed values are “dh”, “hd”, “d”, “h”, or ““. When head_order is”dh”, the dependent variable is displayed first, followed by the custom model_heads (provided the user has specified them). With “hd” it is the other way around. When head_order is “d”, only the dependent variable and model numbers are displayed and with “” only the model numbers. Default is “dh”. 'dh'
filename Optional[str] The filename to save the LaTeX table to. If None, the LaTeX code is returned as a string. Default is None. None
print_tex Optional[bool] Whether to print the LaTeX code to the console. Default is False. False

Returns

Name Type Description
pandas.DataFrame A styled DataFrame with the coefficients and standard errors of the models. When output is “tex”, the LaTeX code is returned as a string.

Examples

For more examples, take a look at the regression tables and summary statistics vignette.

import pyfixest as pf

# load data
df = pf.get_data()
fit1 = pf.feols("Y~X1 + X2 | f1", df)
fit2 = pf.feols("Y~X1 + X2 | f1 + f2", df)

pf.etable([fit1, fit2])
Y
(1) (2)
coef
X1 -0.950***
(0.067)
-0.924***
(0.061)
X2 -0.174***
(0.018)
-0.174***
(0.015)
fe
f1 x x
f2 - x
stats
Observations 997 997
S.E. type by: f1 by: f1
R2 0.489 0.659
Significance levels: * p < 0.05, ** p < 0.01, *** p < 0.001. Format of coefficient cell: Coefficient (Std. Error)