[R] Box.test degrees of freedom

David Stoffer dsstoffer at gmail.com
Mon Aug 11 00:25:41 CEST 2008

I stand corrected.  I thought I checked this a long time ago, but apparently
not.  tsdiag.Arima DOES NOT use the fact that the series it is testing (or
diagnosing, if you will) are residuals from an ARIMA fit. 

I keep a list of R time series bloopers here: 
http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm along with some
work-arounds over here: http://www.stat.pitt.edu/stoffer/tsa2/Examples.htm

David Stoffer wrote:
> I believe tsdiag() uses the correct degrees of freedom in applying
> Box.test, but the graphic shows "lag" on the horizontal axis when it
> should display "degrees of freedom".   
> raf.rossignol wrote:
>> Hello,
>> Prof Brian Ripley wrote:
>>> 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.
>> I am also new to R, but it seems to me that there is still something
>> confusing, not in Box.test but in tsdiag.Arima
>> Indeed, the help of tsdiag says "The methods for 'arima' and 'StructTS'
>> [...] use the Ljung-Box version of the portmanteau test." 
>> So we could expect the degrees of freedom 'h-p-q' to be used, but a look
>> at tsdiag.Arima shows it uses Box.test at lags h=1:gof.lag, with degrees
>> of freedom equal to h, and  not h-p-q. Do you think this is a mistake in
>> tsdiag.Arima or is there some experimental (or theoretical) reason
>> supporting this choice ?
>> Best regards

The power of accurate observation is commonly called cynicism 
by those who have not got it.  George Bernard Shaw
View this message in context: http://www.nabble.com/Box.test-degrees-of-freedom-tp17277964p18917747.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list