Stata Robust Variance: Keep Coefficients, Fix Inference Under Heteroskedasticity
Correct inference under heteroskedasticity in Stata without changing coefficient estimates. Use the robust variance estimator, verify the covariance matrix label, and know when to switch to cluster-robust.
18 Nov 2025, 03:43 UTC

Your regression coefficients look fine, but the standard errors are too optimistic because the residual variance fans out with the fitted values. That is heteroskedasticity, and in Stata you can correct the inference without re-estimating the model by requesting a robust variance estimator. The point estimates stay the same; only the covariance matrix used for p-values and confidence intervals changes.
The problem heteroskedasticity creates
Heteroskedasticity means the error variance is not constant across observations. Ordinary least squares remains unbiased for the coefficients, but the default variance estimator assumes constant variance. When the assumption fails, conventional standard errors are biased and inference is unreliable.
A robust variance estimator, often called Huber-White, adjusts the covariance matrix for heteroskedasticity while leaving coefficient estimates intact. Interpretability of the model is preserved because you are not changing the fit, only the uncertainty quantification.
How Stata exposes robust variance
In Stata the adjustment is available as a post-estimation option and as an estimation option. The syntax is consistent across standard, SE and MP editions in current releases.
Run the regression in the Stata Command window with user-level access. No special permissions are required.
regress y x1 x2, robustPlaceholders y, x1, x2 represent your outcome and predictors. Factor-variable syntax is supported, e.g., i.group#c.x1, with minor differences across releases.
After estimation you can inspect the variance matrix:
matrix list e(V)Expected check: the output header and the post-estimation notes label the covariance matrix as Robust. Compare standard errors before and after applying the robust option to observe the adjustment effect. The coefficient table will show the same point estimates with different standard errors, z-statistics, p-values and confidence intervals.
The same adjustment can be applied post-estimation:
regress y x1 x2
estat robustRisk: robust standard errors do not fix model misspecification. If the mean function is wrong, the coefficients remain misleading even with corrected standard errors.
Worked comparison
Consider a cross-sectional wage model where residual spread increases with experience. Estimate once with conventional variance and once with robust variance.
regress wage educ experience, robustMeaningful placeholders are wage for outcome, educ and experience for predictors. After running, verify the output labels the covariance matrix as Robust and that the coefficient values are unchanged from a conventional regress run.
This diagnostic decision is useful when a residual-vs-fitted plot shows fanning. If the robust standard errors are materially larger, conventional inference was overconfident.
Limitations and when to go beyond robust
The robust estimator assumes independent observations. For correlated panel data, grouped data, or repeated measures, cluster-robust options are required. Using robust alone in those settings understates uncertainty.
Finite-sample behavior may diverge from asymptotic theory. With small samples bootstrap methods offer an alternative for standard error estimation, at higher computational cost.
Practical check: run the robust regression, then run a cluster-robust version if a grouping variable exists, e.g., cluster(id). If standard errors increase further, correlation within clusters was present.
Actionable closing: when you suspect heteroskedasticity in cross-sectional data, re-run your existing Stata regression with the robust option, confirm the covariance matrix is labeled Robust, and report the adjusted standard errors. Keep the conventional results for comparison, and move to cluster-robust or bootstrap when independence is violated or samples are small.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.