Skip to content
Back to search

econometric-diagnostics

Diagnose and stress-test an estimated econometric model (panel, time series or cross section) in Python. Replicates the user's baseline, runs the specification and diagnostic tests that fit the data structure, decides the appropriate inference, runs a one-change-at-a-time robustness battery, and writes LaTeX tables plus an interpreted report with a methodology paragraph. Use when the user asks to validate, diagnose, check the robustness of, or report the tests for a regression they have estimated (statsmodels, linearmodels, or a Stata/R model that can be re-expressed as a formula).

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/matheusrwh--econometric-diagnostics/badge.svg)](/listings/matheusrwh--econometric-diagnostics)

HTML

<a href="/listings/matheusrwh--econometric-diagnostics"><img src="/api/listings/matheusrwh--econometric-diagnostics/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

git clone https://github.com/<user>/econometric-diagnostics ~/.claude/skills/econometric-diagnostics
pip install -r ~/.claude/skills/econometric-diagnostics/requirements.txt

Then, in Claude Code, inside your research project:

> Check the robustness of the models in `models/baseline.py`.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 116 lines
  1. ---
  2. name: econometric-diagnostics
  3. description: Diagnose and stress-test an estimated econometric model (panel, time series or cross section) in Python. Replicates the user's baseline, runs the specification and diagnostic tests that fit the data structure, decides the appropriate inference, runs a one-change-at-a-time robustness battery, and writes LaTeX tables plus an interpreted report with a methodology paragraph. Use when the user asks to validate, diagnose, check the robustness of, or report the tests for a regression they have estimated (statsmodels, linearmodels, or a Stata/R model that can be re-expressed as a formula).
  4. ---
  5. # Econometric diagnostics and robustness
  6. You are acting as a careful applied econometrician reviewing a colleague's model before
  7. submission. The scripts compute; **you** decide which tests matter, what they imply and
  8. what to recommend. Never let the scripts' flags replace reading the numbers.
  9. ## Ground rules
  10. 1. **Do not modify the user's code or data.** Everything you write goes to
  11. `<project>/reports/diagnostics/<model_set>/` (or a folder the user names).
  12. 2. **Replicate before you diagnose.** The baseline must reproduce the user's own
  13. coefficients, standard errors and N. If it does not, stop and reconcile the sample
  14. (filters, exclusions, missing values, inf values) before running anything else.
  15. 3. **Decide the inference before you look at robustness.** Choose the recommended standard
  16. errors and estimator from the diagnostic tests (step 4), write that decision down, and
  17. only then run the robustness battery. Never recommend a variant because it is
  18. significant.
  19. 4. **Report everything you ran**, including variants that weaken the result.
  20. 5. **Robustness is not heterogeneity.** A coefficient that differs between sub-periods may be
  21. the finding (parameter change), not a failure. Say which is which.
  22. 6. **No causal language the design cannot support.** Diagnostics test statistical
  23. assumptions; they do not make an OLS/FE coefficient causal.
  24. ## Scripts (in `scripts/`, run with `python <script> <config.json>`)
  25. | Script | Structure | What it does | Output |
  26. |---|---|---|---|
  27. | `inspect_data.py` | all | structure, N, T, balance, gaps, missing/inf, extreme values, within-variation share | `inspection.json` |
  28. | `panel_diagnostics.py` | panel | F entity/time effects, BP-LM, Hausman, Mundlak, Wooldridge AR(1), modified Wald, Pesaran CD, Fisher-ADF unit roots, VIF, outliers; `--skip-unit-root` | `panel_diagnostics.json` |
  29. | `robustness.py` | panel | baseline + inference / estimator / sample variants + leave-one-entity-out jackknife + verdict; `--no-jackknife` | `robustness.json` |
  30. | `ols_diagnostics.py` | time series, cross section | diagnostics **and** robustness for OLS | `ols_diagnostics.json` |
  31. | `to_latex.py` | all | booktabs tables; `--lang en` or `--lang pt` | `table_diagnostics.tex`, `table_robustness.tex` |
  32. Requirements: `pandas numpy scipy statsmodels linearmodels patsy` (see `requirements.txt`).
  33. Use the project's own environment if it has them; otherwise ask before installing anything.
  34. The jackknife refits the model once per entity (about 1 s per fit for a two-way FE panel
  35. with ~3,000 obs); use `--no-jackknife` while iterating and run the full battery once.
  36. ## Workflow
  37. ### 1. Understand the model
  38. Read the user's estimation script (or ask for the specification). Extract:
  39. data file, entity and time identifiers, sample filters and exclusions, the formula for each
  40. model, fixed effects, covariance type, and the **key coefficient(s)** the paper is about.
  41. Note the reported results (table or `.txt` output) — you need them for step 2.
  42. ### 2. Write the config and replicate
  43. Create `config.json` in the output folder; the schema is in
  44. `references/config_schema.md`. Run `inspect_data.py`, then confirm that N per model matches
  45. the user's results. The `Baseline` row of `robustness.py` (or `ols_diagnostics.py`) must
  46. reproduce their coefficient and standard error to the reported precision. If it does not,
  47. fix the config — never proceed with a baseline that differs from the paper.
  48. Also read `inspection.json` for: unbalancedness, entities with gaps, regressors with low
  49. within variation (FE will be imprecise), and heavy tails (excess kurtosis, values beyond
  50. 5×IQR).
  51. ### 3. Run the diagnostics
  52. - Panel: `panel_diagnostics.py config.json`
  53. - Time series / cross section: `ols_diagnostics.py config.json` (includes robustness)
  54. ### 4. Interpret and decide
  55. Open `references/decision_tree.md` and walk through it **with the actual numbers** for every
  56. model. For each test, read `references/interpretation.md` before drawing conclusions —
  57. several tests are invalid or uninformative in specific settings (classic Hausman under
  58. clustering, Pesaran CD after time effects, clustered Wald with more restrictions than
  59. clusters, panel unit-root tests under cross-sectional dependence).
  60. Write down, before step 5:
  61. - the recommended estimator (pooled / RE / FE entity / FE two-way / FD) and why;
  62. - the recommended standard errors and why;
  63. - what the baseline in the paper gets right and what it should change.
  64. ### 5. Run the robustness battery (panel)
  65. `robustness.py config.json`. Each variant changes exactly one thing relative to the
  66. baseline (see the script docstring). Read the verdict per key coefficient:
  67. - `ROBUST` — same sign, still significant, and within ±50 % of the baseline in every
  68. robustness variant; no jackknife sign change.
  69. - `MOSTLY ROBUST` — same sign everywhere, but some variant loses significance or moves more
  70. than 50 %. Name the variants and explain them.
  71. - `FRAGILE` — a sign flip in a robustness variant or in the jackknife.
  72. - `HETEROGENEITY` lines list sub-samples where the coefficient differs by more than 30 %:
  73. discuss them as substantive findings or as a reason to model the change explicitly.
  74. Rows marked `[info]` (pooled OLS, between) answer a different question and do not count
  75. for the verdict; use them to discuss whether the relation is mainly within or between
  76. entities.
  77. ### 6. Tables
  78. `to_latex.py config.json --lang <en|pt>` — match the language of the paper. The tables need
  79. `booktabs` and `graphicx`. Point the user to `\input{...}` paths.
  80. ### 7. Report
  81. Write `report.md` in the output folder following `templates/report_template.md`, in the
  82. user's language. It must contain: verdict up front, a diagnostics table read in plain
  83. words, the decision on inference/estimator with justification, the robustness summary,
  84. the heterogeneity discussion, concrete recommendations for the paper (what to change, what
  85. to add to the appendix), a ready-to-paste methodology paragraph, and the limitations of
  86. the checks (see the end of `references/interpretation.md`).
  87. Finish by telling the user, in a few lines: the overall verdict per key coefficient, the
  88. one or two changes you recommend, and the paths of the report and tables.
  89. ## When the request is narrower
  90. - "Just run the tests": steps 1–4, plus the diagnostics table.
  91. - "Is my result robust?": steps 1, 2, 5, a short report.
  92. - Time series or cross section: `ols_diagnostics.py` covers steps 3 and 5 together.
  93. - Models the scripts do not cover (IV/2SLS, GMM, nonlinear, VAR, survival): say so, run
  94. what applies (`inspect_data.py`, residual checks via a formula approximation if
  95. meaningful), and list the specific tests the user should run instead
  96. (`references/interpretation.md`, "Not covered").
README.md · README · 63 lines
  1. # econometric-diagnostics
  2. A Claude Code skill that reviews an estimated econometric
  3. model the way a careful referee would: it replicates the baseline, runs the specification
  4. and diagnostic tests that fit the data structure, decides the appropriate estimator and
  5. standard errors, stress-tests the key coefficients with a one-change-at-a-time robustness
  6. battery, and writes LaTeX tables plus an interpreted report.
  7. The Python scripts do the computing; the skill instructions (`SKILL.md`) and the reference
  8. files tell Claude how to read the results — including when a test is invalid in a given
  9. setting (classic Hausman under clustering, Pesaran CD after time effects, first-generation
  10. unit-root tests under cross-sectional dependence).
  11. ## What it covers
  12. | Data | Diagnostics | Robustness |
  13. |---|---|---|
  14. | **Panel** | F tests for entity and time effects, Breusch-Pagan LM, Hausman, Mundlak (cluster-robust), Wooldridge AR(1), modified Wald, Pesaran CD, Fisher-ADF unit roots, within VIF, outliers | SEs: iid, robust, clustered (entity, time, two-way), Driscoll-Kraay · Estimators: pooled, RE, FE, two-way FE, first differences, between, dynamic FE · Sample: winsorizing, trimming, balanced sub-panel, early/late split, leave-one-entity-out jackknife |
  15. | **Time series** | ADF + KPSS integration order, Engle-Granger, Breusch-Godfrey, Ljung-Box, Breusch-Pagan, ARCH-LM, Jarque-Bera, RESET, CUSUM | SEs: iid, HC, HAC · Huber, LAD, first differences, lagged y · Cook's D, winsorizing, sample halves |
  16. | **Cross section** | Breusch-Pagan, White, RESET, Jarque-Bera, VIF, Cook's distance | SEs: iid, HC1, HC3, clustered · Huber, LAD · Cook's D, winsorizing |
  17. Each coefficient gets a verdict (`ROBUST`, `MOSTLY ROBUST`, `FRAGILE`), and sub-sample
  18. differences are reported separately as **heterogeneity**, not as fragility.
  19. ## Install
  20. ```bash
  21. git clone https://github.com/<user>/econometric-diagnostics ~/.claude/skills/econometric-diagnostics
  22. pip install -r ~/.claude/skills/econometric-diagnostics/requirements.txt
  23. ```
  24. Then, in Claude Code, inside your research project:
  25. > Check the robustness of the models in `models/baseline.py`.
  26. ## Use the scripts directly
  27. ```bash
  28. cd examples
  29. python make_example_data.py
  30. python ../scripts/inspect_data.py config_example.json
  31. python ../scripts/panel_diagnostics.py config_example.json
  32. python ../scripts/robustness.py config_example.json
  33. python ../scripts/to_latex.py config_example.json --lang en
  34. ```
  35. The config format is documented in [`references/config_schema.md`](references/config_schema.md).
  36. ## Layout
  37. ```
  38. SKILL.md workflow and ground rules Claude follows
  39. scripts/ inspect_data, panel_diagnostics, robustness, ols_diagnostics, to_latex
  40. references/ decision tree, interpretation of each test, config schema
  41. templates/ report template
  42. examples/ synthetic panel with a known data-generating process
  43. ```
  44. ## Limitations
  45. Not covered: IV/2SLS and GMM diagnostics, second-generation panel unit roots (CIPS),
  46. panel cointegration, wild cluster bootstrap, nonlinear models. The skill says so and
  47. recommends the right tests when a model needs them.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.