# Ljung Box test for residuals of constrained ARIMAX(2,1,0) model

I have this ARIMA(2,1,0) model with one exogenous variable: $$\Delta y_t=c+\phi_2 \Delta y_{t-2}+\beta_x x_t+\varepsilon_t$$

I want to run Ljung Box test of residual autocorrelation with test statistic:

$$Q = n\left(n+2\right)\sum_{k=1}^h\frac{\hat{\rho}^2_k}{n-k}$$

Suppose, I already know what lags $h$ to use. What should be the degrees of freedom here?

• Isn't the degree of freedom set as h − p − q? So h - 2 - 0 ? – Isbister Aug 12 '15 at 20:09
• I don't think you should use the Ljung-Box test in the first place. See this post. – Richard Hardy Aug 13 '15 at 5:31

It is important to emphasize that this test is applied to the residual of the fitted model, NOT THE ORIGINAL SEQUENCE OF DATA.

So we are testing the null: Residuals from the ARIMA model have no auto correlation.

Here is the problem: the number of lags used in the ARIMA model is not h.

h has to be sufficiently large to capture any correlations. Some textbooks recommend h to be at least 10 for non-seasonal data (check http://robjhyndman.com/hyndsight/ljung-box-test/).

Therefore if h=10:

Degrees of freedom: h-p-q In your case: 10 - 2 – 0=8

• The answer to the question comes only in the last line and is not detailed at all (you just state a fact). Consider editing to answer the actual question and provide some motivation for the answer. – Richard Hardy Aug 13 '15 at 5:34