AGENT SKILL

neishengxing

Use when designing, diagnosing, coding, running, or writing an endogeneity section for empirical economics papers, including IV/2SLS/IV-Tobit, leave-one-out peer instruments, weak-IV tests, Oster (2019), Heckman selection, WIT many-IV screening, TSCI/STCI invalid-IV methods, LIML/Fuller fallbacks, and manuscript-ready Chinese or English reporting.

License 许可
MIT
最近更新
2026-09-18
Stars
★ 234
Forks
36

01 前言 Front Matter

name
neishengxing
description
Use when designing, diagnosing, coding, running, or writing an endogeneity section for empirical economics papers, including IV/2SLS/IV-Tobit, leave-one-out peer instruments, weak-IV tests, Oster (2019), Heckman selection, WIT many-IV screening, TSCI/STCI invalid-IV methods, LIML/Fuller fallbacks, and manuscript-ready Chinese or English reporting.

02 资源文件 8

03 SKILL.md 正文

经济学内生性 Skill

Core Rule

Treat endogeneity handling as a diagnostic workflow, not a decoration. First identify the threat and data structure, then choose methods that are conceptually applicable, estimable in the user's software, and reportable without overclaiming.

Never claim a method solves endogeneity merely because the coefficient is significant. Always report suitability, identifying assumptions, diagnostics, and residual reviewer risk.

Intake Checklist

Before coding or writing, collect or infer:

  • Outcome type: continuous, binary, count, censored/share in [0,1], panel, survival, or selection-only observed.
  • Baseline estimator: OLS for linear continuous outcomes; Tobit or fractional/bounded alternatives for censored shares; logit/probit for binary outcomes; fixed effects or panel models when panel variation exists.
  • Suspected threat: omitted variables, reverse causality, self-selection/sample selection, simultaneity, measurement error, weak instruments, invalid instruments.
  • Treatment/endogenous variable: binary, continuous, ordered, generated index, or multiple endogenous regressors.
  • Data level: individual/household, village/community, county/city, firm, panel, repeated cross-section.
  • Available instruments: external historical/geographic/institutional variables, peer leave-one-out instruments, high-dimensional candidate IVs, policy shocks, or no credible IV.
  • Software: Stata, R, Python, or mixed workflow; whether packages may be installed.
  • Manuscript target: main identification section, robustness subsection, appendix, or reviewer response.

If key information is missing but work can proceed, make a conservative assumption and flag it in the output.

Method Selection

Use this order unless the user requests a specific method:

  1. Baseline alignment: ensure the baseline estimator matches the outcome. For shares bounded in [0,1], use Tobit or a bounded-outcome model for direct regressions; keep OLS as a comparability or diagnostic model if needed.
  2. Main IV path: if credible instruments exist, estimate first stage and second stage. For censored outcomes, consider IV-Tobit or control-function Tobit in addition to 2SLS.
  3. Leave-one-out peer IV: if no external IV exists and peer environment is defensible, construct same-group excluding-self means for the endogenous variable or digital subindices. Treat this as a reviewer-risk instrument requiring strong exclusion-argument writing.
  4. Weak-IV and overidentification diagnostics: report first-stage F, KP rk Wald F, Anderson-Rubin, Stock-Wright/CLR when available, underidentification, weak-ID, endogeneity, and Hansen/Sargan overidentification when overidentified.
  5. Oster (2019): use coefficient stability to address omitted-variable concerns in OLS-style models. Do not present it as a Tobit replacement.
  6. Heckman: use only when the outcome is observed for a selected subsample and selection into observation is substantively meaningful. Do not use Heckman merely because the dependent variable has many zeros.
  7. WIT / many-IV screening: use when there is a genuinely large or mechanically generated candidate IV pool and the method's assumptions are defensible. Treat WIT as candidate-IV screening or many-IV robust identification support, then report the selected/effective IV pool and post-selection estimates/diagnostics.
  8. TSCI / STCI invalid-IV methods: use only after reading the method reference and checking whether the data satisfy the method's curvature/nonlinearity, invalid-IV structure, and candidate-IV requirements. Do not call it a simple instrument-combination method.
  9. Fallbacks: use LIML / Fuller-LIML as weak-IV robustness for linear IV settings. They supplement but do not repair an implausible exclusion restriction.

For method details, read references/method_cards.md. For paper-facing wording and table checklists, read references/reporting_templates.md. If the user needs citations, DOI, literature grounding, or a referee-facing method explanation, read references/literature.md.

Leave-One-Out Peer IV Pattern

Use when the user lacks external IVs but has clustered peer data:

  • Define group: village, community, county, city, school, industry, or market.
  • For each unit, compute the group mean of the endogenous variable excluding itself.
  • Candidate variants: leave-one-out mean of the binary treatment, continuous index, subindices, lagged peer exposure, or peer access/use/finance components.
  • Exclusion argument: peer digital environment affects the individual's digital participation through local learning, infrastructure, norms, and service exposure; it should not directly affect the outcome after controlling for own covariates and fixed effects.
  • Risk statement: peer IV may violate exclusion through common shocks, reflection, spillovers, or sorting. Always add group controls/fixed effects where feasible and avoid overclaiming.

When coding from tabular data, adapt scripts/build_leave_one_out_iv.py.

Output Contract

For empirical work, deliver:

  • A diagnosis paragraph: endogeneity threats and why each selected method fits or does not fit.
  • A runnable command file or code block with Chinese comments if the user works in Chinese.
  • A results map: main tables, appendix tables, logs, and file paths.
  • A reporting checklist: coefficients, standard errors, stars, N, controls, fixed effects, first-stage diagnostics, weak-IV diagnostics, overidentification tests, method-specific assumptions.
  • A manuscript paragraph: conservative, journal-style interpretation with no hidden workflow notes.
  • A stop/go recommendation: what can enter main text, what belongs in appendix, what should be dropped.

Red Lines

  • Do not hide insignificant, weak, or failed diagnostics in the reasoning. If the user asks not to report a failed result, separate “do not report” from “method not supported.”
  • Do not call a weak-IV result “solved identification.”
  • Do not use Heckman for true zero outcomes unless there is a separate sample-observation selection process.
  • Do not use WIT/TSCI simply because the method sounds advanced; first pass the applicability gate.
  • Do not invent external instruments. Ask the user to provide literature or data, or limit work to constructible peer/group instruments.

Version

Current version: 1.0.0.

04 同仓库更多 Skills

franklee16
franklee16/academic-research-skills

beamer-ppt

A conversational assistant skill for creating professional LaTeX Beamer presentations through natural dialogue. Users create slides page-by-page with flexible layouts and instant PDF preview. Supports both Chinese (ctex) and English typesetting with multi-project management and undo/redo capabilities.

★ 234
franklee16
franklee16/academic-research-skills

thu-digitizer

Extract and validate numeric data from chart images, PDF figures, and official source-data files locally and reproducibly, with calibrated axes, compact-scatter recovery plus residual audits, grouped/stacked bars, visible-label pie/donut validation, original-pixel aligned lattice composites such as UpSet plots, PDF vector inspection, line tracing, histograms, boxplots, error bars, CSV/JSON evidence, source-data cross-validation, and regression evaluation. Use when a user asks to recover or recreate chart data, extract scatter points, bars, printed pie/donut labels, or aligned memberships, check a PDF chart, assess digitization accuracy, validate against source data, or improve a chart-digitization workflow from corrected examples.

★ 234
franklee16
franklee16/academic-research-skills

scientific-visualization

Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.

★ 234
franklee16
franklee16/academic-research-skills

theoretical-economics-claude-skill

Human-in-the-loop theoretical economics research pipeline: from economic intuition to manuscript skeleton in 10 structured stages with quality gates.

★ 234
franklee16
franklee16/academic-research-skills

interview-guide-design

把一个研究题目、研究思路或研究问题,落成一份能用于学术研究、案例研究、学位论文、课题调研的质性访谈提纲时,使用此 skill。触发信号很宽:用户说"做/设计访谈提纲""访谈大纲怎么设计才规范""结构性访谈提纲""把研究问题/题目变成访谈问题""帮我弄份访谈提纲去问问他们""怎么访谈才能挖到深层的东西""interview guide / interview protocol / key informant / elite interview",无论措辞多口语、有没有提方法论,都应触发。典型情形:要去访谈领导 / 干部 / 管理者 / 专家 / 科室主任 / 一线员工或老师 / 关键知情人,了解某个现象、做法或机制;半结构化 / 结构化 / 关键知情人 / 精英访谈皆可;中英双语;社科 / 管理 / 教育 / 公共政策 / 医疗等领域;也常与案例研究、或与一份配套问卷的混合方法调研一起出现。它把研究问题按 Castillo-Montoya 的 IPR 框架与 Yin/Stake 的案例研究规范,拆成"主问题—追问—探测",保障与研究问题对齐、可信度(trustworthiness)与三角验证就绪,标注方法论依据与权威出处,产出研究者版 + 现场详版/简版。不要用于:量化问卷 / 量表设计(走 questionnaire-design)、求职面试、以传播或叙事为目的的人物访谈(媒体/播客/记者深度报道/纪录片/口述史,非以回答研究问题为目的)、访谈录音转写、焦点小组/座谈会提纲(群体互动动态与主持伦理不同,本 skill 不覆盖)、以及访谈完成后的编码与主题分析。

★ 234
franklee16
franklee16/academic-research-skills

mixed-methods-instrument-design

基于同一项研究的研究目的、研究问题、理论框架与人群设计,协同产出彼此对齐的量化问卷/调查表和质性访谈提纲时使用;也可在用户明确要求时把经审核的问卷创建为问卷星未发布草稿并继续管理。触发信号包括“问卷和访谈一起设计”“根据研究思路同步出调查问卷与访谈提纲”“混合方法研究工具”“不同人群分别做问卷和访谈”“推送到问卷星”“创建在线问卷”“survey + interview guide”“convergent / explanatory sequential / exploratory sequential mixed methods instruments”。适用于社会科学、管理、教育、公共政策、医疗及其他经验研究;允许量化与质性部分使用相同或不同样本。产出研究设计判定、中央映射矩阵、问卷与变量字典、完整访谈三版、联合展示模板和预测试方案;默认用户成品仍是一份完整 Word。不要用于只设计单一访谈提纲(走 interview-guide-design)、只设计单一问卷、把现成工具做成网页、访谈转写、正式数据分析,或在没有研究问题的情况下机械拼接两套题目。

★ 234