Dear colleagues, I am new to R and statistics so please keep that in mind. I have doubts on the df calculation of Ljung-Box test (Box.test). The function seems to use always the df=lag=m and not df=m-p-q like suggested in Ljung and Box (1978) paper (that is referenced). Do you agree with this? If so, is there an R package function that computes Ljung-Box test with the degrees of freedom as described in Ljung and Box (1978) paper? Note: this issue was discussed in http://tolstoy.newcastle.edu.au/R/help/06/03/22768.html (and thread) but it seems with little consensus. Thanks in advance, Nuno ______________________________________________ Centro de Oceanografia - IO-FCUL, Portugal Center for Quantitative Fisheries Ecology - ODU, USA [[alternative HTML version deleted]]
Spencer Graves has discussed this recently ( in the last couple of months ) in a thread and I think his FinTS package has a variant of the Box.test function that does what you need. On Fri, May 16, 2008 at 11:45 AM, Nuno Prista wrote:> Dear colleagues, > > > I am new to R and statistics so please keep that in mind. > > I have doubts on the df calculation of Ljung-Box test (Box.test). The > function seems to use always the df=lag=m and not df=m-p-q like > suggested in > Ljung and Box (1978) paper (that is referenced). > > > Do you agree with this? If so, is there an R package function that > computes > Ljung-Box test with the degrees of freedom as described in Ljung and > Box > (1978) paper? > > > Note: this issue was discussed in > http://tolstoy.newcastle.edu.au/R/help/06/03/22768.html (and thread) > but it > seems with little consensus. > > > > Thanks in advance, > > > Nuno > ______________________________________________ > Centro de Oceanografia - IO-FCUL, Portugal > > Center for Quantitative Fisheries Ecology - ODU, USA > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Bear in mind that Box.test knows nothing about p or q: it says Compute the Box-Pierce or Ljung-Box test statistic for examining the null hypothesis of independence in a given time series. I think you are referring to its application to the residuals of an ARMA(p, q) fit, and that is not what Box.test says it does. It is very easy to edit the code if you want to use a different degrees of freedom. On Fri, 16 May 2008, Nuno Prista wrote:> Dear colleagues, > > I am new to R and statistics so please keep that in mind. > > I have doubts on the df calculation of Ljung-Box test (Box.test). The > function seems to use always the df=lag=m and not df=m-p-q like suggested in > Ljung and Box (1978) paper (that is referenced). > > Do you agree with this? If so, is there an R package function that computes > Ljung-Box test with the degrees of freedom as described in Ljung and Box > (1978) paper? > > Note: this issue was discussed in > http://tolstoy.newcastle.edu.au/R/help/06/03/22768.html (and thread) but it > seems with little consensus. > > Thanks in advance, > > Nuno > ______________________________________________ > > Centro de Oceanografia - IO-FCUL, Portugal > Center for Quantitative Fisheries Ecology - ODU, USA > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595