1. Home
  2. AFPREP procedure

AFPREP procedure

Searches for an efficient partially-replicated design (R.W. Payne).


PRINT = strings Controls printed output (design, efficiency, factors, monitoring); default * i.e. none
LEVELS = scalar or variate Levels of the treatment factor; if unset, takes the levels declared for the factor specified by the TREATMENTS option
NREPEATS = variate Number of times each treatment occurs in the design
NBLOCKS = scalar Number of blocks
TREATMENTS = factor Treatment factor
BLOCKS = factor Block factor
UNITS = factor Unit-within-block factor
EFFICIENCY = variate Saves the efficiency factors of the treatment term within blocks
NSTARTS = scalar Specifies the number of random starting configurations to take in the search for the best design; default 5
NTRIES = scalar Number of designs to try from each starting configuration; default 20
SEED = scalar Seed for the random numbers used to randomize the design; default 0
TRYSEED = scalar Seed for the random numbers used to select the random starting configurations; default 0
SPREADSHEET = string Whether to put the design factors into a spreadsheet (design); default *

No parameters


Partially replicated designs can be used when a design is too small to provide more than one unit for every treatment. So some treatments occur on only one unit in the design, others occur on two units, and there may be others (usually control treatments) that occur on several. The designs can thus provide an effective way of screening large number of treatments.

The NREPEATS option specifies the number of repeats (i.e. replicates) of each treatment in the design, in a variate with the same number of values as the number of treatments. Also, the sum of its values defines the number of units in the design.

The LEVELS option can be used to define the treatment levels, as in the FACTOR directive, and the TREATMENTS option can save a factor containing the generated values. LEVELS can be omitted if the TREATMENTS factor has already been declared with the right levels.

The NBLOCKS option can be used to specify the number of blocks in the design, and the BLOCKS option can save a factor containing the generated values. NBLOCKS can be omitted if the BLOCKS factor has already been declared with the right number of levels. Note that, if the number of units in the design is not an exact multiple of the number blocks, some blocks will contain one fewer unit than others.

The UNITS option can supply a factor to save the values generated for the unit-within-block factor (which identifies the units within each block).

The SEED option allows you to set the seed to be used to randomize the design. The default setting of zero continues the sequence of random numbers from those used to select the random starting configurations. The NSTARTS, NTRIES and TRYSEED options control the way in which AFPREP searches for the best design, as described in the Method Section.

Printed output is controlled by the PRINT option, with settings:

    design to print the design,
    efficiency to print the harmonic mean and the range of values of the treatment efficiency factors,
    factors to print the factor values, and
    monitoring to provide monitoring information during the search.

During monitoring the current best design is marked by an asterisk (*).

You can set option SPREADSHEET=design to put the design factors into a Genstat spreadsheet.


Parameters: none.


AFPREP uses the AEFFICIENCY procedure to calculate the within-block efficiency factors of the treatments. If there are fewer than 201 treatments, all their efficiency factors are calculated. This is not feasible, however, when there are more treatment. So the unreplicated treatments are then ignored. AFPREP chooses the best candidate design by firstly taking the design with the largest minimum efficiency factor (i.e. it tries to avoid having a low efficiency for any treatment contrast). Then, if there are several designs with the same minimum efficiency factor, it takes the design with the largest harmonic mean efficiency factor; this aims to minimize the (ordinary, arithmetic) average standard error of difference between pairs of treatments. The efficiency factors of the best design can be saved using the EFFICIENCY option.

The candidate designs are generated in a way that avoids any treatment occurring more times than are necessary in the same block. This is done by generating block and unit values with the block factor as the fastest moving factor (i.e. block values that are repeated sequences of 1, 2…), and generating the treatment factor with all the repeated levels together. So the designs that AFPREP considers will differ according to the way in which the different levels are ordered within the treatment factor. It can run through these orderings systematically but, unless there are very few treatment levels, there will be too many orderings to examine them all. So it pursues a mixed strategy, running through a systematic sequence of orderings from several random starting arrangements. The NSTARTS option specifies the number of random starts to make, and the NTRIES option specifies the number of designs to examine in each sequence. The seed for the random numbers used to select the random starts is specified by the TRYSEED option. The default value of zero continues the existing sequence of random numbers if any have been used already in this run of Genstat. Otherwise, it initializes the seed automatically.

See also

Procedure: CDNPREP.

Commands for: Design of experiments.


CAPTION 'AFPREP example',\
        !t('Design for 129 treatments: 96 with a single replicate,',\
        '28 with 2 replicates, 3 controls with 6 replicates,',\
        'and 2 controls with 5 replicates.'); STYLE=meta,plain
VARIATE [VALUES=96(1),28(2),3(6),2(5)] nreps
AFPREP  [PRINT=design,monitor,efficiency; LEVELS=129;\
        NREPEATS=nreps; NBLOCKS=6; TREATMENTS=Treat; BLOCKS=Block;\
        SEED=104623; TRYSEED=2389634]
Updated on June 20, 2019

Was this article helpful?