From: Patrick Burns <pburns_at_pburns.seanet.com>

Date: Wed 15 Feb 2006 - 23:17:24 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Feb 15 23:22:43 2006

Date: Wed 15 Feb 2006 - 23:17:24 EST

Hopefully the test is the same no matter what software you are using. A small p-value is an indication that there is structure in the data. So in your case there is no indication of autocorrelation up to lag 5, but it appears that there might be something going on at around lags 6 to 9.

"How small is too small?" is not a reasonable question to ask in general. It depends on how likely it is that there is structure near that lag, how much data you have, how important it is to capture all of the structure in your model versus the harm of overfitting, ...

Patrick Burns

patrick@burns-stat.com

+44 (0)20 8525 0696

http://www.burns-stat.com

(home of S Poetry and "A Guide for the Unwilling S User")

oliver wee wrote:

>Hello, I am using the Ljung Box test in R to compute

*>if the resiudals of my fitted model is random or not.
**>
**>I am not sure though what the results mean, I have
**>looked at various sources on the internet and have
**>come up with contrasting explanations (mainly because
**>these info deal with different program languages, like
**>SAS, SPSS, etc).
**>
**>I know that my residuals should appropriate white
**>noise( is random) since a check of its ACF shows it to
**>be so (signifant correlation only at lag 1, decays
**>very quickly to zero).
**>
**>But I am not sure how to interpret the ljung-box
**>result given by R.
**>
**>To check for randomness of residuals, should the
**>p-value be small or large? How small and how large?
**>And at what lags should I check for the randomness of
**>the residuals? Is a p-value > 0.05 (or < 0.05) enough?
**>What if I have a very large p-value of 0.9796 at lag
**>1, but its value is 0.0139 at lag 8?
**>
**>For example, here's what I got for the first 10 lags
**>of the residuals I'm testing:
**>-------------------
**> Box.test(SP500DataSetFitMA2$residuals, type =
**>"Ljung", lag =1)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 7e-04, df = 1, p-value = 0.9796
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =2)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 0.1088, df = 2, p-value = 0.947
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =3)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 1.4179, df = 3, p-value = 0.7014
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =4)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 3.866, df = 4, p-value = 0.4244
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =5)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 6.0251, df = 5, p-value = 0.3038
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =6)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 12.11, df = 6, p-value = 0.05956
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =7)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 13.0307, df = 7, p-value = 0.07137
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =8)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 19.1766, df = 8, p-value = 0.01394
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =9)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 19.6753, df = 9, p-value = 0.02003
**>
**>
**>
**>>Box.test(SP500DataSetFitMA2$residuals, type =
**>>
**>>
**>"Ljung", lag =10)
**>
**> Box-Ljung test
**>
**>data: SP500DataSetFitMA2$residuals
**>X-squared = 19.7124, df = 10, p-value = 0.03209
**>
**>--------------
**>
**>I know this is not really a programming question, so I
**>apologize if it is inappropriate or if the question is
**>too elementary.
**>
**>Thank you very much for your help.
**>
**>______________________________________________
**>R-help@stat.math.ethz.ch mailing list
**>https://stat.ethz.ch/mailman/listinfo/r-help
**>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
**>
**>
**>
**>
**>
*

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Feb 15 23:22:43 2006

*
This archive was generated by hypermail 2.1.8
: Thu 16 Feb 2006 - 16:09:09 EST
*