Instrumental variables with heterogeneous effects: LATE and compliers
With heterogeneous effects, instrumental variables may identify a local average treatment effect for compliers. Study ITT, compliance types, complier characteristics, marginal treatment effects, and judge designs.
After this lesson you can
- Formulate IV with potential outcomes and prove the LATE theorem.
- Distinguish ITT, treatment effect on treated units, and LATE under noncompliance.
- Estimate complier proportions and characteristics using κ weights.
- Explain why different valid instruments can yield different IV estimates.
- Interpret judge designs and marginal treatment effects as LATE extensions.
Before you start
Offering is not attending
A lottery offers training to a group of developers. Some invitees do not attend and some uninvited people find another way to attend. The difference between arms preserves the benefit of random assignment and answers the effect of offering the program. Directly comparing attendees with nonattendees can mix the effect of attending with motivation, availability, or experience.
The intention-to-treat effect, or ITT, is the average outcome difference between assigned groups. It does not require universal compliance to describe the causal offer effect in a well-randomized trial, with consistency and no interference. If the offer also changes the outcome through another path, ITT still includes it; dividing by attendance does not attribute everything to attending.
The four potential types
Let be the offer and the treatment each person would receive under assignment . Compliance types are joint properties of two potential decisions:
| Type | Response to offer | ||
|---|---|---|---|
| Never-taker | 0 | 0 | Never attends |
| Complier | 0 | 1 | Attends only if offered |
| Always-taker | 1 | 1 | Attends in both arms |
| Defier | 1 | 0 | Attends only if not offered |
Each person reveals only . Without further assumptions, seeing an invitee attend does not by itself distinguish a complier from an always-taker. The proportions and effects of all types cannot be read directly from the four observed cells.
The Wald ratio and LATE theorem
Let be potential outcomes under treatment . To interpret as an instrument, we need:
- Independence and support: is independent of in the analyzed population and . With covariates, conditional independence can be assumed together with support for both values in relevant strata. Potential outcomes are assumed integrable.
- Exclusion and consistency: the offer affects only through , so , and . Absence of interference between units must also be justified.
- Relevance: .
- Monotonicity: almost surely. No person is a defier for this particular instrument change.
Assignment independence may come from the lottery; exclusion and monotonicity need additional arguments. For example, an invitation can inform or motivate even someone who does not attend. Randomization does not remove that possible direct effect.
The following derivation uses unconditional independence. If plausible only conditional on , the raw ratio may compare arms with different covariate distributions. Under conditional assumptions and support, first standardize both differences over the same distribution of :
The denominator remains the population proportion of compliers, provided it is positive; standardized differences appropriately weight strata.
Under those assumptions, with and ,
The first equality uses independence and consistency; the second uses exclusion and binary treatment; the third uses monotonicity. If , the local average treatment effect is
The Wald estimator replaces expectations with sample means and converges to LATE under suitable sampling and moments. A first stage near zero destabilizes the ratio and usual delta approximation; do not confuse a mathematically positive relationship with precise information.
LATE is generally neither ATE nor the average effect among all treated. The latter can include always-takers whose untreated outcomes are not identified by this instrument. With a program that truly bars uninvited access, , there are no always-takers or defiers; even then LATE describes those who would attend if offered, not necessarily those who would never attend.
Defiers and changing the instrument
Without monotonicity, let be complier and defier proportions and their average effects. Reduced form and first stage are and . When the denominator is nonzero, Wald is
The negative weight for defiers can produce a value outside the range of group effects. It can accidentally coincide with a particular effect, but generally is not interpreted as a subpopulation average. If , the first stage vanishes even though people change treatment.
Two valid offers may induce different people to change their decision. With heterogeneous effects, their LATEs may differ without that difference alone proving either instrument invalid.
Who are the compliers?
Under the theorem’s assumptions the complier proportion is the first stage. To study complier characteristics, if the instrument is random only conditional on pretreatment covariates , write and require in relevant strata. Abadie’s weights recover complier moments. Define
For an integrable function ,
To see this, average over within each type and : its expectation is one for compliers and zero for other types, thanks to conditional independence and monotonicity. Therefore identifies the mean of a pretreatment characteristic among compliers. Some individual weights are negative; they are not observed labels or individual compliance probabilities. A near-zero empirical denominator signals weakness and instability.
For complier potential-outcome means, also use
Under the same assumptions, and for . They may be normalized separately in the sample, but normalization does not remove negative weights or a weak first stage. If is estimated, inference must incorporate that fit and assignment design.
Multiple instruments and controls
In the exactly identified case, 2SLS with one binary instrument and only an intercept equals Wald. Adding controls residualizes treatment, outcome, and instrument; interpretation depends on how effects are adjusted and conditional independence assumptions. With multivalued instruments, ordered monotonicity, and suitable weights, a weighted average of local effects from different incentive changes may arise.
Do not turn that observation into a positive-weight rule for any 2SLS with multiple instruments and linear controls: weights can depend on specification and have problematic signs. An overidentification test detects incompatibility with joint restrictions but does not certify validity when it fails to reject. If valid instruments identify different local effects, imposing one homogeneous coefficient may cause rejection without proving which instrument violates exclusion.
From LATE to marginal effects
In a latent selection model, let be unobserved resistance and , where is treatment propensity. For this derivation assume is independent of and required exclusion and regularity hold. The marginal treatment effect is
By independence,
Where varies continuously and the derivative exists, the local instrumental ratio is the derivative of that mean with respect to . Between two values , LATE is the average of over . If propensity has support only over part of , the curve outside that portion and its full integral require extrapolation or extra assumptions.
In this model without covariates, if has the distribution induced by the instrument, normalized weights for ATE, ATT, and ATU respectively are
Integrating each weight against gives its population effect, provided quantities are identified and denominators positive. The mean between and uses uniform weight over that interval. Selection is a substantive model, not an automatic property of every valid IV.
A judge design compares assignments of cases to judges differing in severity. It can approach an experiment if cases are effectively randomized within the relevant unit. Exclusion is questionable if judges affect outcomes through other decisions, and ranking judges by average severity does not ensure all individuals respond in the same direction. With multiple decisions and treatments, local interpretation must be justified for the particular design.
Two historical instruments
In the Vietnam draft lottery, eligibility cutoffs were 195, 125, and 95 for the 1970, 1971, and 1972 lotteries. Eligibility changed service probability but did not determine it: there were volunteers and exemptions. Angrist estimated civilian earnings of white veterans were approximately 15% lower in the early 1980s in the comparison studied. That figure pertains to that analysis and period; causal interpretation requires eligibility not to affect earnings through other channels.
Angrist and Krueger used quarter of birth as an instrument for years of schooling through school entry and leaving rules. For men aged 40–49 in the 1970 census, their table IV reports an OLS slope of 0.080 and 2SLS slope of 0.077 with birth-year effects. Treatment there is years of education, not binary attendance: the four-type binary table cannot simply be transferred or the coefficient called a universal ATE. Quarter exclusion is an assumption about other seasonal paths, not an automatic consequence of birth date.
The following comparison uses the aggregate file from Angrist’s replication documentation, downloaded from a browser-accessible mirror and hash-checked against the original. The earnings numerator and first stage come from different sources; the file filters positive earnings and smooths the first stage across cohorts. Thus the ratio is an illustrative reproduction under comparability and selection assumptions, not automatic proof of LATE. The result does not exactly reproduce every published row.
import io
import hashlib
import pandas as pd
from pyodide.http import pyfetch
# Copia del archivo de replicación distribuido por Angrist; la fuente oficial
# MIT no ofrece CORS al navegador. La huella cotejada con el original MIT.
url='https://raw.githubusercontent.com/acmi-lab/online-moment-selection/main/data/cwhsc_new.dta'
response=await pyfetch(url)
if not response.ok: raise RuntimeError(f'Error HTTP {response.status}')
contenido=await response.bytes()
huella=hashlib.sha256(contenido).hexdigest()
esperada='a2804a64979cc236dfc341cf22e457a3b49f334d453426e09f0121e5ceb118f3'
if huella!=esperada: raise ValueError('La copia ya no coincide con el archivo de MIT')
datos=pd.read_stata(io.BytesIO(contenido))
print('Datos originales replicados: filas y columnas',datos.shape)
print('SHA-256 comprobado:',huella)import numpy as np
# En cohorte 1950 el fichero ya agrupa números de lotería en dos intervalos:
# intervalo 1 elegible, intervalo 2 no elegible. No son datos individuales.
# Fuentes y construcción descritas en Angrist (1990), tablas 2 y 3 y código MIT.
grupo=datos[(datos.byr==50)&(datos.race==1)&(datos.type=='ADJ')&datos.year.isin([81,82,83,84])]
print('Cohorte 1950, hombres blancos, ingresos FICA ajustados, dólares de 1978')
for año in (81,82,83,84):
filas=grupo[grupo.year==año].set_index('interval')
assert len(filas)==2 and set(filas.index)=={1,2}
elegible=filas.loc[1]; no_elegible=filas.loc[2]
efecto_y=float(elegible.earnings-no_elegible.earnings)
etapa1=float(elegible.ps_r-no_elegible.ps_r)
if etapa1<=0: raise ValueError('Primera etapa no positiva')
print('Año',1900+año,'medias Y:',round(float(elegible.earnings),2),
round(float(no_elegible.earnings),2),'diferencia de medias:',round(efecto_y,2),
'primera etapa:',round(etapa1,4),'cociente:',round(efecto_y/etapa1,2))
print('El cociente combina ingresos de CWHS con tasas SIPP ponderadas y suavizadas en tres cohortes.')
print('Las medias de ingresos condicionan en ingresos positivos; la selección podría depender del servicio.')
print('Un LATE requiere independencia, exclusión, monotonía y poblaciones/selección compatibles.')Lab: noncompliance in a trial
Assignment is random by construction and potential outcomes are known only to audit the experiment. The per-protocol comparison retains treated invitees and untreated noninvitees: it conditions on receipt, which follows randomization. Wald’s delta standard error assumes a suitable first stage and moments.
import numpy as np
def noncompliance_sample(n=12000,seed=181801,defiers=False):
"""Tipos y resultados potenciales; Z es independiente de todos ellos."""
rng=np.random.default_rng(seed)
# Tipo 0 nunca, 1 cumplidor, 2 siempre, 3 desafiante.
probs=np.array([.30,.50,.20,0.]) if not defiers else np.array([.25,.45,.20,.10])
kind=rng.choice(4,size=n,p=probs)
# X y Y(0) dependen del tipo: as-treated está sometido a selección.
x=rng.normal(loc=np.array([-.5,.4,1.,-.2])[kind],scale=1.)
y0=1+.8*x+np.array([-.2,.2,.8,-.4])[kind]+rng.normal(size=n)
treatment_effect=np.array([.5,2.,3.,-1.])[kind]+.3*x
y1=y0+treatment_effect
d0=np.isin(kind,[2,3]).astype(int)
d1=np.isin(kind,[1,2]).astype(int)
z=rng.binomial(1,.5,size=n)
d=np.where(z==1,d1,d0)
y=np.where(d==1,y1,y0)
return dict(x=x,y=y,z=z,d=d,d0=d0,d1=d1,kind=kind,y0=y0,y1=y1,tau=treatment_effect)
def diff_z(v,z):
if not np.any(z==0) or not np.any(z==1):
raise ValueError('Se necesitan ambos brazos de asignación')
return float(v[z==1].mean()-v[z==0].mean())
def fit_estimands(sample):
y,d,z,x=(sample[k] for k in ('y','d','z','x'))
first=diff_z(d,z);itt=diff_z(y,z)
if abs(first)<1e-10: raise ValueError('Primera etapa nula')
theta=itt/first
p=z.mean();res=y-theta*d
inf=(z/p-(1-z)/(1-p))*(res-np.where(z==1,res[z==1].mean(),res[z==0].mean()))/first
se=inf.std(ddof=1)/np.sqrt(len(y))
# κ de Abadie puede tomar valores negativos en muestras finitas.
kappa=1-d*(1-z)/(1-p)-(1-d)*z/p
k1=d*(z/p-(1-z)/(1-p))
k0=(1-d)*((1-z)/(1-p)-z/p)
if min(abs(kappa.mean()),abs(k0.mean()),abs(k1.mean()))<1e-10:
raise ValueError('Peso de cumplidores nulo')
complier_x=np.mean(kappa*x)/kappa.mean()
complier_y1=np.mean(k1*y)/k1.mean()
complier_y0=np.mean(k0*y)/k0.mean()
# 2SLS con intercepto: proyección explícita, no productos de matrices n×n.
W=np.column_stack((np.ones(len(z)),z)); A=np.column_stack((np.ones(len(d)),d))
[email protected](W,A,rcond=None)[0]
coef=np.linalg.lstsq(pred,y,rcond=None)[0][1]
assert np.isclose(coef,theta,atol=1e-10)
return first,itt,theta,se,complier_x,complier_y0,complier_y1,float(kappa.mean()),float(np.mean(kappa<0))
print('SCM de tipos de cumplimiento, tratamiento y resultados potenciales; Z aleatoria.')s=noncompliance_sample()
first,itt,theta,se,cx,c0,c1,pi,neg=fit_estimands(s)
z,d,y,kind,x=(s[k] for k in ('z','d','y','kind','x'))
compliers=kind==1
as_treated=y[d==1].mean()-y[d==0].mean()
# Comparación por protocolo: asignados al tratamiento y tratados frente a
# asignados al control y no tratados. Selecciona en variable posterior.
per_protocol=y[(z==1)&(d==1)].mean()-y[(z==0)&(d==0)].mean()
print('n:',len(y),'proporciones de tipos:',np.round(np.bincount(kind,minlength=4)/len(y),4))
print('ITT Y:',round(itt,4),'primera etapa:',round(first,4),'Wald = MC2E:',round(theta,4),'EE delta:',round(se,4))
print('LATE verdadero de esta muestra:',round(s['tau'][compliers].mean(),4),'ATE muestra:',round(s['tau'].mean(),4))
print('As-treated:',round(as_treated,4),'por protocolo:',round(per_protocol,4))
print('κ: proporción',round(pi,4),'media X',round(cx,4),'Y0/Y1',round(c0,4),round(c1,4),'pesos negativos:',round(neg,4))
print('Verdad de cumplidores: proporción',round(compliers.mean(),4),'media X',round(x[compliers].mean(),4),
'Y0/Y1',round(s['y0'][compliers].mean(),4),round(s['y1'][compliers].mean(),4))
print('Estimaciones muestrales sujetas a azar; p de asignación estimado por proporción observada.')s_def=noncompliance_sample(seed=181802,defiers=True)
dfirst,ditt,dtheta,_,_,_,_,_,_=fit_estimands(s_def)
cc=s_def['kind']==1; dd=s_def['kind']==3
pc,pd=cc.mean(),dd.mean()
late_c=s_def['tau'][cc].mean(); late_d=s_def['tau'][dd].mean()
identity=(pc*late_c-pd*late_d)/(pc-pd)
print('Desafiantes: primera etapa observada',round(dfirst,4),'Wald',round(dtheta,4))
print('Identidad poblacional empírica de tipos:',round(identity,4),
'LATE cumplidores',round(late_c,4),'efecto desafiantes',round(late_d,4))
print('La identidad de tipos y Wald difieren en muestra finita por la asignación aleatoria.')
print('Con desafiantes, κ pondera cumplidores +1 y desafiantes −1 en esperanza; no identifica solo cumplidores.')Lab: local instruments and MTE
Here instrument and latent resistance are independent uniform variables. We fit a linear propensity and quadratic conditional mean; the resulting derivative depends on that functional form. Theoretical support reaches the endpoints, but information there may be sparse. Counterfactuals are used only for auditing, not estimating the curve.
import numpy as np
# Z y U son independientes uniformes: la asignación instrumental es válida
# en este modelo explícito. U es resistencia no observada para el estimador.
rng = np.random.default_rng(271818)
n = 100_000
z = rng.uniform(0,1,n)
u = rng.uniform(0,1,n)
error = rng.normal(0,0.35,n)
y0 = 2+u+error
tau = 1+2*u
y1 = y0+tau
tratamiento = (u <= z).astype(float)
y = np.where(tratamiento == 1,y1,y0)
# Primera etapa: el modelo correcto aquí es P(D=1|Z)=a+bZ=Z.
design_p = np.column_stack([np.ones(n),z])
alpha = np.linalg.lstsq(design_p,tratamiento,rcond=None)[0]
p_bruto = design_p@alpha
p_estimado = np.clip(p_bruto,0,1)
# Segunda etapa paramétrica: E[Y|P=p] = c0+c1 p+c2 p².
# El estimador usa Y, D y Z, nunca observa U ni los contrafactuales.
design_y = np.column_stack([np.ones(n),p_estimado,p_estimado**2])
beta = np.linalg.lstsq(design_y,y,rcond=None)[0]
puntos = np.array([0.1,0.25,0.5,0.75,0.9])
mte_estimada = beta[1]+2*beta[2]*puntos
print('n y tasa tratada:',n,tratamiento.mean())
print('Propensity: intercepto, pendiente y número recortado a [0,1]:',
alpha, int(np.count_nonzero((p_bruto<0)|(p_bruto>1))))
print('Soporte muestral de propensity estimada:',p_estimado.min(),p_estimado.max())
print('Coeficientes de E[Y|p], estimados:',beta)
print('MTE por derivada, p=',puntos,':',np.round(mte_estimada,4))
print('MTE teórica en esos puntos:',1+2*puntos)# Para evaluar la curva derivada, promediamos con pesos propios de cada estimando.
grid = np.linspace(0,1,2001)
curva = beta[1]+2*beta[2]*grid
sorted_p = np.sort(p_estimado)
# Distribución estimada del propensity: Pr(P>u) y Pr(P<=u).
below = np.searchsorted(sorted_p,grid,side='right')/len(sorted_p)
mean_p = p_estimado.mean()
w_att = (1-below)/mean_p
w_atu = below/(1-mean_p)
mask = (grid >= 0.2) & (grid <= 0.4)
ate_hat = np.trapezoid(curva,grid)
att_hat = np.trapezoid(curva*w_att,grid)
atu_hat = np.trapezoid(curva*w_atu,grid)
late_hat = np.trapezoid(curva[mask],grid[mask])/(0.4-0.2)
print('Área de los pesos ATT y ATU:',np.trapezoid(w_att,grid),np.trapezoid(w_atu,grid))
print('Estimaciones ATE, ATT, ATU, LATE(0,2 a 0,4):',
np.round([ate_hat,att_hat,atu_hat,late_hat],4))
print('Verdades poblacionales:',[2,5/3,7/3,1.6])
print('Verdades finitas de esta muestra (solo para auditar la simulación):',
np.round([tau.mean(),tau[tratamiento==1].mean(),tau[tratamiento==0].mean(),
tau[(u>0.2)&(u<=0.4)].mean()],4))
print('El ATE y ATT integran hasta 0 y 1: aquí se usa la forma cuadrática supuesta.')Exercises
Step 1 of 3. What does the outcome difference by assignment represent?
Step 1 of 2. What equality does independence of Z allow?
def complier_means(y, d, z, x):
# Valida datos y primera etapa; calcula los tres pesos de Abadie.
# Devuelve proporción, media de x, medias potenciales y LATE.
raise NotImplementedErrorAfter attempting the numeric exercise, check its calculations and compare two resistance intervals:
import numpy as np
# Valores del ejercicio Wald: comprobar después de responder.
itt=2.4
first_stage=.6
assert first_stage>0
wald=itt/first_stage
assert np.isclose(wald,4.)
print('LATE de Wald, ITT 2,4 y primera etapa 0,6:',wald)
# Ejemplo de dos políticas con complidores distintos, no datos de estudios.
# U es uniforme; τ(u)=1+2u. Cada intervalo corresponde a un par de tasas
# de participación y la media se obtiene integrando la curva exactamente.
def late_lineal(a,b):
if not (0<=a<b<=1): raise ValueError('Intervalo inválido')
return ((b+b*b)-(a+a*a))/(b-a)
print('LATE del modelo τ(u)=1+2u: intervalos [0,2;0,4] y [0,6;0,8]:',
round(late_lineal(.2,.4),6),round(late_lineal(.6,.8),6))
print('Dos instrumentos válidos pueden desplazar grupos distintos; no demuestra validez por sí solo.')