Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

After an ARMA model is fit to a time series, it is common to check the residuals via the Ljung-Box portmanteau test (among other tests). The Ljung-Box test returns a p value. It has a parameter, h, which is the number of lags to be tested. Some texts recommend using h=20; others recommend using h=ln(n); most do not say what h to use.

Rather than using a single value for h, suppose that I do the Ljung-Box test for all h<50, and then pick the h which gives the minimum p value. Is that approach reasonable? What are the advantages and disadvantages? (One obvious disadvantage is increased computation time, but that is not a problem here.) Is there literature on this?

To elaborate slightly.... If the test gives p>0.05 for all h, then obviously the time series (residuals) pass the test. My question concerns how to interpret the test if p<0.05 for some values of h and not for other values.

share|improve this question
@user2875, I've deleted my answer. Fact is that for large $h$ the test is not reliable. So the answer really depends for which $h$, $p<0.05$. Furthermore what is exact value of $p$? If we decrease the threshold to $0.01$, does the result of the test changes? Personally in case of conflicting hypotheses I look for other indicators whether model is good or not. How well model fits? How does the model compare to alternative models? Do the alternative model have the same problems? For what other violations the test rejects the null? – mpiktas Jan 23 '11 at 19:52
@mpiktas, The Ljung-Box test is based on a statistic whose distribution is asymptotically (as h becomes large) chi-squared. As h gets large relative to n, though, the power of the test decreases to 0. Hence the desire to choose h large enough that the distribution is close to chi-squared but small enough to have useful power. (I do not know what the risk of a false negative is, when h is small.) – user2875 Jan 24 '11 at 0:05
@user2875, this the third time you changed the question. First you ask about the strategy of picking $h$ with smallest value, then how to interpret the test if $p<0.05$ for some values of $h$, and now what is the optimal $h$ to choose. All three questions have different answers and may even have different answers depending on the context of particular problem. – mpiktas Jan 24 '11 at 12:12
@mpiktas, the questions are all the same, just different ways of looking at it. (As pointed out, if p>0.05 for all h, then we know how to interpret the smallest p; if we knew the optimal h--we don't--then we would not be concerned with choosing the smallest p.) – user2875 Jan 24 '11 at 18:43

4 Answers

The answer definitely depends on: What are actually trying to use the $Q$ test for?

The common reason is: to be more or less confident about joint statistical significance of the null hypothesis of no autocorrelation up to lag $h$ (alternatively assuming that you have something close to a weak white noise) and to build a parsimonious model, having as little number of parameters as possible.

Usually time series data has natural seasonal pattern, so the practical rule-of-thumb would be to set $h$ to twice this value. Another one is the forecasting horizon, if you use the model for forecasting needs. Finally if you find some significant departures at latter lags try to think about the corrections (could this be due to some seasonal effects, or the data was not corrected for outliers).

Rather than using a single value for h, suppose that I do the Ljung-Box test for all h<50, and then pick the h which gives the minimum p value.

It's a joint significance test, so if the choice of $h$ is data-driven, then why should I care about some small (occasional?) departures at any lag less than $h$, supposing that it is much less than $n$ of course (the power of the test you mentioned). Seeking to find a simple yet relevant model I suggest the information criteria as described below.

My question concerns how to interpret the test if $p<0.05$ for some values of $h$ and not for other values.

So it will depend on how far from the present it happens. Disadvantages of far departures: more parameters to estimate, less degrees of freedom, worse predictive power of the model.

Try to estimate the model including the MA and\or AR parts at the lag where the departure occurs AND additionally look at one of information criteria (either AIC or BIC depending on the sample size) this would bring you more insights on what model is more parsimonious. Any out-of-sample prediction exercises are also welcome here.

share|improve this answer
+1, this is what I was trying to express but was not able to :) – mpiktas Jan 25 '11 at 14:20

Before you zero-in on the "right" h (which appears to be more of an opinion than a hard rule), make sure the "lag" is correctly defined.

http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm

Quoting the section below Issue 4 in the above link:

"....The p-values shown for the Ljung-Box statistic plot are incorrect because the degrees of freedom used to calculate the p-values are lag instead of lag - (p+q). That is, the procedure being used does NOT take into account the fact that the residuals are from a fitted model. And YES, at least one R core developer knows this...."

Edit (01/23/2011): Here's an article by Burns that might help:

http://lib.stat.cmu.edu/S/Spoetry/Working/ljungbox.pdf

share|improve this answer
@bil_080, the OP does not mention R, and help page for Box.test in R mentions the correction and has an argument to allow for the correction, although you need to supply it manualy. – mpiktas Jan 22 '11 at 20:50
@mpiktas, Oops, you're right. I assumed this was an R question. As for the second part of your comment, there are several R packages that use Ljung-Box stats. So, it's a good idea to make sure the user understands what the package's "lag" means. – bill_080 Jan 22 '11 at 22:29
Thanks--I am using R, but the question is a general one. Just to be safe, I was doing the test with the LjungBox function in the portes package, as well as Box.test. – user2875 Jan 23 '11 at 16:16

Escanciano and Lobato constructed a portmanteau test with automatic, data-driven lag selection based on the Pierce-Box test and its refinements (which include the Ljung-Box test).

The gist of their approach is to combine the AIC and BIC criteria --- common in the identification and estimation of ARMA models --- to select the optimal number of lags to be used. In the introduction of they suggest that, intuitively, ``test conducted using the BIC criterion are able to properly control for type I error and are more powerful when serial correlation is present in the first order''. Instead, tests based on AIC are more powerful against high order serial correlation. Their procedure thus choses a BIC-type lag selection in the case that autocorrelations seem to be small and present only at low order, and an AIC-type lag section otherwise.

The test is implemented in the R package vrtest (see function Auto.Q).

share|improve this answer

... h should be as small as possible to preserve whatever power the LB test may have under the circumstances. As h increases the power drops. The LB test is a dreadfully weak test; you must have a lot of samples; n must be ~> 100 to be meaningful. Unfortunately I have never seen a better test. But perhaps one exists. Anyone know of one ?

Paul3nt

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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