MORE VCE OPTIONS FOR LINEAR MODELS

Stata‘s most commonly used linear regression commands now come with a richer set of variance–covariance matrix (VCE) options, allowing standard errors and confidence intervals that are robust in even more situations. These features are part of StataNow™.

 

Are errors in your model for time series or panel data autocorrelated? regress and areg now allow for heteroskedasticity- and autocorrelation-consistent (HAC) standard errors with the vce(hac hacspec) option, while xtreg, fe allows users to specify Driscoll–Kraay standard errors with the new vce(dkraay hacspec) option.

 

Bias correction has been enhanced in regressaregxtreg, fedidregress, and xtdidregress, with each now allowing for both HC2 and HC3 standard errors with clustering. The inference adjustment of Hansen (2025) is also available with HC3 standard errors using the new hansen suboption.

 

Now you can also account for multiple nonnested clusters when fitting an instrumental-variables (IV) regression with ivregress. And when you fit linear models via generalized least squares with xtgls, you can now allow for arbitrary correlation within panels with the new corr(unstructured) option.


We can use Driscoll–Kraay standard errors to evaluate the effect of union membership (union) on the log of wages (ln_wage). We control for job tenure and for time fixed effects.

 

Driscoll–Kraay standard errors are often useful in panel settings where errors may be correlated over time. These standard errors are robust not only to heteroskedasticity and autocorrelation but also to general forms of dependence between panels.

 

Here we type

 

 

We have requested Driscoll–Kraay standard errors with the Bartlett kernel and that lags be chosen using the Newey–West criterion for optimal lags. We could have alternately requested a Parzen or quadratic spectral kernel. The vce() option syntax for Driscoll–Kraay standard errors is the same as the syntax for HAC standard errors in ivregress and now in regress and areg but with dkraay substituted for hac.

 

Here the confidence interval for union is wider than if we had used the vce(robust) option to estimate cluster–robust standard errors.

 

Because Driscoll–Kraay standard errors account for heteroskedasticity and correlation, they tend to perform better than ordinary standard errors even in relatively short panels as in these data (Driscoll and Kraay 1998). However, note that Driscoll–Kraay standard errors, like HAC standard errors, rely on asymptotic properties that take effect as the number of time periods becomes large.

 

© Copyright 1996–2026 StataCorp LLC. All rights reserved.

We may prefer to estimate standard errors that are robust to correlation within clusters defined by birth year (birth_yr). Because we have only 14 clusters and their sizes are unbalanced (3 birth years have far fewer observations than the other 11), we apply an HC3 bias correction with the adjustments of Hansen (2025). We type

 

 

The confidence interval for union is wider than the standard cluster–robust confidence interval we would have obtained with vce(cluster birth_yr).

 

Using vce(hc3) with the hansen suboption yields the same small-sample degrees-of-freedom adjustment as with using only the dfadjust suboption, but it also applies a scaling factor to the t distribution used to generate the confidence interval.

 

Here we have demonstrated the new Hansen adjustment with the xtreg, fe command, but the same adjustment is also now available with regressaregdidregress, and xtdidregress.

 

Also, make sure to explore multiway clustering in ivregress and the new corr(unstructured) option in xtgls, which allows for unstructured correlation across time periods within panels.