- Introduced by
- John Driscoll & Aart Kraay
- Year
- 1998
- Type
- Nonparametric heteroskedasticity- and autocorrelation-consistent (HAC) covariance estimator for panel data
- Family
- Static panel
What does it do?
Driscoll-Kraay standard errors are a nonparametric, heteroskedasticity- and autocorrelation-consistent (HAC) covariance estimator for panel data.
Introduced by Driscoll and Kraay in 1998, the method corrects inference when residuals show cross-sectional dependence, serial correlation and heteroskedasticity at the same time. Such dependence is common in macroeconomic and international finance panels, where units such as countries or industries are exposed to shared shocks.
The intuition behind the method
Imagine a panel of countries whose GDP growth all dips together during a global recession. Standard cluster-robust or Newey-West corrections miss this shared shock because they address either cross-sectional or time-series dependence, not both at once. Driscoll-Kraay aggregates the moment conditions across units into a single time series for each period and lag, then applies a Newey-West-style kernel smoother to that series. The resulting sandwich covariance matrix is meant to absorb cross-sectional correlation of unknown form together with serial correlation up to a chosen lag, so that the standard errors remain valid without a specific model of how units comove.
History
Driscoll and Kraay (1998) published the estimator in the Review of Economics and Statistics. The paper extends common nonparametric covariance matrix estimators by aggregating scores across cross-sectional units, so that standard errors remain valid under spatial and temporal dependence as the time dimension grows. The authors motivate the work with panels from macroeconomics, international economics, regional science and finance, and support it with Monte Carlo simulations and empirical examples. Software implementations, including Stata's xtscc command, now make the estimator available to applied researchers.
When to use it
Choose Driscoll-Kraay standard errors when the time dimension is long enough for time-series asymptotics to be a reasonable guide, and when residuals are likely to be correlated across units within the same period, for example because of common global shocks, possibly with serial correlation as well. The estimator is designed to accompany pooled OLS or fixed-effects estimation and does not require the form of the dependence to be specified. Avoid it when T is short, since its guarantees are stated as the time dimension grows, not as the number of units grows. T should be large relative to the chosen bandwidth before the standard errors are trusted; no numeric cutoff is given here. As a practical check, compare the results with cluster-robust standard errors and examine how sensitive the inference is to the bandwidth. The estimator corrects only inference and leaves coefficient estimates unchanged, so it is not a remedy for endogeneity. When N is large and T is short, two-way cluster-robust standard errors or a correction for common factors may be more suitable.
Limitations and considerations
- Consistency is an asymptotic result in T; when the time dimension is short, the estimated standard errors can be unreliable and may undercover.
- Does not address endogeneity or omitted variables; it corrects the covariance matrix of an estimator whose coefficients may still be biased.
- The bandwidth m(T) must be chosen. The rule of thumb floor(T^(1/4)) is a common practitioner convention rather than a derived optimum, and results can be sensitive to this choice.
- The sandwich correction is derived for linear estimators; nonlinear or limited-dependent-variable panels require separate derivation.
- The asymptotic guarantees rest on conditions on the weak dependence of the aggregated scores and on how the bandwidth grows with T. These conditions are stated in the original paper and should be checked there before the estimator is applied to a specific panel.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Simultaneously corrects for cross-sectional dependence, heteroskedasticity, and serial autocorrelation without specifying the dependence structure.
- Designed to be consistent as the time dimension grows, under the conditions on cross-sectional dependence stated in the original paper. The number of units is not restricted in the same way, but the paper's assumptions should be checked for panels with a large number of units.
- Applicable as a post-estimation correction to linear panel estimators such as pooled OLS and fixed effects, since the procedure is built on their residuals.
- Widely implemented in Stata (xtscc), R (sandwich, plm), and Python (linearmodels), enabling straightforward application.
Applications
- Cross-country growth regressions where common business-cycle shocks create correlated residuals across nations.
- International finance panels studying exchange rate determinants, capital flows, or sovereign spreads.
- Industry-level panels in trade economics where sector-wide demand shocks induce cross-sectional dependence.
- Regional economic panels examining fiscal multipliers or labor market dynamics across provinces or states.
- Environmental economics panels (e.g., emissions and GDP) where global climate trends generate spatially correlated errors.
How it works
How it works
Run OLS (or within-group fixed effects) on the panel and collect the residuals. These residuals carry the cross-sectional and temporal dependence that the standard errors must account for.
Formula
\hat{u}_{it} = y_{it} - \mathbf{x}_{it}^{\top}\hat{\boldsymbol{\beta}}_{\text{OLS}}For each time period t and lag j, sum the score vectors (regressor times lagged residual) across all N cross-sectional units. This collapses the panel into a single T-length series of moment conditions that reflects both cross-sectional and serial dependence.
Formula
\mathbf{h}_{t}(j) = \sum_{i=1}^{N} \mathbf{x}_{it}\hat{u}_{it-j}, \quad j = 0, 1, \dots, m(T)Weight each lagged autocovariance matrix of the aggregated scores with a kernel weight w_j and sum the weighted terms up to the bandwidth m(T). The result is a long-run variance estimate that corrects for serial correlation, while the summation over all units in each score is what carries the cross-sectional correction.
Formula
\hat{\mathbf{S}} = \hat{\Gamma}(0) + \sum_{j=1}^{m(T)} w_j \bigl[\hat{\Gamma}(j) + \hat{\Gamma}(j)^{\top}\bigr], \quad \hat{\Gamma}(j) = \frac{1}{T} \mathbf{h}_{t}(j)\mathbf{h}_{t}(j)^{\top}Place the long-run variance estimate in the standard sandwich form, scaled by T and by the inverse of the Gram matrix of the regressors. The output is a covariance matrix for the OLS or fixed-effects estimator that is intended to be robust to cross-sectional dependence, heteroskedasticity and autocorrelation.
Formula
\widehat{\operatorname{Var}}(\hat{\boldsymbol{\beta}}) = T\bigl(\mathbf{X}^{\top}\mathbf{X}\bigr)^{-1}\hat{\mathbf{S}}\bigl(\mathbf{X}^{\top}\mathbf{X}\bigr)^{-1}Common pitfalls
- Applying the estimator to a panel with a short time dimension can produce distorted inference; check that T is long enough for the asymptotics to be a reasonable guide before relying on the standard errors.
- Overlooking strong factor structure: if cross-sectional dependence is driven by one or two common factors, removing them via interactive fixed effects first leads to better-behaved residuals.
- Treating the correction as a substitute for addressing endogeneity; the estimator fixes standard errors, not coefficient bias.
- Applying the default bandwidth without checking residual autocorrelation plots may leave substantial serial dependence unaccounted for.
Frequently asked questions
How does Driscoll-Kraay differ from two-way cluster-robust standard errors?
Two-way clustering adjusts for dependence within clusters defined by unit and by time separately, and its asymptotics rely on the number of clusters in each dimension being large. Driscoll-Kraay aggregates scores across all units and applies a HAC kernel, so its asymptotics are stated in T and it handles spatial dependence of unknown form without requiring discrete cluster groupings.
Can I use Driscoll-Kraay with random effects or instrumental variables?
The original derivation covers OLS and within-group (fixed-effects) estimators. Extensions to IV and GLS settings are feasible by replacing the OLS residuals and score matrices with their IV or GLS analogues, but these require careful implementation and are not always available in standard software packages.
What bandwidth should I choose for the lag truncation m(T)?
A widely used practitioner convention is m(T) = floor(T^(1/4)). It is a starting point rather than a derived optimum. Researchers should inspect residual autocorrelation functions and run sensitivity checks across nearby bandwidth values to see whether the inference changes materially.
Related methods
Sources
Driscoll, J. C., & Kraay, A. C. (1998). Consistent covariance matrix estimation with spatially dependent panel data. Review of Economics and Statistics, 80(4), 549–560.
Open DOI reference