Confirming robust standard errors in Stata
Problem
Data: http://media.nek.lu.se/data/Final.dta
Data: http://media.nek.lu.se/data/Final.mat
The first dataset is final data in Stata format while the second is for MATLAB.
- In Stata, run a regression of FINAL on SATV, SATM and HSGPA. “Use regress FINAL SATV SATM HSGPA, vce(robust)” to get robust standard errors.
- Run the same regression and find the robust standard errors in MATLAB. In MATLAB, FINAL is in the vector y while X contains the explanatory variables (including a column of ones).
- Note that Stata has a “bias correction” on the robust standard errors. It actually does not use
\[\widehat{Var}\left( b|X \right)={\left( X'X \right)}^{-1}X'{\hat{Ψ}}_WX{\left( X'X \right)}^{-1}\]
but instead
\[\widehat{Var}\left( b|X \right)= \frac{n}{n-k}{\left( X'X \right)}^{-1}X'{\hat{Ψ}}_WX{\left( X'X \right)}^{-1}\]
However, this does not make \(\widehat{Var}\left( b|X \right)\) unbiased.
Solution
Stata
MATLAB