There are 3 types of tests for the residual autocorrelations here (I have a relatively small sample(58 obs):

# Asymptotic  Portmanteau test  for serially correlated errors
# Portmanteau Test (adjusted) for small samples

serial.test(var1, lags.pt = 16, type = "PT.adjusted")#serial correlation
serial.test(var2, lags.pt = 16, type = "PT.adjusted")#no serial correlation on 10%
serial.test(var3, lags.pt = 16, type = "PT.adjusted")#serial correlation
serial.test(var4, lags.pt = 16, type = "PT.adjusted")#serial correlation

# Breusch-Godfrey LM test for small samples (Edgerton-Shukur F test)
serial.test(var1, lags.bg = 5, type = "ES")# no serial correlation
serial.test(var2, lags.bg = 5, type = "ES")# no serial correlation
serial.test(var3, lags.bg = 5, type = "ES")# no serial correlation
serial.test(var4, lags.bg = 5, type = "ES")# no serial correlation

##Test for Autocorrelations
#H0=No autocorrelation
Box.test(resid1[,1],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid1[,2],lag=3,type="Ljung-Box")# Autocorrelation on 5%
Box.test(resid1[,3],lag=3,type="Ljung-Box")# No Autocorrelation 
Box.test(resid1[,4],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid1[,5],lag=3,type="Ljung-Box")# Autocorrelation on 5%

Box.test(resid2[,1],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid2[,2],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid2[,3],lag=3,type="Ljung-Box")# No Autocorrelation 
Box.test(resid2[,4],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid2[,5],lag=3,type="Ljung-Box")# No Autocorrelation

Box.test(resid3[,1],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid3[,2],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid3[,3],lag=3,type="Ljung-Box")# No Autocorrelation 
Box.test(resid3[,4],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid3[,5],lag=3,type="Ljung-Box")# No Autocorrelation

Box.test(resid4[,1],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid4[,2],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid4[,3],lag=3,type="Ljung-Box")# No Autocorrelation 
Box.test(resid4[,4],lag=3,type="Ljung-Box")# No Autocorrelation
Box.test(resid4[,5],lag=3,type="Ljung-Box")# No Autocorrelation

How do I know that I can rely on the results based on this lag (h=3)? Do I need to specify fitdf and how? Can I leave the default lags.pt = 16 and lags.bg = 5? Given that the selection criteria show:

VARselect(DATA[5:58,], lag.max = 4, type = "none")

AIC(n)  HQ(n)  SC(n) FPE(n) 
     4      1      1      2  ,

do I have enough justification that the VAR(2) model is the best fit based on the tests results above (besides the normality tests favor VAR(2) as well)?

How do I know if to include a const or not (in this case not included type = "none")

Many thanks in advance for help and I would be really grateful if some references are available.


You provide very little information about what are you trying to do e.g. your data and the type of model you are trying to fit. In my experience, you will recieve much better help here if you provide some more insight into your problem.
I will give you an example when trying to fit an ARIMA model to some time-series.

After fitting the model you can perform a Ljung-Box test on the residuals to check if they are different than white-noise. So in this case the number of degrees of freedom equals the sum of the AR & MA coefficients from the ARIMA (p,d,q)(P,D,Q) i.e. (p+q+P+Q) usually.

| cite | improve this answer | |
  • 1
    $\begingroup$ See why Ljung-Box test is not appropriate for residuals of ARIMA models here and here and then perhaps reconsider your answer. $\endgroup$ – Richard Hardy Oct 23 '17 at 13:58
  • $\begingroup$ thanks for pointing out. i am not familiar with the reasons why and will look through your link - i was just following the standard textbook example from otexts.org/fpp/8/7 - point 6 in the R code (right before the 4th plot on the page) $\endgroup$ – davidski Oct 23 '17 at 14:04
  • $\begingroup$ Thanks for the reference. The problem of applying the Ljung-Box test on residuals from ARMA model appears to be controversial and its details might not be universally well understood. My guess would be that some of the textbook authors are not aware of the problems with the test, because others criticize it with rather clear argumentation. $\endgroup$ – Richard Hardy Oct 23 '17 at 14:34
  • $\begingroup$ @RichardHardy thank you very much for your comment. I have read these too but it is sometimes rather vague. Do you know based on what I can surely include (exclude) a constant in a VAR model? $\endgroup$ – Arina Olo Oct 23 '17 at 19:37
  • $\begingroup$ @RichardHardy how many lags should I include in the LM test and the portmanteau test? Is it true that I could see that on ACFs and PACFs? In which way? I am currently spending a lot of time reading on these issues but still no clarity. Many thanks in advance for your help! $\endgroup$ – Arina Olo Oct 23 '17 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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