# Newey-West t-statistics

I have a time-series which is autocorrelated by construction, and might be heteroscedastic. I have calculated the sample mean of this time-series, and would like to calculate the t-statistic corresponding to the hypothesis that the mean of this time-series is zero. It is my understanding that since my time-series is autocorrelated and possibly heteroscedastic, that I must use a t-statistic "adjusted for serial dependence according to the Newey-West method".

1. I have problem understanding the method, and how to implement this in Matlab. As far as I understand, Newey-West is used in regressions to obtain HAC standard errors, since the OLS standard errors are not a reliable basis for inference under serial correlation of the error term in a regression. But in my case, I am not regressing anything, so how does the Newey-West method fit in? Under no autocorrelation and homoscedasticity, I would have simply divided the sample mean (minus 0) by the standard error (sample standard deviation over square root of the number of observations). There would therefore be no need for regressing anything.
2. How can I implement computation of Newey-West t-statistics in Matlab?
-
This seems like quite a common situation, I am surprised that no answer has surfaced! – lodhb Nov 20 '12 at 13:26
Is this still relevant? I can answer this if it is.. – user29427 Aug 22 '13 at 12:21
Yes! The principle of this forum is that regardless of whether the OP has lost interest or is still watching, the answers should still interest anyone else with the same problem. – Nick Cox Aug 22 '13 at 12:32
@NickCox is correct. In addition, you should edit this to answer or delete it. At present, it is not an answer by CV's standards & doesn't belong. (Note that we prefer an answer, of course.) – gung Aug 22 '13 at 12:43

Seeing as how I had a similar question earlier and came across this long-unanswered question through a simple web search, I'll take a stab and post what I think is one possible solution to your situation that others may also be encountering.

According to SAS Support, you can take the time-series you have and fit an intercept-only regression model to the series. The estimated intercept for this regression model will be the sample mean of the series. You can then pass this intercept-only regression model through the SAS commands used to retrieve Newey-West standard errors of a regression model.

Here is the link to the SAS Support page: http://support.sas.com/kb/40/098.html

Look for "Example 2. Newey-West standard error correction for the sample mean of a series"

In your case, simply try the same approach with Matlab.If someone has a better approach, please enlighten us.

-

this is a function that returns the t.stat for the mean with null hypothesis that mean is equal to h0. Lag must be set equal to lagged returns that can be considered autocorrelated.

function y=NWtest(ret,lag,h0)

T=size(ret,1);
vv=var(ret);

for l=1:1:lag

cc=cov(ret(1:end-l),ret(l+1:end));
vv=vv+2*(1-l/lag)*cc(1,2);
end

y=(mean(ret)-h0)/sqrt(vv)*sqrt(T);


end

-
This addresses the programming aspect of things but not the issues with the OP's understanding of the method. – Andy Jun 6 at 13:00