Logotipo de Stata Reference Guide

Stata Reference Guide

Comunidad
wentorai
stata-reference-guide

Comprehensive Stata reference covering syntax, econometrics, and 20+ packages

Descripción general

Editorwentorai
Repositorioresearch-plugins
Nombre de la habilidadstata-reference-guide
Estrellas
294
Forks
42
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por wentorai en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Stata Reference Guide en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/wentorai/research-plugins/tree/main/skills/analysis/econometrics/stata-reference-guide
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wentorai/research-plugins.git /tmp/research-plugins
mkdir -p .claude/skills
cp -r /tmp/research-plugins/skills/analysis/econometrics/stata-reference-guide .claude/skills/stata-reference-guide
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Stata Reference Guide en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Stata Reference Guide automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Stata Reference Guide no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Stata Comprehensive Reference Guide

Overview

Stata is the dominant statistical software in economics, political science, public health, and sociology research. This guide provides a comprehensive reference covering core syntax, data management, estimation commands, causal inference methods, graphics, Mata programming, and 20+ community-contributed packages. It is designed as a progressive-disclosure reference: use the section relevant to your current task rather than reading end-to-end.

Core Syntax and Data Management

Data Import and Export

stata
* Import CSV with variable names in first row
import delimited "data.csv", clear varnames(1)

* Import Excel (specific sheet and cell range)
import excel "workbook.xlsx", sheet("Sheet1") cellrange(A1:Z1000) firstrow clear

* Import Stata format
use "dataset.dta", clear

* Export to CSV
export delimited "output.csv", replace

* Save as Stata format
save "cleaned_data.dta", replace

Variable Management

stata
* Generate new variables
gen log_income = ln(income)
gen age_sq = age^2
gen treatment_post = treatment * post

* Recode and label
recode education (1/12 = 1 "HS or less") (13/16 = 2 "College") (17/20 = 3 "Graduate"), gen(edu_cat)
label variable edu_cat "Education Category"

* String operations
gen first_name = word(full_name, 1)
gen year_str = string(year)
destring price_str, gen(price) force

* Date handling
gen date = date(date_str, "YMD")
format date %td
gen year = year(date)
gen quarter = quarter(date)

Data Cleaning Patterns

stata
* Identify and handle duplicates
duplicates report id year
duplicates tag id year, gen(dup_flag)
duplicates drop id year, force

* Missing values
misstable summarize
misstable patterns
replace income = . if income < 0  // recode impossible values

* Merge datasets
merge 1:1 id year using "panel_data.dta", keep(match master) nogen
merge m:1 state year using "state_controls.dta", keep(match master) nogen

* Reshape between wide and long
reshape long income_, i(id) j(year)
reshape wide income, i(id) j(year)

* Collapse to group level
collapse (mean) avg_income=income (sd) sd_income=income (count) n=income, by(state year)

Estimation Commands

Linear Regression

stata
* OLS with robust standard errors
reg y x1 x2 x3, robust

* Clustered standard errors
reg y x1 x2 x3, cluster(firm_id)

* Fixed effects (within estimator)
xtreg y x1 x2 x3, fe cluster(firm_id)
xtset firm_id year  // must declare panel structure first

* Absorbing high-dimensional FE (reghdfe)
reghdfe y x1 x2 x3, absorb(firm_id year) cluster(firm_id)

* Instrumental variables (2SLS)
ivregress 2sls y x1 x2 (endog_var = instrument1 instrument2), robust
estat firststage
estat overid

Panel Data Methods

stata
* Panel setup
xtset firm_id year

* Hausman test (FE vs RE)
quietly xtreg y x1 x2, fe
estimates store fe
quietly xtreg y x1 x2, re
estimates store re
hausman fe re

* Dynamic panel GMM (xtabond2)
xtabond2 y L.y x1 x2, gmm(L.y, lag(2 4)) iv(x1 x2) robust twostep

* Test for serial correlation and overidentification
estat abond    // Arellano-Bond test
estat sargan   // Sargan/Hansen test

Causal Inference

stata
* Difference-in-Differences
gen did = treatment * post
reg y did treatment post controls, cluster(state)

* Modern DiD with staggered treatment (csdid)
csdid y x1 x2, ivar(id) time(year) gvar(first_treat) method(dripw)
csdid_plot  // event study plot

* Regression Discontinuity (rdrobust)
rdrobust y running_var, c(0) p(1) kernel(triangular)
rdplot y running_var, c(0) p(1)

* Propensity Score Matching (psmatch2)
psmatch2 treatment x1 x2 x3, outcome(y) logit caliper(0.05) common
pstest x1 x2 x3  // balance check

* Synthetic Control (synth)
synth y x1 x2 x3 y(1990) y(1991) y(1992), trunit(1) trperiod(1993) fig

Limited Dependent Variables

stata
* Logit/Probit
logit binary_y x1 x2, robust
margins, dydx(*)  // average marginal effects

probit binary_y x1 x2, robust
margins, dydx(*)

* Ordered logit
ologit ordered_y x1 x2, robust
margins, predict(outcome(3)) dydx(x1)

* Tobit (censored regression)
tobit y x1 x2, ll(0)

* Poisson and Negative Binomial
poisson count_y x1 x2, robust
nbreg count_y x1 x2, robust

Community Packages (20+)

Installation

stata
* Install from SSC (Statistical Software Components)
ssc install reghdfe
ssc install estout
ssc install coefplot
ssc install csdid
ssc install rdrobust
ssc install psmatch2
ssc install synth
ssc install ivreg2
ssc install xtabond2
ssc install winsor2
ssc install gtools
ssc install ftools
ssc install binscatter
ssc install binsreg
ssc install grstyle

* Install from GitHub
net install did_multiplegt, from("https://raw.githubusercontent.com/chaisemartinDehejia/did_multiplegt/main")

Publication-Quality Output

stata
* estout / esttab — formatted regression tables
eststo clear
eststo: reg y x1 x2, robust
eststo: reg y x1 x2 x3, robust
eststo: reg y x1 x2 x3, cluster(firm_id)
esttab, se star(* 0.10 ** 0.05 *** 0.01) ///
    title("Main Results") label replace ///
    scalars("r2 R-squared" "N Observations")

* Export to LaTeX
esttab using "table1.tex", replace booktabs ///
    se star(* 0.10 ** 0.05 *** 0.01) label

* Export to CSV/Excel
esttab using "table1.csv", replace se

* coefplot — coefficient visualization
coefplot est1 est2 est3, drop(_cons) xline(0) ///
    title("Coefficient Estimates") legend(order(1 "Model 1" 2 "Model 2" 3 "Model 3"))

Graphics

stata
* Scatter with fit line
twoway (scatter y x) (lfit y x), title("Y vs X") ///
    xtitle("X Variable") ytitle("Y Variable")

* Event study plot
coefplot, vertical drop(_cons) yline(0) ///
    title("Event Study") xtitle("Periods Relative to Treatment")

* Binned scatter (binscatter)
binscatter y x, controls(z1 z2) nquantiles(20) ///
    title("Binned Scatter") xtitle("X") ytitle("Y")

* Kernel density
kdensity income if year==2020, normal ///
    title("Income Distribution") xtitle("Income")

* Graph styling (grstyle)
grstyle init
grstyle set plain, horizontal grid
grstyle color background white
grstyle set color economist

Mata Programming

stata
* Basic Mata usage
mata:
    // Matrix operations
    X = st_data(., ("x1", "x2", "x3"))
    y = st_data(., "y")
    n = rows(X)

    // OLS by hand
    X = X, J(n, 1, 1)  // add constant
    beta = invsym(X'X) * X'y
    e = y - X * beta
    sigma2 = (e'e) / (n - cols(X))
    V = sigma2 * invsym(X'X)
    se = sqrt(diagonal(V))

    beta, se
end

Workflow Best Practices

  1. Always set a random seed before any procedure involving randomness: set seed 12345
  2. Use preserve/restore for temporary data manipulations within a do-file
  3. Log your sessions: log using "analysis_log.smcl", replace
  4. Version control: Start do-files with version 17 (or your version) for reproducibility
  5. Use tempfiles for intermediate datasets: tempfile merged then save merged'`
  6. Profile your code with timer on 1 / timer off 1 / timer list for long-running operations
  7. Use gtools (greshape, gcollapse, gegen) for 5-10x speedups on large datasets

References

Preguntas frecuentes

¿Qué hace la habilidad de IA Stata Reference Guide?

Comprehensive Stata reference covering syntax, econometrics, and 20+ packages

¿Por qué usar Stata Reference Guide en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Stata Reference Guide está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Stata Reference Guide en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/wentorai/research-plugins/tree/main/skills/analysis/econometrics/stata-reference-guide. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Stata Reference Guide?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Stata Reference Guide?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Stata Reference Guide con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Stata Reference Guide?

Sí. wentorai la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇