Why Kernel and Bandwidth Choices Matter
Heteroskedasticity-and-autocorrelation-consistent (HAC) inference estimates the long-run covariance of regression scores. The kernel and bandwidth determine how the estimator uses covariance information from different time lags. A kernel sets the relative weight given to each lag; the bandwidth sets how quickly that weight changes as the lag grows. These are tuning choices, not harmless software details: they can change estimated standard errors and, in turn, confidence intervals and tests.
The Newey–West Bartlett estimator is one familiar HAC estimator. Its kernel weights decline linearly to zero at the chosen cutoff. Other kernels decline differently, and some retain nonzero weights beyond any finite lag. None is universally best for every sample and dependence pattern. A useful analysis therefore specifies the convention used, gives a reason for the bandwidth, and checks whether conclusions are sensitive to plausible alternatives.
Long-Run Covariance and the HAC Estimator
Consider the regression model \(y_t=x_t'\beta+u_t\), where observations are ordered in time. Let \(\hat\beta\) be the ordinary least squares estimator and let \(\hat u_t=y_t-x_t'\hat\beta\). The estimated regression score for observation \(t\) is \(g_t=x_t\hat u_t\). HAC inference relies on conditions such as a stable data-generating process, suitable weak dependence of the scores, finite moments, and a nonsingular regressor second-moment matrix. These conditions allow a long-run covariance to describe the asymptotic variability of the estimator; they do not require the errors to be serially independent or homoskedastic.
For a stationary score process, its long-run covariance is the sum of contemporaneous and lagged score covariances. In a sample, define the lag-\(\ell\) estimate using the convention below. Here \(g_t\) is a column vector and the prime denotes transpose.
For this tutorial, \(b>0\) is the bandwidth and the kernel argument is \(\ell/b\). The estimated long-run covariance and the associated HAC covariance estimator for \(\hat\beta\) are
where \(\widehat Q=n^{-1}\sum_{t=1}^{n}x_tx_t'\). The lagged covariance matrices enter in transpose pairs so that the estimated long-run covariance is symmetric. The factor \(1/n\) in the coefficient covariance is important: it is not part of \(\widehat{\Omega}_{K,b}\). In a scalar illustration with \(\widehat Q=1\), the estimated standard error is \(\sqrt{\widehat{\Omega}_{K,b}/n}\).
Common Kernel Choices
The kernels below are written for \(r\geq 0\); the corresponding symmetric kernel uses the same weight at positive and negative lags. Bartlett and Parzen have finite support: their weights are zero once \(r\geq1\). The quadratic-spectral kernel (QS) has infinite support, so its weights generally remain nonzero at every finite scaled lag. A uniform, or truncated, kernel gives equal weight to all lags before the cutoff and zero weight afterward.
For a finite-support kernel, a bandwidth of integer value \(b\) gives zero weight at lag \(b\) and beyond. Thus this convention differs from descriptions that use a maximum included lag \(L\) and write Bartlett weights as \(1-\ell/(L+1)\): under the convention here, \(b=L+1\). Stating this distinction avoids off-by-one confusion when comparing software output or published specifications.
The kernel shapes encode different ways of tapering lagged covariances. Bartlett decreases linearly; Parzen tapers smoothly and more steeply near the cutoff; QS decays without a hard cutoff. The uniform kernel does not taper at all before abruptly dropping to zero. That sharp truncation can be unstable, and the uniform kernel need not produce a positive-semidefinite covariance estimate. Bartlett and the standard Parzen and QS kernels are commonly used because their weighting properties support well-behaved HAC estimation under appropriate conditions.
Worked Example: Comparing Kernel Weights at the Same Scaled Lags
Suppose the selected bandwidth is \(b=20\). Compare the weights assigned to lags \(\ell=5,10,15,\) and \(20\), for which \(r=\ell/b\) equals \(0.25,0.50,0.75,\) and \(1\). This calculation compares weights only; it does not claim that any particular kernel is best for the data.
For Bartlett, substitute each scaled lag into \(1-r\). The weights are \(0.75,0.50,0.25,\) and \(0\). For Parzen, at \(r=0.25\) the first branch gives \(1-6(0.25)^2+6(0.25)^3=0.71875\). At \(r=0.50\), either branch gives \(0.25\); at \(r=0.75\), the second gives \(2(0.25)^3=0.03125\); and at \(r=1\) the weight is zero.
For QS, substitution in its formula gives approximate weights \(0.914, 0.687, 0.398,\) and \(0.138\), respectively. For example, at \(r=0.75\), the bracketed term is \(\sin(0.9\pi)/(0.9\pi)-\cos(0.9\pi)\), and the multiplier is \(25/[12\pi^2(0.75)^2]\), giving approximately \(0.398\). The uniform kernel gives weight \(1\) at all four scaled lags under the stated convention. At \(r=1\), it still includes the lag with weight one, unlike Bartlett and Parzen; QS also gives a nonzero weight there.
Bandwidth, Bias, and Variability
The bandwidth controls a basic tradeoff. If it is too short, the estimator discards or heavily downweights relevant dependence at longer lags. This truncation and tapering can create bias in the estimated long-run covariance. If the bandwidth is increased, more lagged covariance estimates contribute, which may reduce that source of bias. But sample covariances at high lags are noisy, so including more of them can increase estimation variability.
The tradeoff can be seen by comparing the estimator's expectation with the population long-run covariance. Write \(\Gamma_\ell\) for the population covariance at lag \(\ell\). In a scalar stationary case with symmetric covariances, the long-run covariance is \(\Omega=\Gamma_0+2\sum_{\ell=1}^{\infty}\Gamma_\ell\). Ignoring small finite-sample effects in the estimated covariances, the kernel estimator's expected value is approximately \(\Gamma_0+2\sum_{\ell=1}^{\infty}K(\ell/b)\Gamma_\ell\). Their difference is therefore
This expression shows why bias depends on both the kernel and the pattern of population dependence: a weight below one attenuates that lag's contribution. At the same time, each added estimated lag contributes sampling noise. Under regularity conditions, consistency is typically obtained by letting the bandwidth grow with the sample size while keeping it small relative to the sample: \(b\to\infty\) and \(b/n\to0\). These are asymptotic conditions, not a complete finite-sample selection rule.
A simple rate calculation illustrates the tradeoff, but should not be treated as a universal bandwidth formula. Under additional smoothness and dependence conditions for a Bartlett-type estimator, suppose its leading squared bias is proportional to \(b^{-2}\), and its variance is proportional to \(b/n\). The leading mean squared error then has the form \(A b^{-2}+C b/n\), where \(A\) and \(C\) are positive constants. Differentiating with respect to \(b\) gives \(-2A b^{-3}+C/n=0\), so \(b^3=2An/C\) and the balancing rate is \(b\) proportional to \(n^{1/3}\). The constants, assumptions, kernel, and target all matter; the calculation motivates a tradeoff rather than prescribing a single choice for every application.
Worked Example: Computing HAC Standard Errors Across Bandwidths
Consider a hypothetical scalar regression-score calculation with \(n=100\), \(\widehat Q=1\), and estimated lag covariances \(\widehat\Gamma_0=4\), \(\widehat\Gamma_1=1.2\), \(\widehat\Gamma_2=0.6\), \(\widehat\Gamma_3=0.2\), and \(\widehat\Gamma_4=-0.1\). For this scalar example, the transpose-paired terms are equal, so each positive-lag contribution is \(2K(\ell/b)\widehat\Gamma_\ell\). Use the Bartlett kernel and the bandwidth convention defined above.
With \(b=2\), only lag 1 has a nonzero weight among these lags: \(K(1/2)=0.5\). Thus \(\widehat\Omega=4+2(0.5)(1.2)=5.2\). The estimated variance of the coefficient is \(5.2/100=0.052\), and the estimated standard error is \(\sqrt{5.2/100}\approx0.2280\), in the coefficient's units.
With \(b=3\), the weights at lags 1 and 2 are \(2/3\) and \(1/3\), while lag 3 has zero weight. Therefore \(\widehat\Omega=4+2\{(2/3)(1.2)+(1/3)(0.6)\}=6.0\). The coefficient variance estimate is \(6.0/100=0.0600\), giving a standard error of \(\sqrt{6.0/100}\approx0.2449\).
With \(b=5\), the weights at lags 1 through 4 are \(0.8,0.6,0.4,\) and \(0.2\). The weighted sum before doubling is \((0.8)(1.2)+(0.6)(0.6)+(0.4)(0.2)+(0.2)(-0.1)=0.96+0.36+0.08-0.02=1.38\). Hence \(\widehat\Omega=4+2(1.38)=6.76\), the coefficient variance estimate is \(6.76/100=0.0676\), and the standard error is \(\sqrt{6.76/100}=0.2600\). The standard errors rise across these choices in this illustration, but that pattern is not guaranteed in other data.
Assessing Sensitivity in Practice
A sensitivity analysis asks whether the estimated uncertainty and resulting conclusions depend strongly on defensible kernel and bandwidth choices. It is not a search for whichever setting produces the preferred result. Start from the time ordering and the plausible persistence of the score process, use a stated selection method or a substantively justified baseline, and compare it with nearby bandwidths and, where useful, another standard kernel. Report enough information for a reader to identify the estimator and the tuning choices.
The following hypothetical comparison uses the standard errors from the preceding example and a coefficient estimate of \(0.30\) units. Suppose a large-sample normal approximation is appropriate for illustration. A 95% confidence interval is the estimate plus or minus \(1.96\) standard errors. With \(b=2\), it is \(0.30\pm1.96(0.2280)\), or approximately \([-0.1469,0.7469]\) units. With \(b=3\), it is \(0.30\pm1.96(0.2449)\), or approximately \([-0.1800,0.7800]\) units. With \(b=5\), it is \(0.30\pm1.96(0.2600)\), or approximately \([-0.2096,0.8096]\) units. All three intervals include zero; in this illustration, the qualitative conclusion is unchanged, although the interval width is sensitive to the bandwidth. Each interval describes uncertainty under its stated asymptotic approximation; it is not a probability statement about the fixed coefficient.
Worked Example: Interpreting a Tuning-Parameter Check
A hypothetical analyst reports a positive coefficient estimate, with a confidence interval excluding zero under a moderate bandwidth. Two nearby, defensible bandwidths produce larger standard errors, and both corresponding intervals include zero. Assume the regression specification and the large-sample approximation are otherwise appropriate.
The correct conclusion is not that the bandwidth yielding the narrowest interval is preferable, nor that the coefficient has changed. The point estimate is the same; the estimated uncertainty differs. Since the interval-based conclusion changes across plausible choices, the evidence for a nonzero coefficient is sensitive to HAC tuning. The analyst should state the baseline choice and report the sensitivity, rather than present only the choice that yields the desired conclusion. This check does not identify which standard error is correct; it reveals that inference depends materially on how long-run covariance is estimated.
Common Pitfall and Practical Checklist
A common mistake is to call a larger bandwidth automatically “more robust.” A larger bandwidth can incorporate more dependence, but it also includes noisier high-lag covariance estimates; its standard error can increase or decrease. Likewise, choosing a kernel with a smoother taper does not guarantee a smaller or more accurate standard error. Neither a kernel nor a bandwidth corrects a misspecified regression or guarantees good finite-sample inference.
Before reporting HAC inference, check that the data's ordering and dependence structure make the HAC target appropriate, the score process satisfies plausible weak-dependence conditions, and the implementation uses the stated bandwidth convention. Then document the kernel and bandwidth, inspect sensitivity across reasonable alternatives, and interpret uncertainty in the outcome's units. If the resulting inference is unstable, report that instability as a substantive limitation rather than hiding it behind one tuning choice.
Check Your Understanding
Try these questions without looking back.
- Under the convention \(K(\ell/b)\), what Bartlett weight is assigned to lag 2 when \(b=4\), and what happens at lag 4?
- Explain why increasing the bandwidth can reduce one source of bias while increasing estimation variability.
- For \(n=100\), \(\widehat Q=1\), and \(\widehat\Omega=6.76\), calculate the estimated standard error of the scalar coefficient.
- Why can the uniform kernel be less attractive than a tapered kernel?
- If a confidence interval excludes zero for one plausible bandwidth but includes zero for nearby choices, what should the analyst report?