##############################################################
## Quarterly, west German investment, income, and consumption
## from first quarter of 1960 to fourth quarter of 1982:
##############################################################
data(WestGerman)
DiffData <- matrix(numeric(3 * 91), ncol = 3)
for (i in 1:3)
DiffData[, i] <- diff(log(WestGerman[, i]), lag = 1)
fit <- ar.ols(DiffData, intercept = TRUE, order.max = 2)
lags <- c(5,10)
## Apply the test statistic on the fitted model
Hosking(fit,lags,order = 2) ## True
Hosking(fit,lags) ## True
## Apply the test statistic on the residuals
res <- ts((fit$resid)[-(1:2), ])
Hosking(res,lags,order = 2) ## True
Hosking(res,lags) ## Not True
Run the code above in your browser using DataLab