1. Home
  2. APAPADAKIS directive

APAPADAKIS directive

Analysis of variance with an added Papadakis covariate, formed from neighbouring residuals (D.B. Baird).


string tokens
Output from the analysis of the y-variates, adjusted for covariates (aovtable, information, covariates, effects, residuals, contrasts, means, cbeffects, cbmeans, stratumvariances, %cv, missingvalues); default aovt, info, cova, mean, miss
string token
Whether to plot the residuals against the average of neighbouring residuals (residuals); default * i.e. no plot
string token
The neighbours whose residuals are averaged to form the residual covariate (adjacent, rows, columns, all); default adja
TREATMENT STRUCTURE = formula Defines the treatment structure of the model; default given by the most recent TREATMENTSTRUCTUREdirective
BLOCK STRUCTURE = formula Defines the blockings structure of the model; default given by the most recent BLOCKSTRUCTURE directive
Specifies any covariates in addition to the residual (Papadakis) covariate; default given by the most recent COVARIATE directive
Limit on number of factors in a treatment term; default 3
Limit on the order of a contrast of a treatment term; default 4
Limit on the number of factors in a treatment term for the deviations from its fitted contrasts to be retained in the model; default 9
string token
Standard errors to be printed with tables of means, PSE=* requests s.e.’s to be omitted (differences, lsd, means); default diff
Significance level (%) to use in the calculation of least significant differences; default 5


Y = variates Variates to be analysed
ROWS = factors or variates Factor giving the row location of each plot
COLUMNS = factors or variates Factor giving the plot location of each plot
UNITS = factors or variates Factor giving the plot location of each unit
RCOVARIATE = variates Saves the covariate formed from the mean of the neighbouring residuals
TITLE = texts Title for the graph; default i.e. title created from the Y variate name and the neighbouring plots that are used
WINDOW = scalars Window number for the graph; default 3
PEN = scalars, variates or factors Pen number for the graph; default 1
SCREEN = string token Whether to clear the screen before plotting or to continue plotting on the old screen (clear, keep); default clea


The APAPADAKIS procedure analyses balanced designs with an added covariate formed from the neighbouring residuals from the initial analysis of variance (Papadakis 1937, Bartlett 1938, Wilkinson et al. 1983). This method was the first and simplest nearest-neighbour adjustment for removing the effects of spatial trends within a trial. If there is a smooth trend in the trial, the plot’s residual will be correlated with the neighbouring plots’ residuals. Fitting the average of the neighbouring residuals as a covariate can then adjust the treatment means for the trend and reduce their standard errors. This technique has been superceded by spatial REML analyses, but may still be useful for comparison.

The model to be fitted in the analysis has three parts. The TREATMENTSTRUCTURE specifies the treatment (or systematic, or fixed) terms for the analysis. The BLOCKSTRUCTURE defines the “underlying structure” of the design or, equivalently, the error terms for the analysis; in the simple cases where there is only a single error term this can be omitted. The COVARIATE option specifies any covariates to be included, in addition to the residual (Papadakis) covariate. These can be specified as options in the procedure, or defined by previous TREATMENTSTRUCTURE, BLOCKSTRUCTURE and COVARIATE directives.

The Y parameter lists the variates to be analysed. The ROWS and COLUMNS parameters can define the 2-dimensional spatial layout of the design. Alternatively, the UNITS parameter defines a 1-dimensional spatial layout. If UNITS is not specified for a 1-dimensional layout, APAPADAKIS assumes (with a warning) that the y-values are in plot order.

The NEIGHBOURS option controls which neighbours are averaged to form the residual (Papadakis) covariate. The settings rows, columns and all require a 2-dimensional layout. The neighbours for rows are the two plots on either side in the same row, for columns they are the two plots on either side in the same column, for adjacent they are the 4 plots with an edge in common, and for all they are the eight plots with a side or corner in common. For a 1-dimensional layout, adjacent is the only relevant setting. This uses the plots on either side of the given plot as neighbours. Note: edge plots will have fewer neighbours.

The PRINT option selects which components of output are to be displayed:

aovtable analysis-of-variance table;
information information summary, giving details of aliasing and non-orthogonality or of any large residuals;
covariates estimates of covariate regression coefficients;
effects tables of estimated treatment parameters;
residuals tables of estimated residuals;
contrasts estimated contrasts of treatment effects;
means tables of predicted means for treatment terms;
cbeffects estimated effects of treatment terms combining information from all the strata in which each term is estimated;
cbmeans predicted means for treatment terms combining information from all the strata in which each term is estimated; 
stratumvariances estimated variances of the units in each stratum and stratum variance components; 
%cv coefficients of variation and standard errors of individual units; and
missingvalues estimates of missing values.

The default is intended to give the output that you will require most often from a full analysis: aovtable, information, covariates, means and missingvalues. However, as with ANOVA, the settings information and missingvalues will not produce any output unless there is something definite to report.

The PSE option controls the standard errors printed with the tables of means. The default setting is differences, which gives standard errors of differences of means. The setting means produces standard errors of means, LSD produces least significant differences, and you can suppress the standard errors altogether by setting PSE=*. The significance level to use for calculating the least significant differences can be changed from the default of 5% with the LSDLEVEL option.

The treatment terms to be included in the model are controlled by the FACTORIAL option. This sets a limit (by default 3) on the number of factors in a treatment term. Terms containing more than that number are deleted.

The CONTRASTS option places a limit (by default 4) on the order of contrast to be fitted. (Contrasts are defined by using the functions POLREGCOMPARISONPOLND or REGND in the treatment formula.) For a term involving a single factor, the orders of the successive contrasts run from one upwards, with the deviations term (if any) numbered highest. In interactions between contrasts, the order is the sum of the orders of the component parts.

If your design has few or no degrees of freedom for the residual, you may wish to regard the deviations from some of the fitted contrasts as error components, and assign them to the residual of the stratum where they occur. You can do this by the DEVIATIONS option; its value sets a limit on the number of factors in the terms whose deviations are to be retained in the model. For example, by putting DEVIATIONS=1, the deviations from the contrasts fitted to all terms except main effects will be assigned to error. When deviations have been assigned to error, they will not be included in the calculation of tables of means, which will then be labelled “smoothed”. However the associated standard errors of the means are not adjusted for the smoothing.

The RCOVARIATE parameter saves the covariate formed from the neighbouring residuals. Other results from the analysis can be saved with the AKEEP directive, as for the ANOVA directive.

You can set option PLOT=residuals to plot the residuals against the average of neighbouring residuals. The TITLE parameter gives the title for the graph; if this is this not set, an automatic title will be created from the Y variate name and the neighbouring plots that are used. The WINDOW parameter defines the window in which the graph is drawn (default 3). The PEN parameter specifies the pen to use (default 1). Finally, the SCREEN parameter controls whether the graphical display is cleared before the graph is plotted.


Action with RESTRICT

You can restrict the set of units used for the analysis by applying a restriction to any of the y-variates. Only these units are included in the analysis of each y-variate.


Bartlett, M.S. (1938). The approximate recovery of information from replicated field experiments with large blocks. Journal of Agricultural Science28, 418-427.

Papadakis, J.S. (1937). Méthode statistique pour les expériences en champ. Bulletin Institute de L’Ameloration Des Plantes à Salonique, 23.

Wilkinson, G.N., Eckert, S.R., Hancock, T.W. and Mayo O. (1983). Nearest neighbour (NN) analysis of field experiments. Journal of the Royal Statistical Society B45, 151-178.

See also

Commands for: Analysis of varianceDesign of experimentsREML analysis of linear mixed models.


CAPTION        'APAPADAKIS example',\
               !t('Study of 25 wheat cultivars at Slatehall farm',\
               'in a 5x5 lattice square'); STYLE=meta,plain

SPLOAD         [PRINT=*] '%Data%/Slatehall.gsh'

"Simple randomized block analysis"
TREATMENTS     variety
BLOCKS         replicates
ANOVA          [FPROBABILITY=yes; PSE=lsd] yield 

PEN            5...8; SYMBOL='circle','square','triangle','star'; \
               COLOUR='red','darkgreen','blue','black'; CFILL='match'

FOR NN='Row','Column','Adjacent','All';  W=5...8; screen='clear',3('keep')
   TXCONSTRUCT [TEXT=Title] NN,' neighbours'
               yield; ROWS=fieldrow; COLUMNS=fieldcolumn; \
               TITLE=Title; WINDOW=W; PEN=W; SCREEN=#screen

APAPADAKIS     [NEIGHBOURS=rows; PSE=lsd] yield; \
               ROWS=fieldrow; COLUMNS=fieldcolumn

"Lattice square analysis - does better than Padadakis covariate"
POINTER       [NVALUES=NLEVELS(replicates)] PFrow,PFcol
FACTOR        [LEVELS=6; NVALUES=NVALUES(replicates)] PFrow[],PFcol[]
GENERATE      [TREATMENTS=variety; REPLICATES=replicates; BLOCKS=rows] PFrow[]
&             [BLOCKS=columns] PFcol[]
BLOCKS        replicates/(rows*columns)
TREATMENTS    variety//PF[]
ANOVA         [FPROBABILITY=yes; PSE=lsd; LSDLEVEL=5] yield
Updated on February 17, 2022

Was this article helpful?