# Can I use the Ljung-Box test on out-of-sample prediction errors?

I know that tests like Ljung-Box and Breusch-Godfrey are often used to test the residuals of a fitted ARMA model for whiteness. But say I want to evaluate how well my model describes a new data set that is independent of the one used to fit the model. Is there any problem with just using the prediction errors from this data set as the "residuals" in the LB test?

My experiments suggest that this works well for the purposes of detecting anomalous data sets. The test statistic fits well with the chi-square distribution with L degrees of freedom, where L is the number of lags. But I haven't seen this method described anywhere, so I would like to know if it is OK to use.

If anyone can suggest relevant articles on the topic, that would be very helpful.

• Please register &/or merge your accounts (you can find information on how to do this in the My Account section of our help center), then you will be able to edit & comment on your own question. – gung Dec 15 '16 at 22:03

$$H_0\colon \phi_1 = \phi_2 = ... = \phi_k = 0$$
where $\phi_k$ is the autocorrelation for the $k$-lag.
$$H_1\colon \text{at least one }\phi \neq 0.$$