0
$\begingroup$

I have a time-series which is autocorrelated by construction. 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 Python. 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? 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 Python?
$\endgroup$
3
$\begingroup$

A trick is to regress your variable of interest, say $X$, on a vector of ones. In R it would be lm(X~1); probably something similar in Python. Then use HAC standard errors to test the hypothesis that the intercept of the model is equal to zero.

Alternatively, do a $t$-test using a robust standard error which is the square root of the long-run variance of $X$ obtained using Newey-West or some other autocorrelation-robust estimator.

$\endgroup$
3
  • $\begingroup$ But I dont know how to apply the Newey-West methodology to my time series. Obtaining robust SE is my goal, that's why I'm asking. $\endgroup$
    – user49958
    Mar 23 at 18:02
  • $\begingroup$ Couldn't edit it anymore: So thanks for your reply anyway! I will dig a bit deeper into "how to obtain robust SEs and stdevs. $\endgroup$
    – user49958
    Mar 23 at 18:15
  • 1
    $\begingroup$ @user49958, I was under the impression that you can do it in a regression. Thus I explained a trick of how to formulate your problem as a regression in my first paragraph. If your only question is how to code it in Python, then I am afraid it is off topic. Or do you have a conceptual question? $\endgroup$ Mar 23 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.