Generates square lattice and lattice square designs (R.W. Payne).

### Options

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

`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 |

`DESIGNTYPE` = string token |
What type of design to form (`squarelattice` , `latticesquare` ); default `squa` |

### Parameters

`LEVELS` = scalars |
Number of treatments in each design |
---|---|

`NREPLICATES` = scalars |
Number of replicates in each design, taken by default to be the maximum number available in a batch run |

`SEED` = scalars |
Seed for randomization; a negative value implies no randomization |

`TREATMENTS` = factors |
Identifier for the treatment factor for each design |

`PSEUDOFACTORS` = pointers |
Identifier for the pseudo-factors required if the design is not a balanced lattice |

`REPLICATES` = factors |
Identifier for the replicate factor for each design |

`BLOCKS` = factors |
Identifier for the factor to index the blocks within replicates of a square lattice |

`ROWS` = factors |
Identifier for the factor to index the rows within replicates of a lattice square |

`COLUMNS` = factors |
Identifier for the factor to index the columns within replicates of a lattice square |

`UNITS` = factors |
Identifier for the factor to index the units (or plots) within the blocks of a square lattice |

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

`EXCLUDEREPLICATES` = scalars or variates |
Replicates to exclude during randomization |

### Description

`AGSQLATTICE`

can form either square lattice or lattice square designs. These are designs for a single treatment factor with a number of levels that is the square of some integer *k*. The square lattice has replicates, each containing *k* blocks of *k* units (or plots), and different treatment contrasts are confounded with blocks in each replicate. The block structure of the design is thus

`Replicates / Blocks / Units`

Alternatively, the lattice square has a row-by-column structure, with *k* rows and *k* columns within each replicate. So the block structure is now

`Replicates / (Rows * Columns)`

Lattices are used, for example, in variety trials where there are many treatments to examine and the variability of the units is such that the block size needs to be kept reasonably small. For some numbers of treatments, it is possible to generate enough different replicates so that every treatment contrast is confounded with blocks in one of the replicates of a square lattice, or with rows and with columns in one of the replicates in a lattice square. The design is then balanced. If insufficient replicates are available, or if you choose to use less than the full set available, the design is unbalanced and needs pseudo-factors for its analysis by the `ANOVA`

directive. However, `AGSQLATTICE`

can generate these for you automatically.

`AGSQLATTICE`

is easiest to use interactively. It then asks questions to determine the information required to generate the design. Its options and parameters allow you to anticipate questions, or to define all the necessary information if you want to use `AGSQLATTICE`

in batch. However, if 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 `DESIGNTYPE`

option controls whether a square lattice or a lattice square is generated. By default, if you are running Genstat in batch, a square lattice is generated. If you do not set `DESIGNTYPE`

when running interactively, `AGSQLATTICE`

will ask what sort of design you want.

The number of treatments can be defined using the `LEVELS`

parameter. Similarly, the `NREPLICATES`

parameter can define the number of replicates; by default, in a batch run, the maximum available number of replicates is formed. The `SEED`

parameter allows you to specify a seed to be used to randomize the design. In batch the default seed is -1, to suppress randomization. If you do not set `SEED`

when running interactively `AGSQLATTICE`

will ask for a seed, and again a negative value suppresses any randomization. You can use the `EXCLUDEREPLICATES`

parameter to specify a scalar or variate giving numbers of replicates that you do not wish to randomize. (This can be useful in “demonstration experiments”, when the treatments may need to be kept in a systematic order in some parts of the trial, but it is not a good idea in more normal situations.)

The `TREATMENTS`

and `REPLICATES`

parameters allow you to specify identifiers for the treatment and replicate factors, and the `PSEUDOFACTORS`

parameter allows you to specify a pointer to represent the pseudo-factors if these are required. The `BLOCKS`

and `UNITS`

parameters specify identifiers for the block-within-replicate and unit-within-block factors of a square lattice, while the `ROWS`

and `COLUMNS`

parameters specify identifiers for the row- and column-within-replicate factors of a lattice square. If any of these parameters is not specified in a batch run, `AGSQLATTICE`

will use an identifier that is local within the procedure and thus lost at the end of the procedure. If you are running interactively, `AGSQLATTICE`

will ask you to provide identifiers, and these will remain available after it has finished running.

`AGSQLATTICE`

has a `PRINT`

option which 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, `AGSQLATTICE`

will ask whether or not you wish to print the design. Similarly the `ANALYSE`

option governs whether or not `AGSQLATTICE`

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

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.

Options: `PRINT`

, `ANALYSE`

, `DESIGNTYPE`

.

Parameters: `LEVELS`

, `NREPLICATES`

, `SEED`

, `TREATMENTS`

, `PSEUDOFACTORS`

, `REPLICATES`

, `BLOCKS`

, `ROWS`

, `COLUMNS`

, `UNITS`

, `STATEMENT`

, `EXCLUDEREPLICATES`

.

### Method

The design is formed by arranging the *k*×*k* treatments in a square array. For a square lattice, the blocks of the first replicate are formed from the rows of the array and those of the second replicate from the columns. The blocks for other replicates, if required, are formed using the treatment factors of a set of (`NREPLICATES`

-1) mutually orthogonal *k* by *k* Latin squares constructed using procedure `AGLATIN`

. The rows and columns of the *k*×*k* array and the treatment factors of the mutually orthogonal Latin squares are used similarly, in pairs, to form the rows and the columns within each of the replicate of the lattice square.

### See also

Procedures: `AGALPHA`

, `AGCYCLIC`

.

Commands for: Design of experiments, Analysis of variance.

### Example

CAPTION 'AGSQLATTICE example',\ '5 x 5 Lattice with 3 replicates.'; STYLE=meta,plain AGSQLATTICE [PRINT=design; ANALYSE=yes] LEVELS=25; NREPLICATES=3; SEED=-1;\ TREATMENTS=variety; PSEUDOFACTORS=pf;\ REPLICATES=rep; BLOCKS=block; UNITS=plot ASTATUS