[Rd] tsdiag should pass the fitdf parameter to Box.test

孙庆耀 @unq|ngy@o19970825 @end|ng |rom |c|oud@com
Tue Jun 4 09:36:48 CEST 2019

Dear Everyone,

The document of `tsdiag’ says

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

This implies that we should pass the `fitdf' parameter when applying `Box.test' to residuals. When checking the source code for `getS3method("tsdiag", "Arima”)’, however, I noticed that it didn’t pass this parameter. The relevant line is `for (i in 1L:nlag) pval[i] <- Box.test(rs, i, type = "Ljung-Box")$p.value’. I suppose this could be fixed by passing an additional `fitdf = sum(object$arma[1:4])’.

See also this thread on Cross Validated: https://stats.stackexchange.com/questions/411432/significance-of-the-parameter-fitdf-in-box-test

More information about the R-devel mailing list