Regression table, stargazer style
Three nested OLS models side by side, with standard errors under the coefficients and fit statistics at the foot, typeset like a journal table.

The table every empirical paper has: one column per model, the coefficient on
one line and its standard error in parentheses beneath it, stars for
significance, and the number of observations, R², adjusted R², the residual
standard error and the F statistic at the foot. This is what R's stargazer()
prints; here it is built with Great Tables (great_tables.GT) and dressed
the way journals such as Econometrica set their tables: a serif font, a
numbered title in small capitals, horizontal rules only (top, under the column
labels, above the statistics, bottom) and no vertical lines.
The setting is Stojkov, Veljanovski & Warin (2024, Post-Communist Economies):
growth in emerging Europe, institutions and policy factors. The data are
simulated for illustration — they are not the paper's data or results:
n = 220 country-years (11 economies × 20 years). Model (1) has the
institutional variables only, (2) adds investment and trade openness, (3) adds
inflation and government consumption. Predictors are standardised, so each
coefficient is the change in growth (percentage points) for a
one-standard-deviation change. The models are fitted with smf.ols(); the
table is assembled from params, bse, pvalues, rsquared, fvalue and
friends, and table.show() opens it in the browser.
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from great_tables import GT, loc, style
# Simulated data, set in the context of Stojkov, Veljanovski & Warin (2024) [stojkov2024growth]
# Data: 11 emerging-European economies × 20 years, six institutional and policy factors
rng = np.random.default_rng(2024)
n = 220
labels = {"rule_law": "Rule of law", "reg_quality": "Regulatory quality",
"investment": "Investment (% of GDP)", "openness": "Trade openness",
"inflation": "Inflation", "gov_size": "Government consumption",
"Intercept": "Constant"}
predictors = list(labels)[:-1]
df = pd.DataFrame(rng.normal(size=(n, 6)), columns=predictors)
df["growth"] = (3 + 0.9 * df.rule_law + 0.45 * df.reg_quality + 0.8 * df.investment
+ 0.15 * df.openness - 0.7 * df.inflation - 0.05 * df.gov_size
+ rng.normal(0, 2.5, n))
df[predictors] = (df[predictors] - df[predictors].mean()) / df[predictors].std()
# Three nested models, each adding a block of predictors
blocks = [["rule_law", "reg_quality"], ["investment", "openness"], ["inflation", "gov_size"]]
models = [smf.ols("growth ~ " + " + ".join(sum(blocks[:k + 1], [])), data=df).fit()
for k in range(len(blocks))]
cols = [f"({k + 1})" for k in range(len(models))]
def stars(p):
return "***" if p < .01 else "**" if p < .05 else "*" if p < .1 else ""
def num(x, d=3): # typographic minus sign, as in print
return f"{x:.{d}f}".replace("-", "−")
# Body: a coefficient row and a standard-error row per term, as in stargazer
rows = []
for term, name in labels.items():
coef = {c: (num(m.params[term]) + stars(m.pvalues[term]) if term in m.params else "")
for c, m in zip(cols, models)}
se = {c: (f"({num(m.bse[term])})" if term in m.params else "") for c, m in zip(cols, models)}
rows += [{"term": name, **coef}, {"term": "", **se}]
n_body = len(rows)
coef_rows, se_rows = list(range(0, n_body, 2)), list(range(1, n_body, 2))
# Foot: fit statistics, one row each
rows += [
{"term": "Observations", **{c: f"{int(m.nobs)}" for c, m in zip(cols, models)}},
{"term": "R²", **{c: f"{m.rsquared:.3f}" for c, m in zip(cols, models)}},
{"term": "Adjusted R²", **{c: f"{m.rsquared_adj:.3f}" for c, m in zip(cols, models)}},
{"term": "Residual std. error", **{c: f"{np.sqrt(m.scale):.3f} (df = {m.df_resid:.0f})"
for c, m in zip(cols, models)}},
{"term": "F statistic", **{c: f"{m.fvalue:.2f}{stars(m.f_pvalue)} (df = {m.df_model:.0f}; {m.df_resid:.0f})"
for c, m in zip(cols, models)}},
]
tab = pd.DataFrame(rows)
table = (
GT(tab, rowname_col="term")
.tab_header(title="TABLE I",
subtitle="Institutions, policy and growth in emerging Europe")
.tab_spanner(label="Dependent variable: GDP-per-capita growth (%)", columns=cols, id="dep")
.cols_align("center", columns=cols)
.cols_width({"term": "190px", **{c: "185px" for c in cols}})
.tab_source_note("Notes: OLS estimates; standard errors in parentheses. Predictors are "
"standardised, so coefficients are percentage points of growth per 1 SD.")
.tab_source_note(f"n = {n} country-years (simulated). *p < 0.1; **p < 0.05; ***p < 0.01.")
# Econometrica look: serif type, small-caps title, horizontal rules only
.opt_table_font(font=["Latin Modern Roman", "Times New Roman", "Georgia", "serif"])
.tab_options(
table_width="745px", table_font_size="15px", table_font_color="#000",
heading_title_font_size="15px", heading_subtitle_font_size="15px", heading_padding="1px",
table_border_top_style="hidden", table_border_bottom_style="hidden",
heading_border_bottom_style="none",
column_labels_border_top_style="solid", column_labels_border_top_width="1.5px", # top rule
column_labels_border_top_color="#000",
column_labels_border_bottom_style="solid", column_labels_border_bottom_width="1px",
column_labels_border_bottom_color="#000",
table_body_hlines_style="hidden", stub_border_style="hidden",
table_body_border_bottom_style="solid", table_body_border_bottom_width="1.5px",
table_body_border_bottom_color="#000",
data_row_padding="4px", source_notes_font_size="13px", source_notes_padding="1px",
)
.tab_style(style.css("font-variant: small-caps; padding-bottom: 8px;"), loc.subtitle())
.tab_style(style.text(style="italic"), loc.spanner_labels(ids=["dep"]))
# standard error tucked under its coefficient
.tab_style(style.css("padding-bottom: 0;"), [loc.body(rows=coef_rows), loc.stub(rows=coef_rows)])
.tab_style(style.css("padding-top: 0;"), [loc.body(rows=se_rows), loc.stub(rows=se_rows)])
# thin rule between the coefficients and the fit statistics
.tab_style(style.borders(sides="top", style="solid", weight="1px", color="#000"),
[loc.body(rows=[n_body]), loc.stub(rows=[n_body])])
)
table.show()
Figures use the optional PyStatlas style: add plt.style.use("pystatlas.mplstyle") to match the look exactly.
Data source
- Simulated data. Simulated data with a fixed random seed, created for this example.
No real respondents, documents or measurements: the numbers only illustrate how the chart and its statistics work. - Stojkov, Veljanovski & Warin (2024), European integration and growth in emerging Europe. Stojkov, A., Veljanovski, M., & Warin, T. (2024). European integration and economic growth in emerging Europe: The role of institutions and policy factors. Post-Communist Economies, 36(7), 778–800. https://doi.org/10.1080/14631377.2024.2376974
The example is set in the context of this paper; unless its description says otherwise, the numbers are simulated and are not the paper's data or results.
The examples illustrate statistical methods. Their numbers are simulated unless an entry says otherwise, and their titles describe what each figure shows in these simulated data — not findings of the cited papers, nor the author's position on the substantive question. For results, context and data, rely on the papers cited here.
How to cite
PyStatlas is created and maintained by Thierry Warin. If it helped your work, please cite it.
Warin, T. (2026). Regression table, stargazer style. In PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences (Version 1.1.0) [Computer software]. https://warin.ca/pystatlas/academic-tables/regression-table/
@misc{warin2026statlas,
author = {Warin, Thierry},
title = {PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences},
year = {2026},
version = {1.1.0},
howpublished = {\url{https://warin.ca/pystatlas/}},
note = {Source code: https://github.com/warint/pystatlas}
}More in Academic tables
Summary statistics table
The "Table 1" of an empirical paper — N, mean, SD, min, median and max per variable in panels, with group means and a test of their difference.
modelsummary::datasummary_balance()Machine learning model comparison table
Five classifiers compared on repeated cross-validation — discrimination, classification and calibration metrics as mean (SD), best in bold, with corrected tests of the AUC gap.
tidymodels::workflow_map() + collect_metrics()Panel data regression table
Pooled OLS, random effects, country fixed effects and two-way fixed effects side by side, with clustered standard errors, fixed-effect indicators and a Hausman test.
fixest::etable()