Generates generally balanced designs (R.W. Payne).

### Options

`PRINT` = string token |
Controls whether or not to print a plan of the design and whether to print a catalogue of the designs in the subfile (`design` , `catalogue` ); if unset in an interactive run `AGDESIGN` will ask whether the design is to be printed, in a batch run the default is not to print anything |
---|---|

`ANALYSE` = string token |
Controls whether or not to analyse the design, and produce a skeleton analysis-of-variance table using `ANOVA` (`no` , `yes` ); default is to ask if this is unset in an interactive run, and not to analyse if it is unset in a batch run |

`FILENAME` = text |
Name of the backing store file containing the design information; default uses the standard design file |

`SUBFILE` = identifier |
Subfile of the backing store file to be used |

### Parameters

`DESIGN` = variates |
Contains codes to indicate the choice of design |
---|---|

`TREATMENTFACTORS` = pointers |
Specifies identifiers for the treatment factors |

`BLOCKFACTORS` = pointers |
Specifies identifiers for the block factors |

`PSEUDOFACTORS` = pointers |
Specifies identifiers for any pseudo-factors |

`REPLICATEFACTOR` = factors |
Specifies the identifier of the factor to represent the replicates (if any) in each design |

`UNITLABELS` = variates |
Specifies the identifier of a variate to store a unique numerical label for each plot in the design |

`SEED` = scalars |
Seed to be used to randomize each design; a negative value implies no randomization |

`STATEMENT` = texts |
Saves a command to recreate each design (useful if the design information has been specified in response to questions from `AGDESIGN` ) |

### Description

`AGDESIGN`

generates the factors and, if necessary, pseudo-factors required to define a generally balanced design. It also sets the block and treatment formulae (using the `BLOCKSTRUCTURE`

and `TREATMENTSTRUCTURE`

directives) to allow the design to be analysed by `ANOVA`

. It can be accessed most conveniently through interactive Genstat *design system*, using the procedure `DESIGN`

.

`AGDESIGN`

relies upon a backing-store subfile that contains a repertoire of available designs, together with the information required to form them. `FILENAME`

has a default file containing four subfiles.

`FACTORIAL`

– factorial designs (with blocking): these have several treatment factors and a single blocking factor (giving strata for blocks and plots within blocks); the blocks are too small to contain a complete replicate of the treatment combinations and so various interaction are confounded with blocks.

`LATTICE`

– lattice designs: designs for a single treatment factor with number of levels that is the square of some integer *k*; the design has replicates, each containing *k* blocks of *k* plots, and different treatment contrasts can be confounded with blocks in each replicate.

`LATTSQ`

– lattice squares: these are similar to lattices except that the blocking structure with the replicates has rows crossed with columns; again different treatment contrasts can be confounded with the rows and columns in each replicate.

`LATIN`

– Latin squares: designs are available for 3 to 14 treatments; several different orthogonal squares are available for most of these so, for example, Graeco Latin squares can be formed by using a different square for each of the two treatment factors.

If the default `FILENAME`

is being used, the usual abbreviation rules are used to match `SUBFILE`

with the names of the subfiles in the default file.

The backing-store file can be created by a procedure called `FDESIGNFILE`

. This requires a data file, details of whose format can be obtained by setting option `PRINT=filestructure`

when running `FDESIGNFILE`

. You can thus provide additional files of designs which can be accessed by setting the `FILENAME`

and `SUBFILE`

options as appropriate.

`AGDESIGN`

has two other options. The `PRINT`

option can be set to `design`

to print the plan of the design. By default, if you are running Genstat in batch, the plan is not printed. If you do not set `PRINT`

when running interactively, `AGDESIGN`

will ask whether or not you wish to print the design. The other setting `catalogue`

lists the designs in the subfile. Similarly the `ANALYSE`

option governs whether or not `AGDESIGN`

produces a skeleton analysis-of-variance table (containing just source of variation, degrees of freedom and efficiency factors). Again `AGDESIGN`

assumes that this is not required if `ANALYSE`

is unset in a batch run, and asks whether it is required if `ANALYSE`

is unset in an interactive run.

The information required to select the design and give identifiers to its factors can be defined using the parameters of `AGDESIGN`

. In an interactive run, `AGDESIGN`

will ask questions to obtain any necessary information that is not supplied in this way; when running in batch, if any of the required information has not been specified, `AGDESIGN`

will terminate with a warning message.

It is thus easiest to use `AGDESIGN`

interactively. Then only the `SUBFILE`

option need be set (assuming that you are happy to use the standard default design file), and the other information will be obtained by (clearly explained) questions. You need set the parameters only if you wish to anticipate some of the questions, or if you wish to use `AGDESIGN`

in batch. If, however, you wish to recreate the same design later, the `STATEMENT`

parameter allows you to save a Genstat text structure containing a command specifying the same information.

The `DESIGN`

parameter can supply a variate whose first value selects the “type” of design: for example, in the `LATTICE`

subfile, this would select between a 3×3 lattice, a 4×4 lattice, and so on. Some of these designs are available in several different “versions”: for example, in lattice designs there are several ways of defining which treatment contrasts are to be confounded with blocks. If there is more than one version, the second and subsequent values of the `DESIGN`

variate indicate which version, or versions, are required. These need not be distinct so, for example, you can replicate a basic design several times. If the variate has a single value, `AGDESIGN`

will select the first version.

The `TREATMENTFACTORS`

parameter can specify a pointer to supply identifiers for the treatment factors in the design. For example, if there are two factors you could define their identifiers to be `A`

and `B`

by forming the pointer `Tf`

(say) with the statement

`POINTER [VALUES=A,B] Tf`

and then setting `TREATMENTFACTORS=Tf`

. Alternatively, and more succinctly, you could put `TREATMENTFACTORS=!p(A,B)`

, where `!p(A,B)`

is an unnamed pointer containing the required two identifiers. Similarly the `BLOCKFACTORS`

parameter can specify a pointer to define the identifiers for the block factors in the basic design. If you have requested several versions, or several replicates, of the basic design `AGDESIGN`

will also need a factor to represent the replicates. The identifier of this factor can be supplied using the `REPLICATEFACTOR`

parameter. Partially balanced designs, such as lattices, will require pseudo-factors in the treatment formula to enable the design to be analysed by `ANOVA`

. Identifiers can be supplied for these using the `PSEUDOFACTORS`

parameter.

The `UNITLABELS`

parameter can specify a variate to store a unique number to label each of the plots in the design. In the first replicate (or version) in the generated design, the variate contains the numbers one up to the number of plots per replicate. The second replicate (if any) contains these numbers plus the smallest power of ten greater than the number of plots per replicate, the third replicate contains the numbers plus twice this power of ten, and so on.

The `SEED`

parameter allows you to specify a seed to randomize the design. In a batch run, this has a default of -1, to suppress randomization. If `SEED`

is unset in an interactive run, you will be asked to provide a seed (and again a negative value will leave the design unrandomized).

Options: `PRINT`

, `ANALYSE`

, `FILENAME`

, `SUBFILE`

.

Parameters: `DESIGN`

, `TREATMENTFACTORS`

, `BLOCKFACTORS`

, `PSEUDOFACTORS`

, `REPLICATEFACTOR`

, `UNITLABELS`

, `SEED`

, `STATEMENT`

.

### Method

The `QUESTION`

procedure is used to obtain the details of the required design. The design is then generated using `GENERATE`

and the other standard Genstat directives for calculation and manipulation.

### See also

Procedures: `AGFACTORIAL`

, `AGFRACTION`

, `AGHIERARCHICAL`

, `FDESIGNFILE`

.

Commands for: Design of experiments, Analysis of variance.

### Example

CAPTION 'AGDESIGN example',!t(\ 'This prints the (unrandomized) plan of a single',\ 'replicate of a 2x2x2x2 in blocks of size 4 (this is the',\ 'fourth design in subfile FACTORIAL of the standard design file).');\ STYLE=meta,plain AGDESIGN [PRINT=design; ANALYSE=no; SUBFILE=FACTORIAL] DESIGN=4;\ TREATMENTFACTORS=!p(A,B,C,D); BLOCKFACTORS=!p(Blocks,Plots);\ SEED=-1; UNITLABELS=Plotlab " To see the full repertoire of designs, you should run AGDESIGN interactively, without setting the DESIGN parameter."