Skip to main content

Instrumental Variables: What Is a Year of School Worth?

Instrumental variables and two-stage least squares in R with ivreg, on Card’s 3,010 young men and the college near home: why least squares is wrong when something unseen matters, the conditions for an instrument, the Wald estimator and two-stage least squares by hand, why the second stage gives wrong standard errors, the first-stage F, Wu-Hausman and Sargan tests by hand, weak instruments in a simulation and the Anderson-Rubin interval, whose effect it is, how small a violation would change the answer, a control that is not innocent, and APA reporting.

The question: school, or what comes with it?

People with more schooling earn more. Is it the school that makes the difference? Or would the same persons have earned more anyway, because they are able, hard-working, or from families that help? Nobody can measure all of that. So adding control variables, the remedy of ordinary regression, does not finish the job.

An instrumental variable (an instrument) takes another way. Find something that

  • pushes people towards more schooling,
  • has nothing to do with their ability or family,
  • and touches their wages in no other way than through schooling.

Then compare the wages of those who were pushed and those who were not. Whatever difference there is, must have come through schooling.

David Card (1993) proposed the distance to a college. A boy who grew up near a four-year college could live at home while studying. For some boys that decided the matter. This page repeats his analysis, with every step by hand, and then asks how far one can trust it. The second part is the more important one: the conditions above cannot be proved from the data.

Code
library(ggplot2)
library(ivreg)       # ivreg(): two-stage least squares with diagnostics
# also used, with package::function: sandwich (robust standard errors)

# number formats for the text
f1   <- function(x) formatC(x, format = "f", digits = 1, big.mark = ",")
f2   <- function(x) formatC(x, format = "f", digits = 2, big.mark = ",")
f3   <- function(x) formatC(x, format = "f", digits = 3, big.mark = ",")
# APA: no leading zero
nz <- function(x, d = 2) sub("^(-?)0\\.", "\\1.", formatC(x, format = "f", digits = d))
pval <- function(p) {
  ifelse(p < .001, "< .001", paste("=", sub("^0", "", formatC(p, format = "f", digits = 3))))
}
num  <- function(x) trimws(format(x, big.mark = ","))
pct  <- function(x, d = 0) paste0(formatC(100 * x, format = "f", digits = d), "%")

1. The data

Code
card <- read.csv("https://vincentarelbundock.github.io/Rdatasets/csv/wooldridge/card.csv")
dim(card)
[1] 3010   35
Code
head(
  card[, c(
    "lwage", "wage", "educ", "age", "exper", "black", "south", "smsa", "smsa66", "nearc4", "nearc2"
  )],
  4
)
     lwage wage educ age exper black south smsa smsa66 nearc4 nearc2
1 6.306275  548    7  29    16     1     0    1      1      0      0
2 6.175867  481   12  27     9     0     0    1      1      0      0
3 6.580639  721   12  34    16     0     0    1      1      0      0
4 5.521461  250   11  27    10     0     0    1      1      1      1
Code
controls <- paste(
  "exper + expersq + black + south + smsa + smsa66",
  "+ reg662 + reg663 + reg664 + reg665 + reg666 + reg667 + reg668 + reg669"
)

3,010 men of the US National Longitudinal Survey of Young Men, 24 to 34 years old when their wages were asked in 1976. The file comes from the R package wooldridge. The variables:

  • lwage: the logarithm of the hourly wage (in cents). A coefficient of 0.10 means about 10% more.
  • educ: years of schooling.
  • nearc4: 1 if there was an accredited four-year college in the local labor market, judged by the county where he lived in 1966 (as a boy or very young man), otherwise 0. nearc2 is the same for two-year colleges.
  • The controls of Card: years of potential work experience (exper, which is age − schooling − 6, and its square), black, living in the south, living in a metropolitan area in 1976 (smsa) and in 1966 (smsa66), and the region in 1966 (eight indicator variables, reg662 to reg669).

2. Look at the data

Code
m_ed <- aggregate(lwage ~ educ, card, function(v) c(mean(v), length(v)))
m_ed <- data.frame(educ = m_ed$educ, lwage = m_ed$lwage[, 1], n = m_ed$lwage[, 2])
ggplot(subset(m_ed, n >= 10), aes(educ, lwage)) +
  geom_point(aes(size = n), colour = "#2a78d6") +
  geom_smooth(
    data = card,
    aes(educ, lwage),
    method = "lm",
    formula = y ~ x,
    se = FALSE,
    colour = "#eb6834"
  ) +
  scale_size_area(max_size = 8) +
  labs(
    title = "Mean log wage by years of schooling",
    subtitle = "Size of the points: number of men",
    x = "years of schooling",
    y = "mean log wage"
  ) +
  theme_bw()

Wage chart – 2. Look at the data

Code
by_near <- aggregate(cbind(educ, lwage, black, south, smsa66) ~ nearc4, card, mean)
by_near$n <- as.numeric(table(card$nearc4))
print(round(by_near, 3), row.names = FALSE)
 nearc4   educ lwage black south smsa66    n
      0 12.698 6.155 0.280 0.563  0.328  957
      1 13.527 6.311 0.212 0.329  0.799 2053

The men who grew up near a college (2,053 of them) have 0.83 years more schooling and wages that are 0.156 higher in logs. But they are also different in other ways: fewer are black, fewer live in the south, and most come from cities. A college does not stand just anywhere. So the instrument is at best clean after controlling for region and city.


3. The model step by step, with formulas

Step 1: why least squares is wrong

The true equation has a variable \(u\) that we cannot see, which is also related to schooling \(s\):

\[\log w = \beta\, s + u, \qquad \text{Cov}(s, u) \ne 0\]

Least squares attributes to \(s\) everything that comes along with it, \(\hat\beta_{OLS} \to \beta + \text{Cov}(s, u)/\text{Var}(s)\). The sample size does not help.

Code
nodes <- data.frame(
  x = c(0, 2, 4, 3),
  y = c(0, 0, 0, 1.3),
  label = c(
    "college nearby\n(instrument)",
    "schooling",
    "wage",
    "ability, family, ...\n(not observed)"
  )
)
arrows <- data.frame(
  x = c(0.5, 2.4, 2.8, 3.2),
  y = c(0, 0, 1.05, 1.05),
  xend = c(1.55, 3.65, 2.15, 3.85),
  yend = c(0, 0, 0.15, 0.15)
)
never <- data.frame(
  x = c(0.3, 0.1),
  y = c(-0.15, 0.2),
  xend = c(3.8, 2.3),
  yend = c(-0.15, 1.2),
  curv = 1
)
ggplot() +
  geom_segment(
    data = arrows,
    aes(x, y, xend = xend, yend = yend),
    arrow = arrow(length = unit(0.25, "cm")),
    linewidth = 0.8,
    colour = "#2a78d6"
  ) +
  geom_curve(
    data = never[1, ],
    aes(x, y, xend = xend, yend = yend),
    curvature = 0.25,
    arrow = arrow(length = unit(0.25, "cm")),
    linetype = "dashed",
    colour = "#eb6834"
  ) +
  geom_segment(
    data = never[2, ],
    aes(x, y, xend = xend, yend = yend),
    linetype = "dashed",
    colour = "#eb6834"
  ) +
  geom_text(data = nodes, aes(x, y, label = label), size = 4.2, lineheight = 0.9) +
  annotate(
    "text",
    x = 2,
    y = -0.78,
    label = "no direct way (exclusion)",
    colour = "#eb6834",
    size = 3.6
  ) +
  annotate(
    "text",
    x = 0.75,
    y = 0.95,
    label = "no connection\n(independence)",
    colour = "#eb6834",
    size = 3.6
  ) +
  xlim(-0.6, 4.6) +
  ylim(-0.95, 1.6) +
  labs(title = "What an instrument needs: the blue arrows, and not the dashed lines") +
  theme_void()

Dag – Step 1: why least squares is wrong

Step 2: the conditions

  1. Relevance: the instrument changes schooling. This can be checked.
  2. Independence: the instrument has nothing to do with \(u\) (after the controls).
  3. Exclusion: the instrument changes wages only through schooling.
  4. Monotonicity (for the interpretation, section 6): the instrument pushes nobody in the opposite direction.

Step 3: the Wald estimator

With one instrument that is 0 or 1 and no controls, the estimator is the ratio of two differences:

\[\hat\beta_{IV} = \frac{\bar y_{\text{near}} - \bar y_{\text{far}}}{\bar s_{\text{near}} - \bar s_{\text{far}}}\]

The numerator is the effect of the instrument on the outcome (the reduced form), the denominator its effect on schooling (the first stage).

Code
c(
  reduced_form = diff(by_near$lwage),
  first_stage = diff(by_near$educ),
  Wald = diff(by_near$lwage) / diff(by_near$educ)
)
reduced_form  first_stage         Wald 
   0.1559075    0.8290190    0.1880626 

Without controls we know that condition 2 fails, so 0.188 is not our answer.

Step 4: two-stage least squares

With controls \(X\) (and perhaps several instruments \(Z\)) the same idea is done with two regressions, two-stage least squares (2SLS):

  1. First stage: regress schooling on the instrument and the controls, and keep the fitted values \(\hat s\). They contain only the part of schooling that the instrument and the controls can explain.
  2. Second stage: regress the log wage on \(\hat s\) and the controls.

\[\hat\beta = (W^\top P_Z W)^{-1} W^\top P_Z\, y, \qquad P_Z = Z(Z^\top Z)^{-1}Z^\top\]

(\(W\): schooling and the controls; \(Z\): instrument and controls.)

Code
fml <- function(lhs, rhs) as.formula(paste(lhs, "~", rhs))
ols          <- lm(fml("lwage", paste("educ +", controls)), card)
first_stage  <- lm(fml("educ", paste("nearc4 +", controls)), card)
reduced_form <- lm(fml("lwage", paste("nearc4 +", controls)), card)
card$educ_hat <- fitted(first_stage)
second_stage <- lm(fml("lwage", paste("educ_hat +", controls)), card)

W <- model.matrix(ols); Z <- model.matrix(first_stage); y <- card$lwage
PW   <- Z %*% solve(crossprod(Z), crossprod(Z, W))                        # P_Z W
beta <- drop(solve(crossprod(PW, W), crossprod(PW, y)))
cbind(
  value = c(
    OLS = coef(ols)[["educ"]],
    reduced_form_over_first_stage = coef(reduced_form)[["nearc4"]] / coef(first_stage)[["nearc4"]],
    second_stage = coef(second_stage)[["educ_hat"]],
    matrix_formula = beta[["educ"]]
  )
)
                                   value
OLS                           0.07469326
reduced_form_over_first_stage 0.13150384
second_stage                  0.13150384
matrix_formula                0.13150384

The three ways give the same 0.132. Least squares gave 0.075.

Step 5: the standard error

The second regression gives the right coefficient and a wrong standard error: its residuals are measured from \(\hat s\) instead of \(s\). The right ones use the real schooling:

\[e = y - W\hat\beta, \qquad \text{Var}(\hat\beta) = \frac{e^\top e}{n - p}\,(W^\top P_Z W)^{-1}\]

Code
e  <- drop(y - W %*% beta); s2 <- sum(e^2) / (nrow(W) - ncol(W))
se <- sqrt(diag(s2 * solve(crossprod(PW))))
iv <- ivreg(fml("lwage", paste("educ +", controls, "| nearc4 +", controls)), data = card)
rbind(
  by_hand = c(estimate = beta[["educ"]], SE = se[["educ"]]),
  ivreg = coef(summary(iv))["educ", 1:2],
  second_stage_lm = coef(summary(second_stage))["educ_hat", 1:2]
)
                 estimate         SE
by_hand         0.1315038 0.05496367
ivreg           0.1315038 0.05496367
second_stage_lm 0.1315038 0.05651035
Code
robust_se <- sqrt(sandwich::vcovHC(iv, type = "HC1")["educ", "educ"]); c(robust_SE = robust_se)
 robust_SE 
0.05414362 

Here the wrong standard error happens to be close to the right one. It can be far off, in both directions. In ivreg(), the part after | lists the instruments and all controls again.


4. Reading the output

Code
ci_iv <- confint(iv)["educ", ]; s_iv <- summary(iv)
round(
  rbind(
    OLS = c(coef(summary(ols))["educ", ], confint(ols)["educ", ]),
    IV = c(coef(s_iv)["educ", ], ci_iv)
  ),
  4
)
    Estimate Std. Error t value Pr(>|t|)  2.5 % 97.5 %
OLS   0.0747     0.0035 21.3510   0.0000 0.0678 0.0816
IV    0.1315     0.0550  2.3926   0.0168 0.0237 0.2393
Code
s_iv$diagnostics
                 df1  df2 statistic      p-value
Weak instruments   1 2994 13.255785 0.0002763401
Wu-Hausman         1 2993  1.167645 0.2799726211
Sargan             0   NA        NA           NA
  • The IV estimate says that a year of schooling raises the wage by 0.132 (about 14%), 95% CI [0.024, 0.239]. Least squares says 0.075 (7.8%).
  • The interval of IV is 15.7 times as wide. That is the price. IV uses only the little variation of schooling that comes from the instrument. With the partial correlation \(r\) between instrument and schooling, the SE grows by about \(1/|r|\); here \(r\) = 0.066.
  • The IV estimate is higher than that of least squares. If able men stay longer in school, we expected the opposite. Section 6 comes back to this.

The numbers are those of Card’s own Table 3: 0.320 (0.088) for the first stage, 0.042 (0.018) for the reduced form and 0.132 (0.055) for the IV estimate. The three tests of the output, by hand:

Code
fs_without <- update(first_stage, . ~ . - nearc4)
# weak instruments: the F of the instrument in the first stage
F_first <- anova(fs_without, first_stage)[2, "F"]
card$v_hat <- residuals(first_stage)
# Wu-Hausman: the first-stage residual as an extra predictor
wu <- coef(summary(update(ols, . ~ . + v_hat)))["v_hat", ]
# two instruments
iv2 <- ivreg(fml("lwage", paste("educ +", controls, "| nearc2 + nearc4 +", controls)), data = card)
# Sargan: n R^2 of the IV residuals on all instruments
aux <- lm(fml("residuals(iv2)", paste("nearc2 + nearc4 +", controls)), card)
c(
  F_first_stage = F_first,
  F_Wu_Hausman = wu[["t value"]]^2,
  Sargan_two_instruments = nrow(card) * summary(aux)$r.squared
)
         F_first_stage           F_Wu_Hausman Sargan_two_instruments 
             13.255785               1.167645               1.248153 
Code
summary(iv2)$diagnostics; coef(summary(iv2))["educ", 1:2]
                 df1  df2 statistic      p-value
Weak instruments   2 2993  7.893096 0.0003811364
Wu-Hausman         1 2993  2.925645 0.0872860158
Sargan             1   NA  1.248153 0.2639054547
  Estimate Std. Error 
0.15705937 0.05257824 
Code
sargan <- summary(iv2)$diagnostics["Sargan", ]
weak2 <- summary(iv2)$diagnostics["Weak instruments", ]
  • Weak instruments: the F of the instrument in the first stage, here 13.3. More about it in section 5.
  • Wu–Hausman: is the IV estimate different from least squares? Put the first-stage residual into the wage equation; if it matters, schooling is endogenous. Here F = 1.17, p = .280: the data cannot tell the two apart. That does not prove that least squares is right; the IV estimate is just imprecise.
  • Sargan: with more instruments than needed one can check whether they tell the same story. With the two-year college as second instrument the estimate is 0.157 and the test has p = .264: no contradiction. But two instruments of the same kind can be wrong in the same way, and then the test does not notice. (The F for both together is 7.9: the second one adds almost nothing.)

5. Weak instruments

If the instrument hardly moves schooling, the estimator divides by a number near zero. The estimates jump around, and the usual interval (estimate ± 1.96 SE) can be wrong. A simulation where we know the truth (β = 0.08). pi is the effect of the instrument on schooling, rho the endogeneity: the correlation between what we do not see in schooling and what we do not see in wages.

Code
set.seed(211)
one <- function(pi, rho, n = 1000) {
  z <- rep(0:1, length.out = n)
  u <- rnorm(n)
  s <- 12 + pi * z + 2 * (rho * u + sqrt(1 - rho^2) * rnorm(n))
  y <- 0.08 * s + 0.4 * u
  zc <- z - mean(z)
  fs <- sum(zc * s) / sum(zc^2)
  rf <- sum(zc * y) / sum(zc^2)
  b <- rf / fs
  e <- (y - mean(y)) - b * (s - mean(s))
  se <- sqrt(sum(e^2) / (n - 2) / sum(zc^2)) / abs(fs)
  F <- fs^2 * sum(zc^2) / (sum(((s - mean(s)) - fs * zc)^2) / (n - 2))
  d <- (y - mean(y)) - 0.08 * (s - mean(s))
  g <- sum(zc * d) / sum(zc^2)
  ar <- g / sqrt(sum((d - g * zc)^2) / (n - 2) / sum(zc^2)) # Anderson-Rubin at the truth
  c(
    iv = b,
    ols = cov(s, y) / var(s),
    F = F,
    covered = abs(b - 0.08) < 1.96 * se,
    ar_covered = abs(ar) < 1.96
  )
}
settings <- expand.grid(pi = c(0.1, 0.25, 0.5, 1), rho = c(0.6, 0.95))
sim <- do.call(
  rbind,
  lapply(seq_len(nrow(settings)), function(i) {
    r <- t(replicate(2000, one(settings$pi[i], settings$rho[i])))
    data.frame(
      settings[i, ],
      mean_F = mean(r[, "F"]),
      OLS = mean(r[, "ols"]),
      IV_median = median(r[, "iv"]),
      IV_low = quantile(r[, "iv"], 0.05),
      IV_high = quantile(r[, "iv"], 0.95),
      coverage = mean(r[, "covered"]),
      coverage_AR = mean(r[, "ar_covered"])
    )
  })
)
print(round(sim, 3), row.names = FALSE)
   pi  rho mean_F   OLS IV_median IV_low IV_high coverage coverage_AR
 0.10 0.60  1.760 0.200     0.147 -0.820   0.911    0.954       0.946
 0.25 0.60  4.963 0.200     0.084 -0.323   0.232    0.942       0.944
 0.50 0.60 16.762 0.198     0.082 -0.040   0.150    0.948       0.954
 1.00 0.60 63.829 0.193     0.081  0.031   0.118    0.954       0.951
 0.10 0.95  1.649 0.270     0.163 -0.616   0.994    0.791       0.954
 0.25 0.95  4.984 0.269     0.083 -0.465   0.183    0.890       0.954
 0.50 0.95 16.229 0.267     0.078 -0.061   0.138    0.938       0.948
 1.00 0.95 63.174 0.259     0.079  0.027   0.114    0.955       0.954
Code
si <- function(p, r) sim[sim$pi == p & sim$rho == r, ]
c(endogeneity_in_the_data_of_Card = cor(residuals(iv), residuals(first_stage)))
endogeneity_in_the_data_of_Card 
                     -0.2851473 
  • Least squares gives about 0.20 with an endogeneity of 0.6 and 0.27 with 0.95, instead of 0.08, whatever the instrument.
  • With a strong instrument (mean F = 63.8) the IV estimates lie around 0.08.
  • With the weakest one (mean F = 1.8) the median of the IV estimates is 0.15 or 0.16: it has moved towards least squares. And 90% of the estimates lie between -0.82 and 0.91 (endogeneity 0.6).
  • The usual interval contains the truth in 94% to 95% of the samples with an endogeneity of 0.6, even with weak instruments. It is right there, and very wide. With 0.95 its coverage falls to 79% for the weakest instrument.

This is why the advice in the literature looks contradictory. An old rule asks for F > 10 (Staiger & Stock, 1997). Lee et al. (2022) show that a t test with the usual 1.96 needs an F above 104.7 to have an error of at most 5% in the worst case. Angrist and Kolesár (2024) show that with one instrument the usual interval is nearly right unless the endogeneity is extreme. Card’s instrument has an F of 13.3, and the estimated endogeneity is -0.29. It is best to use an interval that does not depend on all this:

The Anderson–Rubin interval

A test that works with any strength (Anderson & Rubin, 1949): if the true effect were \(\beta_0\), then \(y - \beta_0 s\) would contain nothing of schooling, and the instrument should not predict it. Test that for many \(\beta_0\) and keep those that are not rejected. In the simulation it has the right coverage in all settings (from 94.3% to 95.4%).

Code
ar_p <- function(b0) {
  r <- lm(fml(paste0("I(lwage - ", b0, " * educ)"), paste("nearc4 +", controls)), card)
  coef(summary(r))["nearc4", 4]
}
grid  <- seq(-0.05, 0.4, by = 0.005); p_grid <- sapply(grid, ar_p)
edge  <- function(a, b) uniroot(function(v) ar_p(v) - 0.05, c(a, b))$root
ci_ar <- c(edge(-0.05, beta[["educ"]]), edge(beta[["educ"]], 0.5))
rbind(Wald = ci_iv, Anderson_Rubin = ci_ar)
                    2.5 %    97.5 %
Wald           0.02373345 0.2392742
Anderson_Rubin 0.02480370 0.2848301
Code
ggplot(data.frame(grid, p_grid), aes(grid, p_grid)) +
  geom_line(colour = "#2a78d6", linewidth = 0.9) +
  geom_hline(yintercept = 0.05, linetype = "dashed") +
  geom_vline(xintercept = coef(ols)[["educ"]], colour = "#eb6834") +
  annotate(
    "text",
    x = coef(ols)[["educ"]] - 0.005,
    y = 0.95,
    label = "least squares",
    hjust = 1,
    colour = "#eb6834",
    size = 3.6
  ) +
  labs(
    title = "Anderson-Rubin: p-value of every possible effect",
    subtitle = "Values above the dashed line (.05) form the 95% interval",
    x = "effect of a year of schooling on the log wage",
    y = "p"
  ) +
  theme_bw()

The Anderson–Rubin interval

The interval goes from 0.025 to 0.285. It is longer than the usual one on the upper side, and it contains the result of least squares.


6. Whose effect is it?

Card’s result (IV higher than OLS) is typical for this literature. One explanation is that the effect is not the same for everybody. Boys who would go to college anyway, and boys who would never go, are not moved by the instrument. IV is about the others, the compliers. Imbens and Angrist (1994) called it the local average treatment effect (LATE). If those who are held back by cost gain more from school than the average, the IV estimate is higher, and it is right, for them.

Where on the ladder did the instrument push? Schooling is the sum of steps, \(s = \sum_k I(s \ge k)\), so the first stage can be split into steps:

Code
steps <- data.frame(k = 8:18); steps$effect <- steps$se <- NA
for (i in seq_along(steps$k)) {
  co <- coef(summary(lm(
    fml(paste0("I(educ >= ", steps$k[i], ")"), paste("nearc4 +", controls)),
    card
  )))["nearc4", ]
  steps$effect[i] <- co[1]
  steps$se[i] <- co[2]
}
ggplot(steps, aes(k, effect)) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  geom_linerange(aes(ymin = effect - 1.96 * se, ymax = effect + 1.96 * se), colour = "#2a78d6") +
  geom_point(colour = "#2a78d6", size = 2.4) +
  scale_x_continuous(breaks = 8:18) +
  labs(
    title = "Effect of a college nearby on reaching at least k years",
    x = "years of schooling, k",
    y = "change in the share of men"
  ) +
  theme_bw()

Steps chart – 6. Whose effect is it?

Code
all_steps <- sum(sapply((min(card$educ) + 1):max(card$educ), function(k) {
  coef(lm(fml(paste0("I(educ >= ", k, ")"), paste("nearc4 +", controls)), card))[["nearc4"]]
}))
c(sum_over_all_steps = all_steps, first_stage = coef(first_stage)[["nearc4"]])
sum_over_all_steps        first_stage 
         0.3198989          0.3198989 
Code
top <- steps[which.max(steps$effect), ]

The sum of the steps is the first stage, 0.32 years. The largest step is at 13 years (6.4 percentage points more men reach it). So the estimate is about boys who were near the decision for or against some college, and not about the value of the tenth year of school.

Other explanations are less flattering: measurement error in schooling pulls least squares down, the instrument may be invalid, and studies with a “significant” IV result are more easily published.


7. Can we believe the conditions?

Does the instrument predict what it should not?

Independence cannot be tested, since \(u\) is not observed. But we can check some things that the instrument should not be related to, after the controls (with age instead of experience, because experience contains schooling):

Code
controls_age <- sub("exper + expersq", "age + I(age^2)", controls, fixed = TRUE)
check_vars <- c(
  fatheduc = "father's schooling",
  motheduc = "mother's schooling",
  momdad14 = "lived with both parents at 14",
  libcrd14 = "library card at home at 14",
  IQ = "IQ (from school records)",
  KWW = "knowledge of the world of work"
)
balance <- do.call(
  rbind,
  lapply(names(check_vars), function(v) {
    m <- lm(fml(v, paste("nearc4 +", controls_age)), card)
    co <- coef(summary(m))["nearc4", ]
    data.frame(
      variable = check_vars[[v]],
      raw_difference = mean(card[[v]][card$nearc4 == 1], na.rm = TRUE) -
        mean(card[[v]][card$nearc4 == 0], na.rm = TRUE),
      with_controls = co[1],
      SE = co[2],
      p = co[4],
      n = nobs(m)
    )
  })
)
print(data.frame(balance[1], round(balance[2:5], 3), n = balance$n), row.names = FALSE)
                       variable raw_difference with_controls    SE     p    n
             father's schooling          1.135         0.280 0.177 0.113 2320
             mother's schooling          0.594        -0.016 0.144 0.913 2657
  lived with both parents at 14          0.001        -0.022 0.018 0.210 3010
     library card at home at 14          0.183         0.044 0.019 0.022 2997
       IQ (from school records)          2.596         0.904 0.752 0.229 2061
 knowledge of the world of work          2.974         0.756 0.315 0.016 2963

The controls remove most of the raw differences. What is left is small, but not nothing: 2 of the 6 have p < .05 (library card at home at 14 and knowledge of the world of work). (The last one was measured in 1966, when the men were 14 to 24 years old and a part of them had already left school, so it may partly be an effect of schooling.) Boys near a college seem to come from homes with a few more books.

Card’s own test

Card argued like this. A college nearby should matter most to boys from poor families, for whom the cost decides. So the product of “college nearby” and “parents without high school” can be the instrument, and then “college nearby” itself may go into the wage equation. If it has a direct effect on wages, it will show there. In his Table 5 the IV estimate is 0.093 (0.065) and the direct effect 0.015 (0.029). His classes of parental education are not in our file, but we can build something like them. As he did in this table, we treat experience as endogenous, with age as its instrument (the last part of this section says why):

Code
card$fa <- ifelse(is.na(card$fatheduc), mean(card$fatheduc, na.rm = TRUE), card$fatheduc)
card$mo <- ifelse(is.na(card$motheduc), mean(card$motheduc, na.rm = TRUE), card$motheduc)
card$fa_missing <- as.numeric(is.na(card$fatheduc))
card$mo_missing <- as.numeric(is.na(card$motheduc))
family <- "fa * mo + fa_missing + mo_missing + momdad14 + sinmom14 + step14"
low_defs <- list(
  `no parent known to have 12 years` = with(
    card,
    (is.na(fatheduc) | fatheduc < 12) & (is.na(motheduc) | motheduc < 12)
  ),
  `both known, both below 12 years` = with(
    card,
    !is.na(fatheduc) & !is.na(motheduc) & fatheduc < 12 & motheduc < 12
  )
)
card_test <- do.call(
  rbind,
  lapply(names(low_defs), function(k) {
    card$low <- as.numeric(low_defs[[k]])
    rest <- sub("exper + expersq", "low", controls, fixed = TRUE)
    first <- lm(fml("educ", paste("nearc4 * low + age + I(age^2) +", rest, "+", family)), card)
    m <- ivreg(
      fml(
        "lwage",
        paste(
          "educ + nearc4 + exper + expersq +",
          rest,
          "+",
          family,
          "| nearc4:low + nearc4 + age + I(age^2) +",
          rest,
          "+",
          family
        )
      ),
      data = card
    )
    data.frame(
      parents = k,
      n_low = sum(card$low),
      college_effect_others = coef(first)[["nearc4"]],
      extra_for_low = coef(first)[["nearc4:low"]],
      SE_extra = coef(summary(first))["nearc4:low", 2],
      IV = coef(m)[["educ"]],
      SE_IV = coef(summary(m))["educ", 2],
      direct_effect = coef(m)[["nearc4"]],
      SE_direct = coef(summary(m))["nearc4", 2]
    )
  })
)
tab <- t(round(card_test[-(1:2)], 3))
colnames(tab) <- card_test$parents
tab
                      no parent known to have 12 years both known, both below 12 years
college_effect_others                            0.187                           0.385
extra_for_low                                    0.339                          -0.107
SE_extra                                         0.180                           0.199
IV                                               0.133                           0.119
SE_IV                                            0.093                           0.391
direct_effect                                   -0.001                           0.004
SE_direct                                        0.038                           0.140

With the first definition (1,431 men with less educated parents) the picture is the one of Card: the college matters more for the sons of less educated parents (0.19 years for the others, 0.34 more for them), the IV estimate is 0.133 (SE 0.093), and the direct effect is -0.001 (SE 0.038). With the second definition (815 men) the extra effect has the wrong sign, and nothing can be estimated (SE of the IV estimate 0.39). The test says what Card wrote himself: “although imprecise”, there is no evidence against the instrument. That is not the same as evidence for it.

How large a violation would change the answer?

Suppose that growing up near a college raises wages directly by \(\gamma\) (better labor market, better schools). Then the right estimate would be

\[\hat\beta(\gamma) = \frac{\text{reduced form} - \gamma}{\text{first stage}}\]

(Conley et al., 2012, develop this idea.)

Code
rf <- coef(reduced_form)[["nearc4"]]; fs <- coef(first_stage)[["nearc4"]]
gamma <- seq(0, 0.06, length.out = 100)
g_ols <- rf - coef(ols)[["educ"]] * fs
ggplot(data.frame(gamma, b = (rf - gamma) / fs), aes(gamma, b)) +
  geom_line(colour = "#2a78d6", linewidth = 1) +
  geom_hline(yintercept = coef(ols)[["educ"]], colour = "#eb6834") +
  geom_hline(yintercept = 0, linetype = "dashed") +
  annotate(
    "text",
    x = 0.058,
    y = coef(ols)[["educ"]] + 0.008,
    label = "least squares",
    hjust = 1,
    colour = "#eb6834",
    size = 3.6
  ) +
  labs(
    title = "IV estimate, if the instrument also had a direct effect on wages",
    x = "direct effect of a college nearby on the log wage",
    y = "effect of a year of schooling"
  ) +
  theme_bw()

Sensitivity chart – How large a violation would change the answer?

Code
cbind(
  value = c(
    reduced_form = rf,
    first_stage = fs,
    gamma_for_the_OLS_result = g_ols,
    gamma_for_zero = rf
  )
)
                              value
reduced_form             0.04206794
first_stage              0.31989894
gamma_for_the_OLS_result 0.01817364
gamma_for_zero           0.04206794

A direct effect of only 1.8% on wages would bring the estimate down to the one of least squares, and one of 4.2% to zero. Because IV divides by a small first stage, small violations become large errors. And nobody can rule out a direct effect of 2%.

A control that is not innocent

exper is age − schooling − 6. It contains schooling, the very variable that we consider endogenous. Two remedies: use age instead of experience, or treat experience as endogenous too and use age as its instrument. Card did the second in his panel B of Table 3 and found 0.122 (0.046):

Code
iv_age <- ivreg(
  fml("lwage", paste("educ +", controls_age, "| nearc4 +", controls_age)),
  data = card
)
iv_exper <- ivreg(fml("lwage", paste("educ +", controls, "| nearc4 +", controls_age)), data = card)
ols_age  <- lm(fml("lwage", paste("educ +", controls_age)), card)
alt <- rbind(
  `OLS, experience` = coef(summary(ols))["educ", 1:2],
  `IV, experience as in Card` = coef(summary(iv))["educ", 1:2],
  `OLS, age` = coef(summary(ols_age))["educ", 1:2],
  `IV, age` = coef(summary(iv_age))["educ", 1:2],
  `IV, experience instrumented by age` = coef(summary(iv_exper))["educ", 1:2]
)
F_age <- summary(iv_age)$diagnostics["Weak instruments", "statistic"]
round(alt, 3); c(first_stage_F_with_age = F_age)
                                   Estimate Std. Error
OLS, experience                       0.075      0.003
IV, experience as in Card             0.132      0.055
OLS, age                              0.034      0.003
IV, age                               0.083      0.046
IV, experience instrumented by age    0.122      0.046
first_stage_F_with_age 
              11.89729 

The last row gives his number. With age, the first stage is weaker (F = 11.9), and the IV estimate is 0.083 (SE = 0.046). At a given age, a man with one more year of school has one year less experience, so the two versions do not measure the same thing: with experience held constant the coefficient is larger by the value of that year of work. The choice must be made by the question, and reported.


8. Things to keep in mind

  • The instrument is an argument, not a statistic. Write down why it should be independent, and why there is no other way to the outcome.
  • Always show the first stage, the reduced form and the OLS result next to the IV result. The reduced form is an ordinary regression: if you cannot see the effect there, it is probably not there (Angrist & Krueger, 2001).
  • Weak instruments: report the (robust) first-stage F and an Anderson–Rubin interval. Many weak instruments are worse than one good one: 2SLS then moves towards OLS. (LIML is better.)
  • Do not put fitted values from a logistic first stage into a second regression. 2SLS wants linear first stages, also for a 0/1 treatment.
  • All controls belong in both stages.
  • Standard errors: use ivreg(), not the second lm(); robust or clustered by the unit to which the instrument belongs (here the county, which is not in the file).
  • LATE: the estimate is for those whom the instrument moved.
  • Measurement error in the predictor is another reason to use IV: a second, independent measurement is an instrument for the first. (With known error variances, see Deming regression.)
  • Relatives: regression with selection uses the same kind of exclusion; panel data removes what is constant over time without any instrument.

9. Reporting the results in APA style

A report (APA 7th edition) needs the instrument and the argument for it, the controls, the first stage with its F, the reduced form, OLS and IV with standard errors, a weak-instrument-robust interval, and the group to which the estimate refers. The numbers come from the R objects:

Code
row <- function(m, term) { co <- coef(summary(m))[term, ]; c(f3(co[1]), f3(co[2])) }
apa_table <- data.frame(
  Regression = c(
    "First stage (years of schooling on college nearby)",
    "Reduced form (log wage on college nearby)", "Log wage on schooling, OLS",
    "Log wage on schooling, 2SLS", "Log wage on schooling, 2SLS, two instruments"
  ),
  rbind(
    row(first_stage, "nearc4"),
    row(reduced_form, "nearc4"),
    row(ols, "educ"),
    row(iv, "educ"),
    row(iv2, "educ")
  )
)
names(apa_table) <- c("Regression", "b", "SE")
apa_table$CI <- c(apply(
  rbind(
    confint(first_stage)["nearc4", ],
    confint(reduced_form)["nearc4", ],
    confint(ols)["educ", ],
    ci_iv,
    confint(iv2)["educ", ]
  ),
  1,
  function(v) paste0("[", f3(v[1]), ", ", f3(v[2]), "]")
))

Method (data analysis):

The return to schooling was estimated for 3,010 men of the National Longitudinal Survey of Young Men (log hourly wage in 1976; Card, 1993). Because unobserved ability and family background may influence both schooling and wages, schooling was instrumented with the presence of a four-year college in the local labor market of residence in 1966, which lowered the cost of college for boys who could live at home. All models contained experience, experience squared, and indicators for black, residence in the south, metropolitan residence in 1966 and 1976, and region in 1966. Two-stage least squares was used (R package ivreg); the strength of the instrument was judged with the first-stage F, and a 95% Anderson–Rubin interval (Anderson & Rubin, 1949) was computed because it is valid with weak instruments. Endogeneity was tested with the Wu–Hausman test, and the robustness of the result to a direct effect of the instrument was examined (Conley et al., 2012). Analyses were conducted in R (Version 4.6.2; R Core Team, 2026).

Results:

After adjustment for the controls, men who grew up near a college had 0.32 more years of schooling (SE = 0.09, F(1, 2,994) = 13.3, p < .001) and 4.3% higher wages (log wage: b = 0.042, SE = 0.018, p = .020; Table 1). The two-stage least squares estimate of the effect of one year of schooling on the log wage was b = 0.132 (SE = 0.055, p = .017), 95% Anderson–Rubin CI [0.025, 0.285], compared with 0.075 (SE = 0.003) with ordinary least squares. The Wu–Hausman test did not distinguish the two, F(1, 2,993) = 1.17, p = .280. A direct effect of the instrument of 1.8% on wages would suffice to reduce the estimate to that of least squares.

Table 1

Schooling and Log Wages of 3,010 Young Men, With a College Nearby as Instrument

Regression b SE 95% CI
First stage (years of schooling on college nearby) 0.320 0.088 [0.148, 0.492]
Reduced form (log wage on college nearby) 0.042 0.018 [0.007, 0.078]
Log wage on schooling, OLS 0.075 0.003 [0.068, 0.082]
Log wage on schooling, 2SLS 0.132 0.055 [0.024, 0.239]
Log wage on schooling, 2SLS, two instruments 0.157 0.053 [0.054, 0.260]

Note. All models contain the controls named in the text. The confidence intervals are the usual ones; the Anderson–Rubin interval for the fourth row is [0.025, 0.285]. Two instruments: four-year and two-year college nearby (Sargan test p = .264).

Points to remember:

  • Argue for the instrument before showing numbers.
  • Report the first stage, the reduced form, OLS and IV together.
  • Give the first-stage F and an interval that is valid for weak instruments.
  • Say for whom the estimate holds, and how large a violation would change it.

10. Summary

When A predictor is related to something unseen that also affects the outcome, and there is a source of variation that is not
Conditions Relevance (testable), independence, exclusion (not testable), monotonicity
One 0/1 instrument Difference in the outcome, divided by the difference in the predictor
In general Two-stage least squares, \(\hat\beta = (W^\top P_Z W)^{-1}W^\top P_Z y\)
How (R) ivreg(y ~ x + controls | z + controls); also fixest::feols()
Check First-stage F, Wu–Hausman, Sargan (with extra instruments), balance, sensitivity
Interval Anderson–Rubin when the instrument is not very strong
Meaning The effect for those whom the instrument moved (LATE)
Related pages Simple regression, selection models, panel data

References

Anderson, T. W., & Rubin, H. (1949). Estimation of the parameters of a single equation in a complete system of stochastic equations. The Annals of Mathematical Statistics, 20(1), 46–63. https://doi.org/10.1214/aoms/1177730090

Angrist, J., & Kolesár, M. (2024). One instrument to rule them all: The bias and coverage of just-ID IV. Journal of Econometrics, 240(2), Article 105398. https://doi.org/10.1016/j.jeconom.2022.12.012

Angrist, J. D., & Krueger, A. B. (2001). Instrumental variables and the search for identification: From supply and demand to natural experiments. Journal of Economic Perspectives, 15(4), 69–85. https://doi.org/10.1257/jep.15.4.69

Card, D. (1993). Using geographic variation in college proximity to estimate the return to schooling (NBER Working Paper No. 4483). National Bureau of Economic Research. https://doi.org/10.3386/w4483

Conley, T. G., Hansen, C. B., & Rossi, P. E. (2012). Plausibly exogenous. Review of Economics and Statistics, 94(1), 260–272. https://doi.org/10.1162/REST_a_00139

Imbens, G. W., & Angrist, J. D. (1994). Identification and estimation of local average treatment effects. Econometrica, 62(2), 467–475. https://doi.org/10.2307/2951620

Lee, D. S., McCrary, J., Moreira, M. J., & Porter, J. (2022). Valid t-ratio inference for IV. American Economic Review, 112(10), 3260–3290. https://doi.org/10.1257/aer.20211063

Staiger, D., & Stock, J. H. (1997). Instrumental variables regression with weak instruments. Econometrica, 65(3), 557–586. https://doi.org/10.2307/2171753