{
  "id": "two-stage-least-squares",
  "title": "Two-Stage Least Squares",
  "lang": "en",
  "source_lang": "en",
  "summary": "Two-stage least squares is an instrumental-variable method for estimating linear regression models when explanatory variables are correlated with the error term.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "2SLS",
    "TSLS",
    "Two-stage least-squares estimation"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/two-stage-least-squares/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/two-stage-least-squares/",
      "json": "https://aiwiki.page/zh/two-stage-least-squares.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Two-stage least squares (2SLS) is an instrumental-variable method for estimating the coefficients of a linear regression model when one or more explanatory variables are correlated with the model’s error term. It first projects the explanatory variables onto a set of instruments, then regresses the outcome on the resulting fitted values. Under valid instrument assumptions and suitable regularity conditions, it yields consistent coefficient estimates even when ordinary least squares (OLS) does not. It is widely used in econometrics, particularly in models involving simultaneous determination, omitted variables, or measurement error."
    },
    {
      "heading": "The problem addressed",
      "text": "Consider the structural equation\n\n\\[y_i=x_i^\\top\\beta+u_i,\\]\n\nwhere \\(y_i\\) is an outcome, \\(x_i\\) is a vector of explanatory variables, \\(\\beta\\) is the coefficient vector, and \\(u_i\\) is an unobserved error. An intercept can be included as a component of \\(x_i\\).\n\nOLS generally requires the population orthogonality condition\n\n\\[\\mathbb E[x_i u_i]=0\\]\n\nfor consistency, along with identification and regularity conditions. When this condition fails, the model exhibits endogeneity. For example:\n\n- An omitted determinant of the outcome may also influence an explanatory variable.\n- The outcome and an explanatory variable may be jointly determined, as with price and quantity in a market.\n- Measurement error in an explanatory variable may induce correlation with the regression error.\n\nIn such cases, increasing the sample size does not generally make OLS recover the structural coefficient.\n\n2SLS instead uses a vector of instruments \\(z_i\\) satisfying\n\n\\[\\mathbb E[z_i u_i]=0.\\]\n\nThe instruments must also predict the explanatory variables sufficiently to identify their coefficients. The method therefore replaces variation contaminated by endogeneity with variation associated with valid instruments."
    },
    {
      "heading": "Model and instrument requirements",
      "text": "Write the sample model as\n\n\\[y=X\\beta+u,\\]\n\nwhere \\(y\\) is \\(n\\times1\\), \\(X\\) is \\(n\\times k\\), and the instrument matrix \\(Z\\) is \\(n\\times\\ell\\).\n\nIt is often useful to partition the regressors as\n\n\\[X=[W\\;\\;D],\\qquad Z=[W\\;\\;Q],\\]\n\nwhere \\(W\\) contains included exogenous regressors, \\(D\\) contains endogenous regressors, and \\(Q\\) contains excluded instruments. Included exogenous regressors ordinarily serve as instruments for themselves.\n\nThree requirements are central.\n\nInstrument exogeneity\n\nThe instruments must satisfy the orthogonality condition \\(\\mathbb E[z_i u_i]=0\\). A stronger condition, often used in derivations, is \\(\\mathbb E[u_i\\mid z_i]=0\\).\n\nIn a structural causal model, excluded instruments must also satisfy an exclusion restriction: they must not affect the outcome through channels outside the specified equation. Exclusion and instrument exogeneity are conceptually distinct, although both support the validity of the instrumental-variable moment conditions.\n\nRelevance and rank\n\nThe population matrix\n\n\\[\\mathbb E[z_i x_i^\\top]\\]\n\nmust have column rank \\(k\\). This is a identification condition: instruments must provide enough distinct variation to distinguish all coefficients.\n\nThe order condition \\(\\ell\\geq k\\) is necessary but not sufficient. Equivalently, the number of excluded instruments must be at least the number of endogenous regressors. Merely counting instruments does not establish the required rank.\n\nRegularity conditions\n\nConsistency and conventional large-sample inference also require appropriate sampling assumptions, moment conditions, and nonsingular population matrices. For time-series or clustered observations, assumptions must account for dependence.\n\nInstrument validity is not established simply by observing a strong first-stage relationship. A highly predictive instrument can still be invalid if it is associated with omitted determinants of the outcome."
    },
    {
      "heading": "The two stages",
      "text": "First stage: project regressors onto instruments\n\nRegress each endogenous explanatory variable on the full instrument set, including all included exogenous regressors. In matrix notation, the fitted regressor matrix is\n\n\\[\\widehat X=P_ZX, \\qquad P_Z=Z(Z^\\top Z)^{-1}Z^\\top,\\]\n\nassuming \\(Z\\) has full column rank.\n\nThe matrix \\(P_Z\\) is the orthogonal projection onto the column space of \\(Z\\). Because included exogenous regressors already belong to that space, their fitted values equal their observed values.\n\nThe first stage need not correctly specify the full conditional expectation of each endogenous regressor. The standard estimator uses a linear projection; its consistency follows from valid moment conditions and identification.\n\nSecond stage: regress the outcome on fitted regressors\n\nRegress \\(y\\) on \\(\\widehat X\\). The resulting coefficient estimate is\n\n\\[\\widehat\\beta_{\\mathrm{2SLS}} = (\\widehat X^\\top\\widehat X)^{-1}\\widehat X^\\top y = (X^\\top P_ZX)^{-1}X^\\top P_Zy.\\]\n\nThis is the defining 2SLS formula.\n\nThe two-stage description explains the coefficient calculation, but ordinary OLS standard errors from a manually executed second stage are generally incorrect. Inference must use the instrumental-variable covariance calculation."
    },
    {
      "heading": "Interpretation and special cases",
      "text": "One regressor and one instrument\n\nWith an intercept, one endogenous regressor \\(x_i\\), and one excluded instrument \\(z_i\\), the slope estimate is\n\n\\[\\widehat\\beta_{\\mathrm{IV}} = \\frac{\\sum_i(z_i-\\bar z)(y_i-\\bar y)} {\\sum_i(z_i-\\bar z)(x_i-\\bar x)}.\\]\n\nThus, the estimate is the sample instrument–outcome covariance divided by the instrument–regressor covariance.\n\nFor a binary instrument, this becomes the Wald ratio:\n\n\\[\\widehat\\beta_{\\mathrm{IV}} = \\frac{\\bar y_{z=1}-\\bar y_{z=0}} {\\bar x_{z=1}-\\bar x_{z=0}}.\\]\n\nIts causal interpretation requires assumptions beyond the algebraic identity.\n\nExact identification and overidentification\n\nIf \\(\\ell=k\\) and \\(Z^\\top X\\) is invertible, the model is exactly identified, and\n\n\\[\\widehat\\beta_{\\mathrm{2SLS}} = (Z^\\top X)^{-1}Z^\\top y.\\]\n\nIf \\(\\ell>k\\), the model is overidentified. The estimator combines more instrument moment conditions than there are coefficients.\n\nIf \\(Z=X\\), then \\(P_ZX=X\\), and 2SLS reduces to OLS.\n\nGeometric interpretation\n\n2SLS uses only the component of each regressor lying in the space spanned by the instruments. It is not, in general, the minimizer of the original residual sum of squares \\((y-X\\beta)^\\top(y-X\\beta)\\). Instead, it minimizes\n\n\\[(y-X\\beta)^\\top P_Z(y-X\\beta).\\]\n\nThis distinction explains why an instrumental-variable regression need not share familiar OLS goodness-of-fit properties. In particular, a coefficient of determination calculated from structural residuals can be negative."
    },
    {
      "heading": "Consistency and statistical inference",
      "text": "Define\n\n\\[Q_{XZ}=\\mathbb E[x_i z_i^\\top], \\qquad Q_{ZZ}=\\mathbb E[z_i z_i^\\top].\\]\n\nUnder valid instruments, identification, and suitable laws of large numbers, the 2SLS estimator is a consistent estimator of \\(\\beta\\). With sufficiently strong identification and conditions supporting a central limit theorem,\n\n\\[\\sqrt n(\\widehat\\beta_{\\mathrm{2SLS}}-\\beta) \\xrightarrow{d} N(0,V).\\]\n\nConsistency does not imply finite-sample unbiasedness. Indeed, finite-sample distributions can be highly irregular when instruments are weak.\n\nHomoskedastic covariance estimation\n\nUnder the conventional homoskedastic model,\n\n\\[\\operatorname{Var}(u\\mid Z)=\\sigma^2 I,\\]\n\nthe usual estimated asymptotic covariance matrix of the coefficient estimator is\n\n\\[\\widehat{\\operatorname{Var}} (\\widehat\\beta_{\\mathrm{2SLS}}) = \\widehat\\sigma^2(X^\\top P_ZX)^{-1}.\\]\n\nThe variance estimate must use the structural residuals\n\n\\[\\widehat u=y-X\\widehat\\beta_{\\mathrm{2SLS}},\\]\n\nnot the second-stage regression residuals \\(y-\\widehat X\\widehat\\beta_{\\mathrm{2SLS}}\\). A common degrees-of-freedom correction is \\(\\widehat\\sigma^2=\\widehat u^\\top\\widehat u/(n-k)\\).\n\nHeteroskedasticity and dependence\n\nFor independent observations with potentially unequal error variances, a heteroskedasticity-robust covariance estimator is\n\n\\[\\widehat V = A^{-1}X^\\top Z(Z^\\top Z)^{-1} \\left(\\sum_{i=1}^{n}z_i z_i^\\top\\widehat u_i^2\\right) (Z^\\top Z)^{-1}Z^\\top X A^{-1},\\]\n\nwhere \\(A=X^\\top P_ZX\\).\n\nCluster-robust or serial-correlation-robust versions replace the middle term with a corresponding estimator that accounts for dependence. Valid standard errors and confidence intervals depend on using a covariance estimator appropriate to the sampling structure."
    },
    {
      "heading": "Weak instruments and diagnostic tests",
      "text": "Weak identification\n\nWeak instruments have little predictive power for the endogenous regressors after accounting for included exogenous variables. The model may satisfy the population rank condition while remaining only weakly identified in a given sample.\n\nConsequences include:\n\n- Substantial finite-sample bias, often toward OLS in common settings.\n- Non-normal and heavy-tailed sampling distributions.\n- Unreliable conventional \\(t\\)-tests and confidence intervals.\n- Large sensitivity to small changes in observations or instruments.\n\nFirst-stage diagnostics assess the contribution of excluded instruments. With one endogenous regressor, the excluded-instrument \\(F\\)-statistic and partial \\(R^2\\) are common summaries. The frequently cited rule that a first-stage \\(F\\)-statistic should exceed 10 is a heuristic, not a universal guarantee of reliable inference. Multiple endogenous regressors, heteroskedasticity, and clustering require more specialized diagnostics.\n\nIdentification-robust methods, including Anderson–Rubin tests and certain conditional likelihood-ratio procedures, can provide valid inference in settings where conventional strong-instrument approximations fail.\n\nOveridentification tests\n\nOveridentified models permit tests of the joint instrument moment restrictions. Common examples are the Sargan test under homoskedasticity and robust Hansen-type tests.\n\nThese tests do not prove that instruments are valid. Failure to reject may reflect low power, while rejection can indicate invalid instruments or other misspecification of the structural equation. Exactly identified models have no overidentifying restrictions to test.\n\nEndogeneity tests\n\nDurbin–Wu–Hausman-type procedures compare OLS and instrumental-variable estimates, or use equivalent augmented regressions, to test regressor exogeneity. Their interpretation depends on the instruments being valid; weak instruments can also undermine conventional versions of these tests."
    },
    {
      "heading": "Relationship to generalized method of moments",
      "text": "2SLS is a special case of the generalized method of moments (GMM). Define\n\n\\[g_n(\\beta)=\\frac{1}{n}Z^\\top(y-X\\beta).\\]\n\nMinimizing\n\n\\[g_n(\\beta)^\\top \\left(\\frac{Z^\\top Z}{n}\\right)^{-1} g_n(\\beta)\\]\n\ngives the 2SLS estimator.\n\nUnder conditional homoskedasticity, this weighting is asymptotically efficient among GMM estimators using the same linear instrument moment conditions. Under heteroskedasticity, efficient GMM generally uses a different weighting matrix. Robust standard errors make 2SLS inference robust to heteroskedasticity under the relevant assumptions, but do not by themselves make the coefficient estimator efficient.\n\nRelated estimators include limited-information maximum likelihood and three-stage least squares. The latter can exploit cross-equation error covariances in systems of equations, but also imposes broader system-level assumptions."
    },
    {
      "heading": "Applications and causal interpretation",
      "text": "Common applications include estimating supply and demand equations, returns to education, effects of prices, and responses to policy changes. The method is also used with randomized encouragement designs, where assignment changes the probability of receiving a treatment without perfectly determining treatment receipt.\n\nA causal interpretation belongs to the underlying research design, not to the two-stage calculation alone. In a constant-coefficient structural model, valid instruments can identify the specified causal coefficient. When treatment effects vary across individuals, the estimand requires additional interpretation.\n\nFor a binary instrument and binary treatment, exclusion, instrument independence, relevance, and monotonicity can identify a local average treatment effect: the average effect for individuals whose treatment status changes in response to the instrument. This need not equal the average effect for the whole population. With multiple instruments or covariates, 2SLS can combine heterogeneous effects in ways that require further analysis."
    },
    {
      "heading": "Historical development and practical limitations",
      "text": "The modern development of 2SLS is associated with Henri Theil and Robert Basmann in the 1950s, within the study of simultaneous-equation models. It became a standard method for estimating individual structural equations without specifying and estimating an entire simultaneous system.\n\nIts central limitation remains the difficulty of finding credible instruments. Statistical diagnostics cannot substitute for a substantive account of why an instrument is excluded from the outcome equation and unrelated to its unobserved determinants.\n\nAdding instruments is not automatically beneficial. Numerous instruments can overfit first-stage relationships and distort finite-sample behavior. Standard asymptotic results typically assume a fixed number of instruments as sample size grows; settings with many instruments require separate analysis.\n\nFinally, 2SLS is a linear instrumental-variable estimator, not a general prescription for replacing endogenous variables by predictions in arbitrary models. Substituting first-stage fitted values into a nonlinear outcome model, such as logistic regression, is not generally a consistent analogue of linear 2SLS."
    }
  ],
  "links": [
    "instrumental-variables",
    "linear-regression",
    "ordinary-least-squares",
    "econometrics",
    "endogeneity",
    "matrix",
    "statistical-identification",
    "matrix-rank",
    "time-series",
    "orthogonal-projection",
    "conditional-expectation",
    "covariance",
    "coefficient-of-determination",
    "consistent-estimator",
    "central-limit-theorem",
    "standard-error",
    "confidence-interval",
    "generalized-method-of-moments"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}