1. Home
  2. ASWEEP procedure

ASWEEP procedure

Performs sweeps for model terms in an analysis of variance (R.W. Payne).

Options

TERM = formula Model term (or terms) involved in the sweep (this need not be specified if EMETHOD=given); default is to sweep for the grand mean
EFFICIENCY = scalar Efficiency factor of the term(s)
EMETHOD = string token Source of the effects (calculated, given); default calc
RMETHOD = string token Method to be used to obtain the residual variate (subtract, replace); default subt

Parameters

Y = variate Working variates to be swept
EFFECTS = table Estimated effects
RESIDUALS = variate New working variates, following the sweep
SS = scalars Sum of squares due to the term(s)
RSS = scalars Sum of squares of the working variate after the sweep

Description

The analysis-of-variance algorithm in the Genstat ANOVA directive involves a series of sweep operations performed on a working variate which initially contains the data values and finally contains the residuals. Sweeps may have two parts. The first involves the estimation of the effects of a particular term. For a term that is orthogonal to the terms that preceed it in the model, the effects are estimated simply by the tables of means for that term, calculated from the working variate; for non-orthogonal terms, the effects are the means divided by an efficiency factor. In the second part, the working variate is modified. Usually this involves subtracting the estimated effects. Alternatively there is a special sweep, known as a pivot, which is used to initiate the analysis within a stratum. In this, the value in each unit of the working variate is replaced by the corresponding effect of the term. Further details can be found in the Guide to the Genstat Command Language, Part 2, Section 4.7.5, or in the paper by Payne & Wilkinson (1977). Procedure ASWEEP is provided as a research tool for studying the algorithm and its properties.

The values initially in the working variate are specified by the Y parameter. The procedure can sweep for a single term or, if several terms have the same efficiency factor, these can all be swept together. The TERM option specifies the term (or terms) and the efficiency factor is defined by the EFFICIENCY option. The EFFECTS parameter allows the estimated effects of the term(s) to be stored if option EMETHOD=calculated, or to be supplied if EMETHOD=given. The values in the working variate after the sweep can be saved using the RESIDUALS parameter, and the RMETHOD option indicates whether these are to be formed by an ordinary sweep (RMETHOD=subtract) or by a pivot (RMETHOD=replace). The SS parameter saves the sum of squares due to the term(s), and the RSS parameter saves the sum of squares of the working variate after the sweep.

Options: TERM, EFFICIENCY, EMETHOD, RMETHOD.

Parameters: Y, EFFECTS, RESIDUAL, SS, RSS.

Method

The procedure uses the standard Genstat directives for analysis of variance, calculations and manipulation.

Action with RESTRICT

If the working variate (specified by the Y parameter) is restricted, the sweep will use only the units not excluded by the restriction.

Reference

Payne, R.W. & Wilkinson, G.N. (1977). A general algorithm for analysis of variance. Applied Statistics, 26, 251-260.

See also

Directive: ANOVA.

Procedures: AEFFICIENCY, AMTIER, FPROJECTIONMATRIX.

Commands for: Analysis of variance.

Example

CAPTION    'ASWEEP example',\
           !t('Sweeps required to analyse the design',\
           'discussed by Payne & Wilkinson (1977).'); STYLE=meta,plain
FACTOR     [NVALUES=32; LEVELS=2] A,Pf
&          [LEVELS=4] B,Plots
&          [LEVELS=8] Blocks
GENERATE   Blocks,Plots
READ       [PRINT=*] A,B,Pf
1 1 2  2 2 1  2 3 1  1 4 2
2 1 2  1 2 1  1 3 1  2 4 2
2 1 2  1 2 1  2 3 1  1 4 2
1 1 2  1 3 1  2 2 1  2 4 2
2 1 2  1 3 1  2 2 1  1 4 2
1 1 2  1 2 1  2 3 1  2 4 2
1 2 1  1 3 1  2 2 1  2 3 1
1 1 2  2 1 2  1 4 2  2 4 2 :
VARIATE    [NVALUES=32] Yv
READ       [PRINT=*] Yv
101  291  373  398      106  265  312  450
 89  272  338  407      106  324  306  449
128  323  334  423       87  279  324  471
302  324  272  361      131  103  445  437 :
POINTER    [NVALUES=!t('Blocks stratum:        B       ',\
                       '..............:        A.B     ',\
                       '..............:        Residual',\
                       'Blocks.Plots stratum:  A       ',\
                       '....................:  B       ',\
                       '....................:  A.B     ',\
                       '....................:  Residual')] ss
" sweep for the grand mean "
ASWEEP     Yv; RESIDUAL=Y
" sweep for Blocks "
ASWEEP     [TERM=Blocks] Y; RESIDUAL=Y; EFFECTS=EffBl
" Blocks.Plots stratum: sweep for A "
ASWEEP     [TERM=A] Y; RESIDUAL=Y; SS=ss[4]
"                       sweep for pseudo-term Pf "
ASWEEP     [TERM=Pf; EFFICIENCY=0.75] Y; RESIDUAL=Y; SS=PSS
"                       reanalysis sweep for Blocks "
ASWEEP     [TERM=Blocks] Y; RESIDUAL=Y
"                       sweep for B "
ASWEEP     [TERM=B] Y; RESIDUAL=Y; SS=ss[5]
CALCULATE  ss[5] = ss[5] + PSS
"                       sweep for pseudo-term A.Pf "
ASWEEP     [TERM=A.Pf; EFFICIENCY=0.75] Y; RESIDUAL=Y; SS=PSS
"                       reanalysis sweep for Blocks "
ASWEEP     [TERM=Blocks] Y; RESIDUAL=Y
"                       sweep for A.B "
ASWEEP     [TERM=A.B; EFFICIENCY=0.75] Y; RESIDUAL=Y; SS=ss[6]
CALCULATE  ss[6] = ss[6] + PSS
"                       reanalysis sweep for Blocks "
ASWEEP     [TERM=Blocks] Y; RESIDUAL=Y; RSS=ss[7]
" Blocks stratum: initial pivot "
ASWEEP     [TERM=Blocks; EMETHOD=given; RMETHOD=replace] Y; RESID=Y; EFF=EffBl
"                 sweep for pseudo-term Pf "
ASWEEP     [TERM=Pf; EFFICIENCY=0.25] Y; RESIDUAL=Y; SS=ss[1]
"                 reanalysis sweep (pivot) for Blocks "
ASWEEP     [TERM=Blocks; RMETHOD=replace] Y; RESIDUAL=Y
"                 sweep for pseudo-term A.Pf "
ASWEEP     [TERM=A.Pf; EFFICIENCY=0.25] Y; RESIDUAL=Y; SS=PSS
"                 reanalysis sweep (pivot) for Blocks "
ASWEEP     [TERM=Blocks; RMETHOD=replace] Y; RESIDUAL=Y
"                 sweep for A.B "
ASWEEP     [TERM=A.B; EFFICIENCY=0.25] Y; RESIDUAL=Y; SS=ss[2]
CALCULATE  ss[2] = ss[2] + PSS
"                 reanalysis sweep (pivot) for Blocks "
ASWEEP     [TERM=Blocks; RMETHOD=replace] Y; RESIDUAL=Y; RSS=ss[3]
SCALAR     Chan
ENQUIRE    Chan; FILETYPE=output; OUTSTYLE=Style
OUTPUT     [STYLE=plain]
PRINT      [SERIAL=yes; SQUASH=yes; ORIENTATION=across] ss[]; DECIMALS=1
OUTPUT     [STYLE=#Style]

" compare with ANOVA "
BLOCKS     Blocks/Plots
TREATMENTS A*(B//Pf)
ANOVA      [PRINT=aov] Yv
Updated on March 8, 2019

Was this article helpful?