1. Home
  2. AGSEMILATIN procedure


Generates semi-Latin squares (W. van den Berg).


PRINT = string token Controls whether or not to print a plan of the design (design); if unset in an interactive run AGSEMILATIN will ask whether the design is to be printed, in a batch run the default is not to print anything
METHOD = string token Method to use to construct the semi-Latin square (Trojan, interleaving, inflated); if unset in an interactive run AGSEMILATIN will ask what type is required, in a batch run the default is Trojan
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


NROWS = scalars Number of rows and columns of the semi-Latin square
NUNITS = scalars Number of units (i.e. treatments) within each block
SEED = scalars Seed for randomization; a negative value implies no randomization
TREATMENTS = factors Identifier for the treatment factor
ROWS = factors Identifier for the row factor
COLUMNS = factors Identifier for the column factor
UNITS = factors Identifier for the unit factor
PSEUDOFACTOR = factors Identifier for the pseudo-factor
STATEMENT = texts Saves a command to recreate the design (useful if the design information has been specified in response to questions from AGSEMILATIN)


AGSEMILATIN generates the factors and pseudo-factor required to define a semi-Latin square. It also sets the block and treatment formulae (using the BLOCKSTRUCTURE and TREATMENTSTRUCTURE directives) to allow the design, if balanced, to be analysed by ANOVA.

An (n × n)/k semi-Latin square is like an n × n Latin square except that there are k letters in each cell. The combinations of the rows and columns of a semi-Latin square are called blocks. Each of the n × k letters occurs once in each row and once in each column. The design thus has n rows and columns, k (sub-) units within each row × column combination (or block), and n × k treatments. The analysis should contain strata for rows, columns, rows.columns and rows.columns.units, as well as treatment effects which may be estimated in either the rows.columns or the rows.columns.units strata. AGSEMILATIN enables you to construct three types of semi-Latin square.

Trojan squares: a Trojan square consist of a set of k mutually orthogonal n × n Latin squares, on k disjoint sets of treatments. Each block of the semi-Latin square contains the treatments which occur in the corresponding cell of all the individual squares (Bailey 1988). AGSEMILATIN can construct Trojan squares for any value of n for which a Graeco-Latin square exists. Thus, for example, no Trojan square exists for n = 6. In a Trojan square k must be greater than 1 and less than n (Edmondson 1998), and for some values of n, k must be less than that. The maximum values of k for n up to 15 for a Trojan square are

n: 3 4 5 7 8 9 11 12 13 14 15

k: 2 3 4 6 6 8 10 2 12 2 2

In a Trojan square, some treatment effects are estimated in both the rows.columns and the rows.columns.units strata, while others (which need to be represented by a pseudo-factor) are estimated only in the rows.columns.units stratum. Trojan squares are optimal semi-Latin squares (Bailey 1992).

Inflated Latin squares: an (n × n)/k inflated Latin square consists of an n × n Latin square with each letter replaced by k new symbols (Bailey 1988). AGSEMILATIN can construct inflated Latin squares for any value of n greater than 2, and any value of k greater than 1. The analysis requires a pseudo-factor to distinguish the treatment contrasts that are estimated in the rows.columns stratum from those estimated in the rows.columns.units stratum.

Interleaving Latin squares: these are formed similarly to the Trojan square, except that there is no longer the requirement for the k Latin squares to be orthogonal (Bailey 1988). If the squares are orthogonal, the design is a Trojan square and can be analysed by ANOVA with the help of a pseudo-factor as described above. For n=2 the design is an inflated Latin square and can be analysed by ANOVA, again with the help of a pseudo-factor. Otherwise, the design is unbalanced. It is possible to generate a balanced analysis by omitting the row.column stratum, but this is not reasonable and Yates (1935) advises against such an analysis. AGSEMILATIN can construct interleaving Latin squares for any value of n or k greater than 1.

The type of semi-Latin square can be chosen using the METHOD option with setting either Trojan, inflated, or interleaving. In a batch run the default is Trojan, while in an interactive run AGSEMILATIN will ask what type you want. AGSEMILATIN 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, AGSEMILATIN will ask whether or not you wish to print the design. Similarly the ANALYSE option governs whether or not AGSEMILATIN produces a skeleton analysis-of-variance table (containing just source of variation, degrees of freedom and efficiency factors). Again AGSEMILATIN 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 AGSEMILATIN. The number of rows and columns of the design (n) can be defined using the parameter NROWS. Similarly, the number of units (k) for each row-column combination (that is, the number of treatments per block) can be defined by the parameter NUNITS. Parameters TREATMENTS, ROWS, COLUMNS, UNITS and PSEUDOFACTOR allow you to specify identifiers for the treatment, row, column and unit factors, and for the pseudo-factor. 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). If one of the other parameters is unset in an interactive run, you will be asked to provide a name.

The STATEMENT parameter allows you to save a Genstat text structure containing a command to recreate the design. This is particularly useful when you are running AGSEMILATIN interactively, and specifying the information in response to questions.




The QUESTION procedure is used to obtain the details of the required design.

Trojan squares are formed by constructing k orthogonal Latin squares with procedure AGLATIN.

For constructing an inflated Latin square, first one of the possible orthogonal Latin squares is generated with procedure AGLATIN. The generated treatment factor provides the “plot” factor. Each cell is split in k units with a corresponding “unit” treatment factor. Procedure FACPRODUCT then forms the treatment factor from the n × k combinations of the plot and unit factors.

If an interleaving Latin square is chosen which fulfils the restrictions of a Trojan square, then a Trojan square is generated because Trojan squares are optimal semi-Latin squares. When n and k do not fulfil the restrictions of a Trojan square, interleaving Latin squares are generated by first generating a Trojan square with k as large as possible. After that the generated Latin squares are duplicated (inflated) until the required interleaving Latin square is obtained. For an interleaving Latin square with n equal to 2, the n × k treatment levels are laid out from 1 to n × k in the first row, and from n × k to 1 in the second row.

The randomization is performed with BLOCKSTRUCTURE=(rows*columns)/units and, in addition, the treatment levels are permuted at random.


Bailey, R.A. (1988). Semi-Latin squares. Journal of Statistical Planning and Inference, 8, 299-312.

Bailey, R.A. (1992). Efficient semi-Latin squares. Statistica Sinica, 2, 413-437.

Edmondson, R.N. (1998). Trojan square and incomplete Trojan square designs for crop research. Journal of Agricultural Science, Cambridge, 131, 135-142.

Yates, F. (1935). Complex experiments (with Discussion). Supplement to the Journal of the Royal Statistical Society, 2, 181-247. [Reprinted (without Discussion) in Yates, F. (1970). Experimental Design: Selected Papers, 69-117. Griffin, London.

See also

Commands for: Design of experiments, Analysis of variance.


            NROWS=5; NUNITS=4; SEED=135143; TREATMENTS=Treat;\
            COLUMNS=Column; ROWS=Row; UNITS=Plot; PSEUDOFACTOR=Pseudo

            NROWS=5; NUNITS=4; SEED=314612

AGSEMILATIN [PRINT=design; METHOD=interleaving; ANALYSE=yes]\
            NROWS=5; NUNITS=6; SEED=235978
Updated on February 6, 2023

Was this article helpful?