1. Home
  2. F2DRESIDUALVARIOGRAM procedure

F2DRESIDUALVARIOGRAM procedure

Calculates and plots a 2-dimensional variogram from a 2-dimensional array of residuals (S.J. Welham).

Options

PLOT = string token What to plot (surface); default surf
ROWS = factor Factor defining the rows of the grid
COLUMNS = factor Factor defining the columns of the grid
REPLICATES = factor Factor defining the replicate grids (if any)
RMAX = scalar Maximum lag to include in variogram in row direction (default determined by procedure)
CMAX = scalar Maximum lag to include in variogram in column direction (default determined by procedure)
RSCALE = scalar Actual distance represented by 1 unit in row direction (default 1)
CSCALE = scalar Actual distance represented by 1 unit in column direction (default 1)
MINREP = scalar Minimum replication required for position to be included in variogram (default 30)
TITLE = text Title for surface/graph; default * i.e. none
WINDOW = scalar Graphics window to be used for plotting; default 1
SCREEN = string token Whether to keep or clear screen before plotting variogram (clear, keep); default clear
METHOD = text Whether to use Fortran DLL or Genstat code to calculate variogram (dll, genstat); default dll
SCALEPLOT = string token Whether to scale variogram to 0-1 (i.e. unit) scale for plotting (unit, none); default unit

Parameters

RESIDUALS = variates Variate of residuals to form variogram
VARIOGRAM = matrices Calculated variogram (trimmed)
FULLVARIOGRAM = matrices Calculated variogram (all values)
COUNTS = matrices Number of comparisons contributing to each variogram position
COMPONENTS = pointers Components used to calculate variogram (only available when METHOD=genstat)

Description

F2DRESIDUALVARIOGRAM calculates and plots a 2-dimensional variogram from a 2-dimensional array of residuals, i.e. residuals that come from an experiment with units arranged in a regular grid.

The data variate is specified by the RESIDUALS parameter, and factors defining the rows and columns of the grid are specified using the ROWS and COLUMNS options. The ROWS and COLUMNS should completely define the layout of the data, except in the case that there are replicates of a grid. In this case, the option REPLICATES should be used to specify a factor defining the replicates of the grid.

The full variogram is calculated for all row lag distances 1 … NLEVELS(ROWS) and all column lag distances 1 … NLEVELS(COLUMNS), unless constrained by options RMAX and CMAX, respectively. This full variogram can be saved using parameter FULLVARIOGRAM, and the number of comparisons contributing to each point can be saved in a corresponding matrix using parameter COUNTS. Missing values will be inserted into the full variogram where the number of comparisons is less than set by option MINREP (default 30). Note that setting MINREP to low values may mean that spurious patterns appear in the variogram.

The full variogram is then trimmed to give a rectangle containing no missing values – this is the variogram that is plotted and can be saved as a matrix using parameter VARIOGRAM.

By default a surface plot is produced for a two-dimensional variogram, i.e. where the trimmed variogram has > 2 rows in both dimensions. If only one dimension has > 2 rows, then a graph will be plotted for that dimension. Note that setting RMAX=1 means that a one-dimensional variogram for COLUMNS can be produced, and vice versa (this can be useful for longitudinal data). Plotting can be suppressed by setting option PLOT=*. Within the plot, difference of scale between row and column directions can be represented by specifying the actual distances represented by each row and column unit using the RSCALE and CSCALE options respectively. The variogram will be scaled onto a 0-1 scale for plotting unless specified by SCALEPLOT=none. A title for the plot can be specifed using the TITLE option. The graphics window used for plotting and whether to keep/clear the screen before plotting are controlled by the WINDOW and SCREEN options as usual.

For large grids, calculation of the variogram using Genstat code can be slow. For the PC Windows implementation a Fortran DLL is available to make the calculations much faster. By default, the procedure finds out if the DLL is available, and if so, uses it. Otherwise Genstat cdoe within the procedure is used. The procedure can be forced to use the Genstat code by setting option METHOD=genstat.

When the Genstat code within the procedure calculates the variogram, the components of the variogram can be saved in a pointer specified by the COMPONENTS option.

Options: PLOT, ROWS, COLUMNS, REPLICATES, RMAX, CMAX, RSCALE, CSCALE, MINREP, TITLE, WINDOW, SCREEN, METHOD, SCALEPLOT.

Parameters: RESIDUALS, VARIOGRAM, FULLVARIOGRAM, COUNTS, COMPONENTS.

Method

The sample variogram position (i, j) is calculated as the average of the half-squared differences between all pairs of residuals i row units and j column units apart.

The variogram is trimmed so that the number of pairs of points contributing to each variogram postion is greater than the setting of MINREP.

Action with RESTRICT

F2DRESIDUALVARIOGRAM takes account of any restriction on RESIDUALS, subject to the factors ROWS, COLUMNS and REPLICATES still defining a valid grid of residuals.

See also

Procedures: DVARIOGRAM, DCOVARIOGRAM, DRESIDUALS, VPLOT.

Commands for: REML analysis of linear mixed models.

Example

CAPTION 'F2DRESIDUALVARIOGRAM','Lupin seeding rate'; STYLE=meta,plain
FACTOR  [NVALUES=96; LEVELS=16] row
&       [LEVELS=6] column
FACTOR  [LEVELS=8; LABELS=!t(Danja,Gungurru,Illyarrie,Merrit,Unicrop,\
        Warrah,Yandee,Yorrel)] variety
READ    variety,row,column,seedrate,yield; FREPRESENTATION=labels,4(levels)
 Illyarrie  1 1 4 0.550  Gungurru  2 1 6 0.895    Merrit  3 1 4 0.802
  Gungurru  4 1 5 0.824  Gungurru  5 1 4 0.687    Yandee  6 1 4 0.779
     Danja  7 1 1 0.545  Gungurru  8 1 1 0.458     Danja  9 1 6 0.958
    Merrit 10 1 1 0.493    Yorrel 11 1 3 0.921    Warrah 12 1 3 0.898
  Gungurru 13 1 3 1.054    Warrah 14 1 1 0.332   Unicrop 15 1 3 0.816
 Illyarrie 16 1 5 0.980    Yorrel  1 2 2 0.503 Illyarrie  2 2 2 0.512
  Gungurru  3 2 2 0.611    Warrah  4 2 5 0.808 Illyarrie  5 2 1 0.358
    Yandee  6 2 2 0.666   Unicrop  7 2 1 0.316    Warrah  8 2 4 0.824
 Illyarrie  9 2 6 0.930   Unicrop 10 2 4 0.710    Warrah 11 2 2 0.408
   Unicrop 12 2 5 1.199     Danja 13 2 2 0.916    Yorrel 14 2 4 1.041
   Unicrop 15 2 6 0.746    Yandee 16 2 6 1.024    Yorrel  1 3 6 0.876
    Warrah  2 3 6 0.683     Danja  3 3 5 1.224    Merrit  4 3 6 1.384
    Yandee  5 3 3 0.748     Danja  6 3 5 1.078    Yandee  7 3 5 1.076
   Unicrop  8 3 2 0.862    Yorrel  9 3 1 0.534    Merrit 10 3 3 1.131
    Merrit 11 3 2 0.958 Illyarrie 12 3 3 1.030     Danja 13 3 4 1.089
     Danja 14 3 3 1.006    Yorrel 15 3 5 1.145    Merrit 16 3 5 1.417
    Yandee  1 4 2 1.241 Illyarrie  2 4 6 1.035   Unicrop  3 4 2 0.743
    Yandee  4 4 3 0.908    Yandee  5 4 6 0.774    Yandee  6 4 4 0.867
    Yorrel  7 4 2 0.600    Merrit  8 4 6 1.516  Gungurru  9 4 5 1.019
 Illyarrie 10 4 5 0.802   Unicrop 11 4 5 0.861     Danja 12 4 6 1.542
  Gungurru 13 4 2 0.517    Yandee 14 4 5 0.828  Gungurru 15 4 4 1.061
     Danja 16 4 2 0.694  Gungurru  1 5 6 1.090    Merrit  2 5 4 1.118
 Illyarrie  3 5 1 0.521   Unicrop  4 5 4 0.959    Yorrel  5 5 4 0.820
    Warrah  6 5 3 0.740 Illyarrie  7 5 3 0.874    Yorrel  8 5 6 1.429
   Unicrop  9 5 1 0.439    Warrah 10 5 2 0.436    Yorrel 11 5 1 0.517
    Warrah 12 5 1 0.340     Danja 13 5 3 1.151   Unicrop 14 5 3 0.995
     Danja 15 5 4 1.197    Yorrel 16 5 3 1.416    Merrit  1 6 3     *
    Yandee  2 6 1     *    Warrah  3 6 6     *    Merrit  4 6 5 1.378
    Warrah  5 6 5 0.845    Yandee  6 6 1 0.553 Illyarrie  7 6 2 0.872
  Gungurru  8 6 1 0.649    Warrah  9 6 4 1.009     Danja 10 6 1 0.660
    Yorrel 11 6 5 1.277    Merrit 12 6 1 0.578   Unicrop 13 6 6 1.010
 Illyarrie 14 6 4 1.162    Merrit 15 6 2 1.097  Gungurru 16 6 3 1.444 :
GROUP       seedrate; FACTOR=frate
VCOMPONENTS [FIXED=variety*seedrate; SPLINE=seedrate+variety.seedrate]\ 
            frate+variety.frate+row.column; CONSTRAINTS=positive
VSTRUCTURE  [TERM=row.column] FACTOR=row,column; MODEL=ar,ar
REML        [PRINT=model,components; MVINCLUDE=yvariate]\
            yield; RESIDUALS=resids
F2DRESIDUALVARIOGRAM [ROW=row; COLUMN=column] resids; VARIOGRAM=variog
PRINT       variog; DECIMALS=3; FIELD=8
Updated on March 8, 2019

Was this article helpful?