stata-regression
Run regression analyses in Stata with publication-ready output tables.
What this skill does
# 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 * Export table esttab model1 model2 using "results/regression_table.tex", replace se label ``` ## Requirements ### Software - Stata 17+ ### Packages - `estout` (for `esttab`) - `reghdfe` (optional, for high-dimensional fixed effects) Install with: ```stata ssc install estout ssc install reghdfe ``` ## Best Practices 1. **Match standard errors to the design** (cluster where treatment varies) 2. **Report all model variants** used in the analysis 3. **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 - [Stata Regression Reference Manual](https://www.stata.com/manuals/rregress.pdf) - [reghdfe documentation](https://github.com/sergiocorreia/reghdfe) - [estout documentation](https://repec.sowi.unibe.ch/stata/estout/) ## Changelog ### v1.0.0 - Initial release
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.