I am trying to compute robust coefficient estimates for OLS, using the hac()
function in MATLAB (see description of function in MathWorks).
In my case, I am regressing a Y
variable against a constant only (i.e. X
is a vector of ones). In my real example, the data is highly autocorrelated, hence the importance of doing HAC adjustment. Now, here is a simple example (note that Y here is not autocorrelated):
Y = rand(500,1);
X = ones(500, 1);
hac(X, Y, 'intercept', false, 'weights','BT','display','full')
However, when I compare the results to simple OLS regression:
lscov(X, Y)
it turns out that the coefficient (here intercept) tandard error is exactly the same, as if no HAC adjustment was done when using hac()
. Am I doing something wrong here?
Any help would be appreciated! Thank you!