iv-estimation

Solve endogeneity with instrumental variables and 2SLS estimation.

Updated Apr 15, 2026
One-click install
npx skills add https://github.com/sheehe/coase --skill iv-estimation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: iv-estimation
Source: https://github.com/sheehe/coase/tree/main/%E5%AE%9E%E8%AF%81%E7%A7%91%E7%A0%94%E6%8F%92%E4%BB%B6/econometrics/econometrics/skills/iv-estimation
Command: npx skills add https://github.com/sheehe/coase --skill iv-estimation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Instrumental variables and related causal-inference techniques are often hard to apply correctly due to endogeneity and weak instruments. This skill provides practical guidance, templates, and diagnostics to perform IV/2SLS estimation and propensity score matching.

Core Features & Use Cases

  • IV / 2SLS estimation: Identify valid instruments, run two-stage least squares, and interpret LATE.
  • Diagnostics & Inference: First-stage F-statistics, Wu-Hausman, Sargan-Hansen, Anderson-Rubin, and LIML alternatives.
  • PSM workflows: When selection on observables is credible, implement propensity score matching and ATT estimation with balance checks.
  • Reference & templates: Code templates in Python, R, and Stata; expanded reference material in references/iv-reference.md for deeper dives.

Quick Start

Run a straightforward IV analysis by selecting valid instruments and performing a 2SLS estimation with accompanying diagnostics.

Frequently Asked Questions about iv-estimation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix endogeneity problems using instrumental variables in my econometric model?

Fix endogeneity by identifying valid instruments and running two-stage least squares (2SLS) estimation. This skill provides templates for instrument selection, first-stage F-statistics, and interpreting LATE to solve endogeneity problems in econometric models.

What diagnostics do I need to run after a 2SLS estimation to check for weak instruments?

After 2SLS estimation, run first-stage F-statistics to detect weak instruments, perform Wu-Hausman tests for endogeneity, and apply Sargan-Hansen or Anderson-Rubin overidentification tests to validate instrument strength and model specifications.

When should I use propensity score matching instead of instrumental variables for causal inference?

Use propensity score matching (PSM) instead of instrumental variables when selection on observables is credible. PSM estimates the ATT with balance checks, whereas IV is necessary when unobserved confounding causes endogeneity.

Can I perform IV estimation and 2SLS workflows across Python, R, and Stata?

Yes, you can perform IV estimation and 2SLS workflows across Python, R, and Stata. The skill provides practical code templates, test interpretations, and reference materials to guide end-to-end instrumental variables analyses in these environments.

What are the limitations of instrumental variables and when should I avoid 2SLS?

Avoid 2SLS when you cannot find valid instruments or when instruments are weak, violating exclusion restrictions. In such cases, LIML alternatives or propensity score matching may provide more reliable causal inference estimates for your analysis.