| name | edhec-summary-stats |
| description | Produce a publication-ready summary-statistics table from a CSV or in-memory dataframe. Triggers when the user asks for "summary stats", "describe data", or uploads a *.csv with numeric columns and asks for a table. |
| args | {"input":"path to CSV or name of in-memory dataframe","output":"optional path for the LaTeX table (default tables/sumstats.tex)","cluster":"optional clustering for SE (e.g. \"permno,ym\")"} |
Summary statistics
A four-phase skill. Each phase ends with a checkpoint the user can interrupt.
Phase 1 -- discover
Read the input. Identify numeric columns. For each column report:
- N non-missing
- % missing
- whether it looks like a return, ratio, dummy, or count (heuristics on range)
Stop and surface anything with > 5% missing or with values outside plausible bounds (returns > 1 in absolute value, ratios outside [-100, 100], etc).
Phase 2 -- propose
Print the column list you intend to include and the statistics you intend to report:
- Default stats: N, mean, sd, p25, p50, p75, min, max
- If
cluster arg is set and the data is panel-shaped, add clustered SE on the mean
If the proposed table would have > 20 rows, stop and ask for confirmation.
Phase 3 -- compute
Compute the table. Use:
pandas.DataFrame.describe() for the basic moments
statsmodels for clustered SEs if requested
- Round to 4 decimals for returns, 2 for ratios, 0 for counts
Phase 4 -- write
Emit a LaTeX table:
booktabs rules
- Column headings via
\multicolumn{1}{c}{...}
- Caption template: "Summary statistics. {N} observations from {start} to {end}."
- Write to the
output path (default tables/sumstats.tex)
- Print the path; do not commit unless asked