# Zmienne instrumentalne (IV, 2SLS)

EN: **Instrumental variables (IV) and two-stage least squares** · id `ivregression` · aliases: instrumental variables, IV regression, 2SLS, two-stage least squares, dwustopniowa metoda najmniejszych kwadratów

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Fundamenty i rozumowanie](https://aiatlasgraph.com/t/foundations.md) › [Modele probabilistyczne](https://aiatlasgraph.com/t/probabilistic.md) › [Wnioskowanie przyczynowe](https://aiatlasgraph.com/t/causalinference.md) › [Eksperymenty naturalne i quasi-eksperymenty](https://aiatlasgraph.com/t/naturalexperiments.md) › Zmienne instrumentalne (IV, 2SLS)

## Description

- PL: Estymacja efektu przy niezmierzonym zakłócaczu z użyciem instrumentu, który wpływa na wynik wyłącznie przez badaną interwencję.
- EN: Estimating an effect despite unmeasured confounding using an instrument that affects the outcome only through the treatment.

## In one sentence

- PL: Szukasz czynnika, który przypadkiem popycha ludzi do decyzji, ale sam nie zmienia wyniku, i przez niego mierzysz skutek.
- EN: You find a factor that nudges people towards a decision by chance but does not change the outcome itself, and measure the effect through it.

## Problem it solves

- PL: Często nie da się zmierzyć wszystkiego, co wpływa naraz na decyzję i wynik, np. zdolności czy motywacji, więc porównania są skrzywione.
- EN: You often cannot measure everything that drives both a decision and its outcome, like ability or motivation, so comparisons are skewed.

## What it does

- PL: Jak pchnięcie z zewnątrz: patrzy tylko na tę część zmian w decyzji, którą wywołał przypadkowy bodziec, a nie ludzkie skłonności.
- EN: Like a push from outside: it looks only at the part of the decision changed by a chance nudge, not by people's own leanings.

## Everyday example

- PL: Odległość od uczelni wpływa na to, czy ktoś idzie na studia. Badacze wykorzystują ją, by oszacować, ile studia zmieniają późniejsze zarobki.
- EN: Distance to a university affects whether someone enrols. Researchers use it to estimate how much studying changes later earnings.

## This concerns you if you…

- PL: podejrzewasz ukryty czynnik, którego nie zmierzysz
- PL: wysłałeś losowe zaproszenia, z których nie wszyscy skorzystali
- EN: suspect a hidden factor you cannot measure
- EN: sent random invitations that not everyone accepted

## Keywords

2SLS · exclusion restriction · first-stage F-statistic · weak instruments · LATE · compliers · Mendelian randomization · encouragement design

## How it works

- PL: Instrument Z musi być istotny (wpływać na interwencję T – pierwszy etap) i spełniać warunek wyłączenia (wpływać na wynik Y tylko przez T). Metoda 2SLS najpierw przewiduje T z Z, potem regresuje Y na tych przewidywaniach; w najprostszym przypadku efekt to iloraz formy zredukowanej i pierwszego etapu. Przy heterogenicznych efektach i monotoniczności wynik to LATE dla podporządkowanych.
- EN: Instrument Z must be relevant (shift treatment T – the first stage) and satisfy exclusion (affect outcome Y only through T). 2SLS first predicts T from Z, then regresses Y on those predictions; in the simplest case the effect is the reduced form divided by the first stage. With heterogeneous effects and monotonicity it estimates the LATE for compliers.

## Limits

- PL: Warunku wyłączenia nie da się sprawdzić danymi, trzeba go uzasadnić. Słabe instrumenty dają ogromne przedziały ufności i ciągną wynik ku zwykłej regresji. Efekt dotyczy tylko osób, których decyzję instrument zmienia. Ręczne liczenie obu etapów daje złe błędy standardowe.
- EN: Exclusion cannot be tested with data and must be argued. Weak instruments give huge confidence intervals and pull estimates towards ordinary regression. The effect applies only to people whose decision the instrument changes. Running both stages by hand gives wrong standard errors.

## Key terms

- PL: **warunek wyłączenia**: Instrument wpływa na wynik wyłącznie przez badaną decyzję.
- PL: **pierwszy etap**: Jak silnie instrument zmienia badaną decyzję.
- PL: **LATE**: Efekt dla osób, które reagują na instrument.
- PL: **słaby instrument**: Instrument ledwo zmieniający decyzję; daje niestabilne wyniki.
- EN: **exclusion restriction**: The instrument affects the outcome only through the decision studied.
- EN: **first stage**: How strongly the instrument shifts the decision studied.
- EN: **LATE**: The effect for people who respond to the instrument.
- EN: **weak instrument**: An instrument barely shifting the decision; yields unstable results.

## Know first

- [Regresja liniowa i logistyczna (Linear and logistic regression)](https://aiatlasgraph.com/t/linearmodels.md)
- [Grafy przyczynowe (DAG) i dobór zmiennych do kontroli (Causal graphs (DAGs) and backdoor adjustment)](https://aiatlasgraph.com/t/causaldags.md)

## Related topics

Untyped, symmetric "see also" links.

- [Regresja nieciągła (RDD) (Regression discontinuity design (RDD))](https://aiatlasgraph.com/t/regdiscontinuity.md)

## Sources

- [Matheus Facure · Causal Inference for the Brave and True (online handbook with Python code)](<https://matheusfacure.github.io/python-causality-handbook/>) `facure-brave-true` · by Matheus Facure
- [Scott Cunningham · Causal Inference: The Remix (2nd edition of “The Mixtape”, online version)](<https://mixtape.scunning.com/>) `cunningham-mixtape-remix` · by Scott Cunningham

---

AI Atlas revision 131 (2026-11-07) · HTML: https://aiatlasgraph.com/t/ivregression · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-07
