Display residuals in field layout (R.W. Payne & A.D.Todd).
Options
PRINT = string tokens |
Controls output (contour, shade, table); default cont |
|---|---|
GRAPHICS = string token |
Type of graph (highresolution, lineprinter); default high |
METHOD = string token |
Type of residuals to take from the save structure when the RESIDUALS parameter is not specified (combined, finalstratum, standardizedfinal); default comb |
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 |
Parameters
Y = variates or factors |
Specifies the y-coordinates of the plots |
|---|---|
X = variates or factors |
Specifies the x-coordinates of the plots |
RESIDUALS = variates |
Residuals to be plotted; default is to take the residuals from the save structure specified by the SAVE option, or from the most recent ANOVA if that is unspecified |
SAVE = ANOVA, REML or regression save structures |
Save structure of the ANOVA, REML or regression analysis from which to take the residuals if the RESIDUALS parameter is not specified; default is to take the most recent ANOVA 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 |
Description
In a field experiment it 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. The residuals can be supplied, in a variate, by the RESIDUALS parameter. If this is not set, the default is to take the residuals from the most recent ANOVA analysis. You can take the residuals from some other analysis, by specifying its save structure using the SAVE parameter. This can be from another ANOVA analysis, a REML analysis or a regression analysis (see MODEL).
The METHOD option determines the type of residuals that are taken. The default setting combined gives residuals combining the residuals from all the strata or error terms in the analysis. These corresponds to the CBRESIDUALS option of the AKEEP directive, or the use of the RESIDUALS option in VKEEP with option RMETHOD=all. Regression allows only a single error term, so combined is treated as the same as the next setting, finalstratum.
The setting finalstratum uses simple residuals from the final stratum or error term. These correspond to the RESIDUALS option of AKEEP with option RMETHOD=simple, or the RESIDUALS option of VKEEP with option RMETHOD=final, or the RESIDUALS parameter of RKEEP with option RMETHOD=simple.
The last setting, standardizedfinal, uses standardized residuals from the final stratum or error term. These correspond to the RESIDUALS option of AKEEP with option RMETHOD=standardized, or the RESIDUALS parameter of RKEEP with option RMETHOD=deviance. They are calculated using standard errors from procedure VFRESIDUALS for REML analyses.
Usually, the plots 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 request combined residuals and then set identical coordinates for the (sub-) plots within each whole plot.
AFIELDRESIDUALS provides three forms of representation, selected using the PRINT option as follows:
table |
prints the residuals in a table whose structure corresponds to the field layout, |
|---|---|
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 |
can produce a shade plot for plots that are on a regular grid. |
The GRAPHICS option determines the type of graphics that is used, with settings highresolution (the default) and lineprinter. No graph can be produced if the plots are in an irregular 2-dimensional arrangement. High-resolution contour plots require more than 3 rows and columns, and line-printer contour plots require more than 4 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 summaries 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 for the plots. If this is unset, 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).
Options: PRINT, GRAPHICS, METHOD, MARGIN, YORIENTATION, PENCONTOUR, PENFILL, PENSHADE.
Parameters: Y, X, RESIDUALS, SAVE, FIELDWIDTH, DECIMALS, TITLE.
Method
AFIELDRESIDUALS obtains the residuals using the AKEEP, VKEEP or RKEEP directives, and then uses the standard Genstat facilities for manipulation and plotting.
Action with RESTRICT
If any of X, Y or RESIDUALS is restricted, only the unrestricted plots are displayed.
See also
Directive: ANOVA.
Procedures: AGRAPH, APLOT, VDFIELDRESIDUALS.
Commands for: Analysis of variance.
Example
CAPTION 'AFIELDRESIDUALS example',!t(\
'Split plot design (Yates,F: The Design and Analysis of Factorial',\
'Experiments Commonwealth Bureau of Soils, Tech. Comm. 35 p.74)');\
STYLE=meta,plain
FACTOR [NVALUES=72; LEVELS=6] Block
& [LEVELS=3] Wplot
& [LEVELS=4] Subplot
GENERATE Block,Wplot,Subplot
FACTOR [NVAL=72; LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
& [NVAL=72; LABELS=!T(Victory,'Golden rain',Marvellous)] Variety
READ [SERIAL=yes] Nitrogen,Variety,Yield
4 3 2 1 1 2 4 3 1 2 3 4 3 1 2 4 4 1 2 3 2 1 3 4
2 3 4 1 4 2 3 1 1 4 2 3 3 4 1 2 1 3 4 2 2 3 4 1
4 1 3 2 3 4 1 2 3 4 2 1 3 1 4 2 4 3 1 2 1 2 3 4 :
3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2
2 2 2 2 3 3 3 3 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1
2 2 2 2 1 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 :
156 118 140 105 111 130 174 157 117 114 161 141
104 70 89 117 122 74 89 81 103 64 132 133
108 126 149 70 144 124 121 96 61 100 91 97
109 99 63 70 80 94 126 82 90 100 116 62
96 60 89 102 112 86 68 64 132 124 129 89
118 53 113 74 104 86 89 82 97 99 119 121 :
BLOCKSTRUCTURE Block/Wplot/Subplot
TREATMENTSTRUCTURE Variety*Nitrogen
ANOVA [PRINT=aov,means,residuals; FPROBABILITY=yes] Yield
VARIATE X,Y; VALUES=!((1,2)18,(3,4)18),!((2(18...1))2)
AFIELDRESIDUALS [PRINT=contour,shade,table] Y=Y; X=X
& [METHOD=final] Y=Y; X=X
& [METHOD=standardizedfinal] Y=Y; X=X