# How to test for serial correlation of a time series itself (not residuals)?

We know that Ljung-Box test can be used to test for the residuals of a fitted model. But to test for the serial correlation of a time series itself, is there a way to do that?

-
You could always just run autocorrelations on the raw response data, instead of the residuals. Have you searched the site? This strikes me as a question that's been addressed before. –  gung Jan 13 '13 at 3:51
Yes I have searched the site but didn't get any clear answers. There should be some test for time series itself but failed to find it. –  yanfei kang Jan 13 '13 at 23:20

## 1 Answer

You can still use the Ljung-Box test for the time series itself as @gung says. For a series $\{Y_t\}$ think of it as testing the residuals from the model $Y_t=0+\varepsilon_t$ if you like.

-
@Scotchi ... I think you mean Y(t)=constant + e(t) –  IrishStat Jan 14 '13 at 15:56
@IrishStat Why? The sample autocorrelations that go into Ljung-Box will be the same if it's zero or a constant. –  Scortchi Jan 14 '13 at 16:06
You indeed might be right. Can you validate that as I don't have routine access. Post the results and copy them to me at dave@autobox.com. Thanks in advance. –  IrishStat Jan 15 '13 at 12:41
The sample autocorrelation for $k$ lags is $\sum(Y_t-\bar{Y})(Y_{t-k}-\bar{Y})/\sum(Y_t-\bar{Y})^2$, so adding a constant $c$ cancels out: $(Y_t+c-\sum(Y_t+c)/n)=Y_t+c-\bar{Y}-c=Y_t-\bar{Y}$. In any case my point was just that if you were to choose that $c=0$ model your residuals would be equal to the raw response data - illustrating why you can use the Ljung-Box test on the time series itself. –  Scortchi Jan 15 '13 at 14:06