# gof.calculation: Calculate Box-Ljung Goodness of Fit for ARIMA models in... In HH: Statistical Analysis and Data Display: Heiberger and Holland

## Description

Calculate Box–Ljung Goodness of Fit for ARIMA models in S-Plus. In R we use the `Box.test` function.

## Usage

 `1` ```gof.calculation(acf.list, gof.lag, n, n.parms) ```

## Arguments

 `acf.list` An `"acf"` object. `gof.lag` The number of model parameters is the number of lags to use for computing the Portmanteau goodness of fit statistic `n` Number of residuals in model. `n.parms` Number of AR and MA parameters in the model.

## Details

This function is isolated from the S-Plus `arima.diag` function. It is used only in S-Plus.

## Value

See the `gof` value described in `arima.diag` in S-Plus.

## Author(s)

Richard M. Heiberger (rmh@temple.edu)

`arima.diag` in S-Plus.

## Examples

 ```1 2 3 4 5 6 7 8``` ```if.R(s={ co2.arima <- arima.mle(co2, list(list(order=c(0,1,1)), list(order=c(0,1,1), period=12))) co2.acf <- acf(resid(co2.arima), plot=FALSE, lag=40) co2.gof <- gof.calculation(co2.acf, 36, length(co2), 2) xyplot(p.value ~ lag, data=co2.gof, panel=panel.gof, ylim=range(0, co2.gof\$p.value)) },r={}) ```

### Example output

```Loading required package: lattice

Attaching package: ‘TH.data’

The following object is masked from ‘package:MASS’:

geyser