# Diagnostic Residual statistics and plots from spatial analyses

## !SPATIAL

!SPATIAL increases the amount of information reported on the residuals obtained from the analysis of a two dimensional regular grid field trial. The information is written to the .res file.

## Variogram

The variogram has been suggested as a useful diagnostic for assisting with the identification of appropriate variance models for spatial data (Cressie, 1991). Gilmour et al. (1997) demonstrate its usefulness for the identification of the sources of variation in the analysis of field experiments. If the elements of the data vector (and hence the residual vector) are indexed by a vector of spatial coordinates, then the ordinates of the sample variogram are given by the half the variance of the difference between the residuals.

The sample variogram reported by ASReml has two forms depending on whether the spatial coordinates represent a complete rectangular lattice (as typical of a field trial) or not.

In the lattice case, the sample variogram is calculated from the triple (L_ij1,Ll_ij2,v_ij) where L_ij1 and L_ij2 are the displacements in the two directions. As there will be many v_ij with the same displacements, ASReml calculates the means for each displacement pair L_ij1, L_ij2 either ignoring the signs (default) or separately for same sign and opposite sign ( !TWOWAY), after grouping the larger displacements: 9-10, 11-14, 15-20, .... The result is displayed as a perspective plot of the one or two surfaces by absolute displacement group. this case, the two directions may be on different scales.

Otherwise ASReml forms a variogram based on radial coordinates. It calculates the distance between points d_ij= sqrt(L_ij1^2+ L_ij2^2) and an angle theta_ij subtended by the line from (0,0) to (L_ij1, L_ij2) with the x-axis (-180< theta_ij < 180). The angle can be calculated as theta_ij = arctan(L_ij1/L_ij2) choosing (0< theta_ij< 180) since there is radial symmetry (the numbers are the same for ij and ji).

The variogram presented averages the v_ij within 12 distance classes and 4, 6 or 8 sectors (selected using a !VGSECTORS qualifier) centred on an angle of (i-1)*180/s (i=1,...s). A figure is produced which reports the trends in average(v_ij) with increasing distance for each sector.

ASReml also

computes the variogram from predictors of random effects which appear to have a variance structures defined in terms of distance. The variogram details are reported in the .res file.

#### !TWOWAY

!TWOWAY modifies the appearance of the variogram calculated from the residuals obtained from a two dimensional field trial.

The default form is based on absolute 'distance' in each direction. This form distinguishes same sign and different sign distances and plots the variances separately as two layers in the same figure.

#### !VGSECTORS

!VGSECTORS [s]
requests that the variogram formed from the BLUPs predicted for a fac(X,Y) term be based on s (=4, 6 or 8) sectors of size 180/s. The appropriate sectors are centred on the X and Y directions. The details are written to the .res file as well as creating a figure.