1. Home


Display residuals from a REML analysis in field layout (R.W. Payne).


PRINT = string tokens Controls printed output (table); default * i.e. none
PLOT = string tokens Controls the graphs that are displayed (contour, shade); default cont
RMETHOD = string token Which random terms to use to calculate the residuals (final, all, notspline, stfinal, stall); default all
GRAPHICS = string token Type of graph (highresolution, lineprinter); default high
MARGIN = string token Whether to include margins in printed tables (yes, no); default no
YORIENTATION = string token Y-axis orientation of the plot (reverse, normal); default norm
PENCONTOUR = scalar Pen number to be used for the contours; default 1
PENFILL = scalar or variate Pen number(s) defining how to fill the areas between contours; default 3
PENSHADE = scalar or variate Pen(s) to use for the shade plot; default 3


Y = variates or factors Specifies the y-coordinates of the plots
X = variates or factors Specifies the x-coordinates of the plots
SAVE = REML save structures Save structure of the REML analysis from which to take the residuals; default is to take the most recent REML analysis
FIELDWIDTH = scalars Field width for printing the residuals; default 12
DECIMALS = scalars Number of decimal places to use when printing the residuals
TITLE = texts Titles for the plots


VDFIRLDRESIDUALS allows you to display residuals from a REML analysis in a two dimensional layout as, for example, from a field experiment. This can be useful to study the spatial pattern of the residuals, for example to see if there are any systematic trends in fertility.

The locations of the plots are defined by the Y and X parameters, specifying variates or factors containing their y- and x-coordinates respectively. By default the residuals are taken from the most recent REML analysis. However, you can take the residuals from some other analysis, by specifying its save structure using the SAVE parameter.

The RMETHOD option controls which random terms are used to calculate the residuals:

    all all the random effects (default),
    final only the final random term,
    notspline all except any random spline terms,
    stall standardized residuals using all the random effects, and
    stfinal standardized residuals using only the final random term.

Usually, the plots in the experiment will all have different coordinates. However, if there are several plots with the same coordinates, mean residuals are calculated for each location. Thus for example, if you wanted only to look at the block and whole-plot residuals in a split-plot design, you could form the residuals from all the random terms, and then set identical coordinates for the (sub-) plots within each whole plot.

VDFIELDRESIDUALS provides two types of graph, selected by the settings of the PLOT option as follows:

    contour generates a contour plot if the plots are on a regular grid, or a line graph if they are arranged in a single line, and
    shade produces a shade plot for plots that are on a regular grid.

By default PLOT=contour. You can also set option PRINT=table to print the residuals in a table, whose structure corresponds to the field layout,

The GRAPHICS option determines the type of graphics that is used, with settings highresolution (the default) and lineprinter. No graphs can be produced if the plots are in an irregular 2-dimensional arrangement. High-resolution contour plots require more than three rows and columns, and line-printer contour plots require more than four rows and columns.

The way in which the lines are drawn in high-resolution contour plots is defined by the properties of the pen specified by the PENCONTOUR option, while the pen specified by the PENFILL parameter defines how to shade the areas between the contours. Their defaults are 1 and 3 respectively. Similarly, the pen or pens specified by the PENSHADE option control the colouring of the shade plot; the default is to use pen 3. For more information see the DCONTOUR and DSHADE directives.

The MARGIN option, with settings no (default) and yes, determines whether or not marginal means are included with the printed tables. The FIELDWIDTH and DECIMALS parameters can be used to specify the formats of the printed tables (as in the PRINT directive). The TITLE parameter can supply a title. If this is not set, a default title is formed.

The YORIENTATION option controls the orientation of the y-coordinates in the plots and tables. By default this is normal, so that they run upwards from the bottom of the page (as in a map).




VDFIELDRESIDUALS obtains the residuals using the VKEEP directives, and standardizes them (if required) using standard errors from procedure VFRESIDUALS.

Action with RESTRICT

If either of X or Y is restricted, only the unrestricted field plots are displayed.

See also

Directive: REML.


Commands for: REML analysis of linear mixed models.


                 'Slate Hall Farm (Guide to REML in Genstat, Section 1.8).';\
SPLOAD           '%gendir%/data/slatehall.gsh'
VCOMPONENTS      [FIXED=variety] replicates/(rows*columns)
REML             yield
VDFIELDRESIDUALS [PRINT=table; PLOT=contour,shade] Y=fieldrow; X=fieldcolumn
Updated on June 17, 2019

Was this article helpful?