stata-regression
Run regression analyses in Stata with publication-ready output tables.
它会碰到什么
扫了多少2 个文本文件,6 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
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:
- Loads and checks the data - Handle missing values and verify variable types
- Runs the requested specification - Use
regress,reghdfe, orxtregas appropriate - Adds robust or clustered standard errors - Match the study design
- Exports tables - Use
esttaboroutreg2with 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
* ============================================
* 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
* Export table
esttab model1 model2 using "results/regression_table.tex", replace se label
Requirements
Software
- Stata 17+
Packages
estout(foresttab)reghdfe(optional, for high-dimensional fixed effects)
Install with:
ssc install estout
ssc install reghdfe
Best Practices
- Match standard errors to the design (cluster where treatment varies)
- Report all model variants used in the analysis
- Document variable definitions and transformations
Common Pitfalls
- Not clustering standard errors at the correct level
- Omitting fixed effects when required by the design
- Exporting tables without clear labels and notes
References
Changelog
v1.0.0
- Initial release
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
星标★ 3,829
本站分层T1
该仓技能数1161
原文件路径
skills/31-thalysandratos-claude-code-skills/_skills/analysis/stata-regression/SKILL.md同一个仓库里的其他技能
- Full-empirical-analysis-skill
- Full-empirical-analysis-skill-R
- Full-empirical-analysis-skill-Stata
- auto-empirical-research-skills
- StatsPAI_skill
- Full-empirical-analysis-skill
- Full-empirical-analysis-skill-Stata
- Full-empirical-analysis-skill-R
- academic-paper-composer
- academic-paper-strategist
- medical-imaging-review
- paper-slide-deck
同名技能的其他版本
有 2 个不同仓库或目录里都有叫 stata-regression 的技能。它们内容并不相同,别混用:
- brycewang-stanford/Auto-Empirical-Research-Skills — Run regression analyses in Stata with publication-ready output tables.