# Stata Regression

Run regression analyses in Stata with publication-ready output tables.

- Repository: https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills (4869 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill stata-regression -g -a claude-code -y`
Codex: `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill stata-regression -g -a codex -y`
Cursor: `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill stata-regression -g -a cursor -y`
Gemini CLI: `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill stata-regression -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add brycewang-stanford/Auto-Empirical-Research-Skills`

## Description

Run regression analyses in Stata with publication-ready output tables.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Stata Regression

## Purpose

This skill produces reproducible regression analysis workflows in Stata, including model diagnostics and publication-ready tables using `esttab` or `outreg2`.

## When to Use

- Estimating linear or nonlinear regression models in Stata
- Producing tables for academic papers and reports
- Running robustness checks and alternative specifications

## Instructions

Follow these steps to complete the task:

### Step 1: Understand the Context

Before generating any code, ask the user:

- What is the dependent variable and key regressors?
- What controls and fixed effects are required?
- How should standard errors be clustered?
- What output format is needed (LaTeX, Word, or CSV)?

### Step 2: Generate the Output

Based on the context, generate Stata code that:

1. **Loads and checks the data** - Handle missing values and verify variable types
2. **Runs the requested specification** - Use `regress`, `reghdfe`, or `xtreg` as appropriate
3. **Adds robust or clustered standard errors** - Match the study design
4. **Exports tables** - Use `esttab` or `outreg2` with clear labels

### Step 3: Verify and Explain

After generating output:

- Explain what each model estimates
- Highlight assumptions and diagnostics
- Suggest robustness checks or alternative models

## Example Prompts

- "Run OLS with firm and year fixed effects, clustering by firm"
- "Estimate a logit model and export results to LaTeX"
- "Create a regression table with three specifications"

## Example Output

```stata
* ============================================
* Regression Analysis with Stata
* ============================================

* Load data
use "data.dta", clear

* Summary stats
summarize y x1 x2 x3

* Main regression with clustered SEs
regress y x1 x2 x3, vce(cluster firm_id)
eststo model1

* Alternative specification with fixed effects
reghdfe y x1 x2 x3, absorb(firm_id year) vce(cluster firm_id)
eststo model2

The rest: https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills/blob/HEAD/skills/09-meleantonio-awesome-econ-ai-stuff/_skills/analysis/stata-regression/SKILL.md
