Plots residuals from an ANOVA analysis (R.W. Payne & A.D. Todd).
Options
RMETHOD = string token |
Type of residuals to plot (simple, standardized); default simp |
|---|---|
INDEX = variate or factor |
X-variable for an index plot; default !(1,2...) |
STRATUM = formula |
The stratum (or error term) whose residuals are to be plotted; the default is to plot the residuals from the final stratum |
GRAPHICS = string token |
What type of graphics to use (lineprinter, highresolution); default high |
TITLE = text |
Overall title for the plots; if unset, the identifier of the y-variate is used |
SAVE = ANOVA save structure |
Specifies the analysis from which the residuals and fitted values are to be taken; by default they are taken from the most recent ANOVA |
Parameters
METHOD = string tokens |
Type of residual plot (fittedvalues, normal, halfnormal, histogram, absresidual, index); default fitt, norm, half, hist |
|---|---|
PEN = scalars, variates or factors |
Pen(s) to use for each plot |
Description
Procedure APLOT provides up to four types of plots of residuals from an ANOVA analysis. These are selected using the METHOD parameter, with settings: fitted for residuals versus fitted values, normal for a Normal plot, halfnormal for a half-Normal plot, histogram for a histogram of residuals, absresidual for a plot of the absolute values of the residuals versus the fitted values, and index for a plot against an “index” variable (specified by the INDEX option). The PEN parameter can specify the graphics pen or pens to use for each plot. The TITLE option can supply an overall title. If this is not set, the identifier of the y-variate is used.
The residuals and fitted values are accessed automatically from the structure specified by the SAVE option. If the SAVE option is not set, they are taken from the SAVE structure of the last y-variate to have been analysed by ANOVA. By default, simple residuals are plotted, but you can set option RMETHOD=standardized to plot standardized residuals instead.
If your design has several strata (or error terms), you can set the STRATUM option to plot the residuals from one of the higher strata. If STRATUM is not set, the residuals from the final stratum are plotted.
By default, high-resolution graphics are used. Line-printer graphics can be used by setting option GRAPHICS=lineprinter.
Options: RMETHOD, INDEX, STRATUM, GRAPHICS, TITLE, SAVE.
Parameters: METHOD, PEN.
Method
Residuals and fitted values are accessed, using AKEEP, from the latest ANOVA or from that specified by the SAVE option. The plots are produced using the DRESIDUALS procedure.
Action with RESTRICT
If the y-variate in the ANOVA was restricted, only the units not excluded by the restriction will be included in the graphs.
See also
Directive: ANOVA.
Procedures: ACHECK, AGRAPH, AFIELDRESIDUALS, RCHECK, VPLOT.
Commands for: Analysis of variance.
Example
CAPTION 'APLOT example 1',\
!t('Data from Snedecor & Cochran (1980), Statistical',\
'Methods, (Iowa State University Press), page 305;',\
'also see the Guide to Genstat, Part 2, Section 4.1.');\
STYLE=meta,plain
FACTOR [LABELS=!T(beef,cereal,pork); VALUES=(1...3)20] Source
& [LABELS=!T(high,low); VALUES=3(1,2)10] Amount
VARIATE [NVALUES=60] Gain
READ Gain
73 98 94 90 107 49
102 74 79 76 95 82
118 56 96 90 97 73
104 111 98 64 80 86
81 95 102 86 98 81
107 88 102 51 74 97
100 82 108 72 74 106
87 77 91 90 67 70
117 86 120 95 89 61
111 92 105 78 58 82 :
BLOCKSTRUCTURE
TREATMENTSTRUCTURE Source*Amount
ANOVA [PRINT=aovtable] Gain
APLOT fittedvalues, normal, halfnormal, histogram
& [GRAPHICS=lineprinter] fittedvalues, normal, halfnormal, histogram
CAPTION 'APLOT example 2',!t('Split plot design, see the',\
'Guide to Genstat, Part 2, Section 4.2.1.'); STYLE=meta,plain
FACTOR [NVALUES=72; LEVELS=6] Blocks
& [LEVELS=3] Wplots
& [LEVELS=4] Subplots
GENERATE Blocks,Wplots,Subplots
FACTOR [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
& [LABELS=!T(Victory,'Golden rain',Marvellous)] Variety
VARIATE Yield; DECIMALS=2; EXTRA=' of oats in cwt. per acre'
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 :
" Convert yields to cwt per acre."
CALCULATE Yield=(Yield*80)/(112*4)
" Define the treatment structure: factorial effects of V and N."
TREATMENTS Variety*Nitrogen
" Subplots nested within whole-plots nested within blocks."
BLOCK Blocks/Wplots/Subplots
ANOVA [PRINT=means] Yield
APLOT
& [STRATUM=Blocks.Wplots]
& [STRATUM=Blocks]
APLOT [GRAPHICS=lineprinter]
& [STRATUM=Blocks.Wplots]
& [STRATUM=Blocks]