0

Why do we need adjustment when applying Ljung-Box test over residuals? The following is from the Multivariate Time Series Analysis by R. Tsay.

m1 = VAR(data.ts,p=2)
resi=m1$residuals ### Obtain the residuals of VAR(2) fit.
mq(resi,adj=18) ## adj is used to adjust the degrees of freedom.

Regarding the above comment, why and how do we decide a value for adj?

Mark
  • 3
  • 1
  • Are you asking why the adjustment is a specific number (for this model or for any VAR model), or why there needs to be an adjustment *at all* (roughly, because the residuals aren't observations, they are estimates)? – Chris Haug May 04 '17 at 12:00
  • 1
    Mark, see [this answer](https://stats.stackexchange.com/questions/226334/ljung-box-finite-sample-adjustments/226429#226429) for an explanation *why* the adjustment is needed in the first place. It is not very intuitive, but it gives some details. – Richard Hardy May 04 '17 at 14:13

1 Answers1

2

The code you cite appears on page 72 of the book. Right before it, on page 71 you read:

Compared with the Portmanteau test of Chapter 1, the degrees of freedom of the chi-square distribution in Theorem 2.6 is adjusted by $pk^2$, which is the number of AR parameters in a VAR(p) model. In practice, some of the AR parameters in a VAR(p) model are fixed to 0. In this case, the adjustment in the degrees of freedom of the chi-square distribution is set to the number of estimated AR parameters.

The adj is the degrees-of-freedom adjustment (as you can read in the help file for the mq function). In the example, adj=18 because $18=2\times 3^2$ since the model has a trivariate response ($k=3$) and two autoregressive lags ($p=2$).

Richard Hardy
  • 54,375
  • 10
  • 95
  • 219
  • Thanks Richard. I cannot upvote the answer as I have fewer than 15 reputations. Moreover, I used AIC to fit VAR(2) model but Ljung-Box test gives better results with VAR(3) model. Can we use Ljung-Box statistic to select the order of the model? – Mark May 05 '17 at 04:14
  • @Mark, it depends on what you want to use the model for. E.g. if you want to do forecasting, then AIC is a sounder basis for model selection than the Lung-Box test (which can lead to overfitting). – Richard Hardy May 05 '17 at 05:21