Tutorials › Econometrics (Graduate) › Bandwidth Choices for Driscoll-Kraay Inference

Panel Dependence and Inference · Tutorial 328 of 952

Bandwidth Choices for Driscoll-Kraay Inference

Compare Driscoll–Kraay kernels and bandwidths, then assess whether plausible choices materially change confidence intervals and conclusions.

Advanced 11 min read

What You'll Learn

  • Define the bandwidth and kernel weights in a Driscoll–Kraay covariance estimator.
  • Compare Bartlett and Parzen weighting of time-lagged score covariances.
  • Calculate standard errors and confidence intervals under alternative bandwidths.
  • Check how serial-covariance truncation changes an inference conclusion.
  • Report sensitivity analyses without treating one bandwidth as universally correct.

Why Kernel and Bandwidth Choices Matter

Driscoll–Kraay (DK) standard errors estimate uncertainty in panel regression coefficients while allowing dependence across units and serial dependence over time. Their covariance estimate applies a heteroskedasticity-and-autocorrelation-consistent weighting scheme to time-indexed, cross-sectionally aggregated regression scores. The choice of kernel determines how the estimated covariance at each time lag is weighted; the bandwidth determines how quickly those weights taper and, for compact-support kernels, which lags receive nonzero weight.

These choices affect the estimated long-run covariance of the scores and therefore the standard errors, confidence intervals, and tests. A larger bandwidth does not automatically produce more accurate inference: it includes more estimated lag covariances, which may capture genuine serial dependence or add sampling noise. A kernel is not a model of the errors; it is a rule for weighting the estimated covariances.

DK Covariance and the Role of Bandwidth

For clarity, consider a balanced panel with \(N\) units and \(T\) periods, and a regression with \(k\) coefficients. Let \(x_{it}\) be the \(k\)-vector of regressors used in the fitted regression and \(\hat u_{it}\) its residual. The score aggregated across units at time \(t\), scaled by \(N\), is

$$ \hat g_t = \frac{1}{N}\sum_{i=1}^{N}x_{it}\hat u_{it}, \qquad \hat Q = \frac{1}{NT}\sum_{t=1}^{T}\sum_{i=1}^{N}x_{it}x_{it}'. $$

For a fixed-effects regression, \(x_{it}\) and \(\hat u_{it}\) here refer to the regressors and residuals in the fitted, transformed regression. Define the estimated lag-\(h\) score covariance by

$$ \hat\Gamma_h = \frac{1}{T}\sum_{t=h+1}^{T}\hat g_t\hat g_{t-h}', \qquad h=0,1,\ldots,T-1. $$

The lag-zero term is \(\hat\Gamma_0\). For each positive lag \(h\), both directions of the covariance contribute to the long-run covariance estimate. With the bandwidth convention \(b>0\), a kernel \(K\), and weights \(K(h/b)\), the DK covariance estimate is

$$ \widehat{\operatorname{Var}}(\hat\beta) = \frac{1}{T}\hat Q^{-1} \left[ \hat\Gamma_0+ \sum_{h=1}^{T-1}K(h/b) \left(\hat\Gamma_h+\hat\Gamma_h'\right) \right] \hat Q^{-1}. $$

This formula states the key bandwidth trade-off directly. If a weight is zero, that estimated lag covariance does not contribute. If it is positive, the covariance contributes, but is downweighted according to the kernel and bandwidth. Software may use another convention for naming or indexing the bandwidth, such as a maximum lag \(L\) with weights defined using \(L+1\). Check the actual weight formula before comparing reported bandwidth values.

Definition: The bandwidth \(b\) is the scale used to convert each time lag \(h\) into a kernel argument \(h/b\). The kernel \(K\) maps that argument to a weight. For a compact-support kernel, the weight is zero beyond its support; for a kernel without compact support, a finite-sample implementation must still specify how it handles the available lags.

Common Kernel Choices

The Bartlett kernel is a common compact-support choice:

$$ K_{\mathrm{B}}(z)= \begin{cases} 1-|z|, & |z|\leq 1,\\ 0, & |z|>1. \end{cases} $$

It gives the largest weight to lag zero and decreases linearly to zero at the bandwidth. Under the convention used here, a Bartlett bandwidth \(b=4\) gives weights \(0.75\), \(0.50\), and \(0.25\) at lags 1, 2, and 3; lag 4 has weight zero. Thus, the positive-lag terms included are those with \(h<b\).

The Parzen kernel is another compact-support option:

$$ K_{\mathrm{P}}(z)= \begin{cases} 1-6|z|^2+6|z|^3, & 0\leq |z|\leq \frac{1}{2},\\ 2(1-|z|)^3, & \frac{1}{2}<|z|\leq 1,\\ 0, & |z|>1. \end{cases} $$

It also tapers to zero at the bandwidth, but its weighting profile differs from Bartlett’s. Consequently, the same numerical bandwidth does not imply the same covariance estimate across kernels. Other kernels, including the quadratic spectral kernel, are used in HAC estimation; their weights and software conventions must be checked rather than assumed to match Bartlett weights.

Worked Example: Computing a Bartlett DK Standard Error

Suppose a hypothetical balanced-panel regression has \(T=100\), an estimated coefficient \(\hat\beta=0.50\) in the outcome’s units per one-unit increase in a regressor, and scalar \(\hat Q=1\). Suppose its estimated score covariances are \(\hat\Gamma_0=4.0\), \(\hat\Gamma_1=1.2\), \(\hat\Gamma_2=0.4\), with the remaining positive-lag covariances equal to zero. Compare Bartlett bandwidths \(b=2\) and \(b=4\).

With \(b=2\), the lag-1 weight is \(K_{\mathrm{B}}(1/2)=0.5\), and the lag-2 weight is zero. The estimated long-run covariance inside the brackets is

$$ 4.0+0.5(1.2+1.2)=5.2. $$

Since \(\hat Q=1\), the estimated coefficient variance is \(5.2/100=0.052\), and its standard error is \(\sqrt{0.052}=0.2280\) outcome units per regressor unit.

With \(b=4\), the weights at lags 1 and 2 are \(0.75\) and \(0.50\). The long-run covariance estimate becomes

$$ 4.0+0.75(1.2+1.2)+0.50(0.4+0.4)=6.2. $$

The standard error is now \(\sqrt{6.2/100}=0.2490\) outcome units per regressor unit. The additional lag-2 covariance raises the estimated uncertainty in this example. It does not establish that \(b=4\) is preferable: that decision depends on the time-series properties of the aggregated scores and the inferential setting.

What the Bandwidth Trade-Off Means

A short bandwidth truncates the serial-covariance sum relatively early. This can reduce the influence of noisy estimates at distant lags, but it can also omit relevant serial dependence. A longer bandwidth admits more lag covariances, though the kernel generally gives distant lags smaller weights. Because estimated autocovariances can be positive or negative, increasing the bandwidth need not increase the standard error: the effect depends on the values and signs of the newly weighted terms.

Bandwidth choices are guided by asymptotic theory and by the application, not by a universal best value. Under suitable regularity conditions for the time-indexed score process, consistency of a HAC long-run covariance estimator typically requires the bandwidth to grow with \(T\) while growing more slowly than \(T\): \(b\to\infty\) and \(b/T\to0\). These conditions describe an asymptotic sequence; they do not, by themselves, identify the best finite-sample bandwidth for a particular panel. Automated rules can be useful starting points, but their assumptions and the software’s bandwidth convention should be documented.

Kernel choice matters as well as bandwidth. Two kernels at the same \(b\) assign different weights to some of the same lags. A difference between estimates may reflect the tapering profile, the effective set of lags, or both. For a meaningful comparison, state the kernel and its precise bandwidth convention rather than reporting only a bare number.

Worked Example: Comparing Bartlett and Parzen Weights

Use the hypothetical covariance values from the preceding example, with \(\hat\Gamma_0=4.0\), \(\hat\Gamma_1=1.2\), \(\hat\Gamma_2=0.4\), zero remaining lag covariances, \(T=100\), and \(\hat Q=1\). Compare Bartlett and Parzen kernels at \(b=4\).

For Bartlett, the lag weights are \(0.75\) and \(0.50\), so the estimated long-run covariance is \(4.0+2(0.75)(1.2)+2(0.50)(0.4)=6.2\), as calculated above.

For Parzen, lag 1 has \(z=1/4\), giving \(K_{\mathrm{P}}(1/4)=1-6(1/4)^2+6(1/4)^3=0.71875\). Lag 2 has \(z=1/2\), giving \(K_{\mathrm{P}}(1/2)=1-6(1/2)^2+6(1/2)^3=0.25\). Thus the Parzen estimate is

$$ 4.0+2(0.71875)(1.2)+2(0.25)(0.4)=5.925. $$

The corresponding standard error is \(\sqrt{5.925/100}=0.2434\) outcome units per regressor unit. It differs from the Bartlett standard error of \(0.2490\), even though both calculations use \(b=4\). This difference results from the distinct weights, not from different regression coefficients or different score covariances.

Sensitivity Checks for Confidence Intervals

A sensitivity check recomputes inference under a small, defensible set of bandwidths, and sometimes kernels, while holding the fitted regression and the sample fixed. The purpose is to see whether the inferential conclusion depends materially on how the serial-covariance sum is truncated. It is not a search for the specification that produces a desired result. Report the choices and the resulting standard errors and intervals together.

For a large-sample, two-sided 95% interval, the usual normal approximation is \(\hat\beta\pm1.96SE\). The same critical value should be used across the choices in a comparison if the inferential procedure is otherwise unchanged. An interval that crosses zero indicates that zero is included in that interval; it does not establish that the null hypothesis is true.

Worked Example: Assessing Bandwidth Sensitivity

Consider a separate hypothetical regression with \(T=100\), \(\hat Q=1\), and coefficient estimate \(\hat\beta=0.47\) outcome units per regressor unit. Suppose the score covariances are \(\hat\Gamma_0=4.0\), \(\hat\Gamma_1=1.2\), \(\hat\Gamma_2=0.4\), \(\hat\Gamma_3=0.2\), \(\hat\Gamma_4=-0.1\), and zero at higher lags. Using the Bartlett weights defined above, calculate 95% intervals at \(b=1,2,4,5\).

At \(b=1\), all positive-lag weights are zero. The coefficient variance is \(4.0/100=0.0400\), so \(SE=0.2000\). The interval is \(0.47\pm1.96(0.2000)=[0.078,0.862]\).

At \(b=2\), only lag 1 has a nonzero weight, equal to \(0.5\). The long-run covariance is \(4.0+2(0.5)(1.2)=5.2\), giving \(SE=\sqrt{5.2/100}=0.2280\) and interval \([0.023,0.917]\).

At \(b=4\), the weights at lags 1, 2, and 3 are \(0.75\), \(0.50\), and \(0.25\). The long-run covariance is \(4.0+2(0.75)(1.2)+2(0.50)(0.4)+2(0.25)(0.2)=6.3\). Thus \(SE=\sqrt{6.3/100}=0.2510\), giving interval \([-0.022,0.962]\).

At \(b=5\), the weights at lags 1 through 4 are \(0.8\), \(0.6\), \(0.4\), and \(0.2\). The long-run covariance is \(4.0+2(0.8)(1.2)+2(0.6)(0.4)+2(0.4)(0.2)+2(0.2)(-0.1)=6.52\). Therefore \(SE=\sqrt{6.52/100}=0.2553\), and the interval is \([-0.030,0.970]\).

For this hypothetical example, the 95% intervals include zero at \(b=4\) and \(b=5\), but not at \(b=1\) or \(b=2\). The conclusion about whether zero is excluded is therefore sensitive to the bandwidth choices shown. That is a reporting-relevant finding; it is not a reason to select the shorter bandwidth. The analyst should explain why the considered choices are reasonable and describe the uncertainty about the conclusion.

A Practical Comparison and a Common Pitfall

A transparent sensitivity analysis can be organized as follows:

1
Fix the fitted specification.
Keep the sample, regressors, transformation, and coefficient estimate unchanged so that the comparison isolates covariance choices.
2
Choose defensible alternatives.
Specify a small range of bandwidths and, if relevant, a second kernel. State the weight convention used by the estimator.
3
Recompute and compare inference.
Report standard errors and confidence intervals in the coefficient’s units, and note whether key conclusions change across the alternatives.
4
Explain the sensitivity.
Describe the result as robust or sensitive to the choices considered; do not present a favorable choice as uniquely justified by its result.

Common mistake: “A larger bandwidth is always safer because it includes more serial dependence.” This reasoning overlooks that distant sample autocovariances are estimated with uncertainty and can be negative as well as positive. A larger bandwidth changes the weighted sum; it does not guarantee a larger standard error or better finite-sample coverage. The correction is to justify a bandwidth using the estimator’s assumptions and the panel’s time dimension, then report sensitivity to plausible alternatives.

Kernel and bandwidth sensitivity is most informative when the alternatives are clearly defined and the fitted model is held fixed. A report should identify the kernel, bandwidth convention, standard errors, and intervals. If a substantive conclusion changes, say so directly. The DK estimate is an inferential procedure, not a device that makes every possible dependence pattern harmless; its reliability still rests on the relevant asymptotic and regularity conditions.

Check Your Understanding

Try these questions before reviewing the calculations above.

  1. Under the Bartlett convention in this tutorial, what weights are assigned to lags 1 and 2 when \(b=4\), and what is the weight at lag 4?
  2. Why can two DK estimates differ even when they use the same numerical bandwidth?
  3. If an added lag covariance is negative, must a longer bandwidth increase the estimated standard error? Explain.
  4. What should be held fixed when comparing confidence intervals across bandwidth choices, and what should be reported?
  5. In the sensitivity example, what does it mean that the interval crosses zero at \(b=4\) but not at \(b=2\)?
Clinical Biostats