[R] Degrees of freedom in the Ljung-Box test

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Aug 27 15:41:17 CEST 2011


Please fix your email settings: your 'From:' field is not in the 
correct encoding, so I had to manually copy the ASCII part. (The 
header as received here said it was UTF-8, but it is not valid UTF-8. 
Most likely no encoding was declared your end.)

On Sat, 27 Aug 2011, Marcin P????ciennik wrote:

> Dear list members,
>
> I have 982 quotations of a given stock index and I want to run a Ljung-Box
> test on these data to test for autocorrelation. Later on I will estimate 8
> coefficients.
> I do not know how many degrees of freedom should I assume in the formula for
> Ljung-Box test. Could anyone tell me please?

Nor does anyone else without knowing what 'x' is.  But from the help 
page:

    fitdf: number of degrees of freedom to be subtracted if ‘x’ is a
           series of residuals.

Details:

      These tests are sometimes applied to the residuals from an
      ‘ARMA(p, q)’ fit, in which case the references suggest a better
      approximation to the null-hypothesis distribution is obtained by
      setting ‘fitdf = p+q’, provided of course that ‘lag > fitdf’.

So is 'x' a set of residuals from an ARMA fit?  If so, the help page 
told you how, and if it is a not a fit note the word 'if' in the 
description of 'fitdf'.

> Below the formula:
>
> Box.test(x, lag = ????, type = c("Ljung-Box"), fitdf = 0)
>
>
> Thank you very much in advance.
> Best regards
> Marcin
>
> 	[[alternative HTML version deleted]]

Please don't send HTML as you were explicitly asked in the posting 
guide. Very likely that exacerbated the encoding confusion.

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

-- 
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


More information about the R-help mailing list