##### R-code for computing the residuals of the soil data ##### used in Example 4.6 dat = matrix(scan("soil.dat"),ncol=6,byrow=T) x =dat[,4] ar(x) shapiro.test(ar(x)$resid) res = ar(x)$resid[2:length(x)] y = (res-mean(res))/sd(res)