I am running a simple OLS regression with HAC adjustment (i.e. Heteroschedasticity and Autocorrelation adjustment) using the following function in hac()
in matlab.
My regression is simple in that I am regressing against a vector of ones only:
$Y = \alpha + \epsilon$
In Matlab, the implementation is as follows (this is only to show how it is implemented, but the variables are not the true ones I use in my real example):
Y = rand(500,1);
X = ones(500, 1);
hac(X, Y, 'intercept', false, 'weights','BT','display','full')
However, for my real variable Y
, I get the error that matrix is not positive definite
. I am not sure why that would be at all, since I am regressing against one variable only, which is constant 1!
On the other hand, when I run a simple OLS, then there is no error. Something must be happening when the HAC adjustment is done.
Any help would be appreciated. Thank you!