Huge Latin Squares

Byers, J.A. 1991. BASIC algorithms for random sampling and
     treatment randomization. Computers in Biology and
     Medicine 21:69-77.
excerpt from paper above:
Program 2: Latin Square. This program generates any size latin square in which all treatments each occur once in each row and column.

  5  7  8  6  2  3  4  1
  4  6  7  5  1  2  3  8
  8  2  3  1  5  6  7  4
  2  4  5  3  7  8  1  6
  3  5  6  4  8  1  2  7
  1  3  4  2  6  7  8  5
  6  8  1  7  3  4  5  2
  7  1  2  8  4  5  6  3
It is well known that the spatial distribution of flying bark beetles varies greatly as observed with monitor traps [29,30]. A latin square arrangement can be used in an attempt to even out the variation between trap positions so that treatment effects can be properly observed. The tests of Schlyter et al. [28] could also have been performed using an 8 x 8 latin square with each column representing a replicate time and each row a position and the number corresponding to each of the 8 treatments. Alternatively, the experiment could have been done simultaneously using 64 traps in a grid.
The number of either the columns, rows, or treatments, which are all equal, is entered along with the random seed number. The algorithm uses the method of randomizing numbers by treatment/position in program 1 for two such arrays of treatments (column and row). The column and row arrays (e.g. 87356412 and 57862341) can then be used to calculate a unique latin square of (8 column x 8 row) cell elements. Each column and row intersection, cell(c,r), of the latin square can be obtained from the sum of the numbers in the respective column and row arrays (e.g. cell(1,1)=8+5=13). However, if the sum is more than the number of columns (in this case 8) then the sum has the number of columns subtracted (e.g. cell(1,1)=13-8=5). This method was first presented by Stevens [31] and Bose [32]. Output (Fig. 2B) is shown with the replicates suggested across the rows, the positions across the columns, and the treatments represented by the number in each cell. The row x columns can also be considered only as positions with eight possible treatments.
(following from p 173 in Byers (1993):
The Latin square algorithm used here can generate all 12 squares of 3x3 letters, but not all possible Latin squares of more letters than three per side. For Latin squares of side N = 4 (4x4) the algorithm generates N!(N-1)! = 144 different squares, for a 5x5, 2,880 squares, and for a 6x6, 86,400 squares [9]. There are actually 576 different 4x4 and 161,280 different 5x5 squares [4, 8]. Thus not all possible Latin squares can be obtained with the algorithm, but there is a sufficiently large sample from which to select a choice at random such that no significant experimental bias should result.
selected references cited above:
4. B. E. Cooper, Statistics for Experimentalists. Pergamon Press, London (1969). 8. W. T. Federer, Experimental Design. MacMillan Co., New York (1955). 9. O. Kempthorne, The Design and Analysis of Experiments. Wiley, New York (1952). 28. F. Schlyter, G. Birgersson, J. A. Byers, J. Löfqvist and G. Bergström. Field response of spruce bark beetle, Ips typographus, to aggregation pheromone candidates. J. Chem. Ecol. 13: 701-716 (1987). 29. T. L. Payne, J. E. Coster, J. V. Richerson, E. R. Hart, R. L. Hedden and L. J. Edson. Reducing variation in field tests of behavioral chemicals for the southern pine beetle. J. Georgia Entomol. Soc. 13: 85-90 (1978). 30. J. A. Byers, O. Anderbrant and J. Löfqvist. Effective attraction radius: A method for comparing species attractants and determining densities of flying insects. J. Chem. Ecol. 15: 749-765 (1989). 31. W. L. Stevens, The completely orthogonalised square. Ann. Eug. 9:82 (1938). 32. R. C. Bose, On the application of Galois fields to the problem of the construction of Hyper-Graeco-Latin squares. Sankhya 3:323 (1938). Other related references:
Byers, J.A. 1993. Randomization algorithms in BASIC for experimental design. Computers in Biology and Medicine 23:167-176. Byers, J.A. 1996. Random selection algorithms for spatial and temporal sampling. Computers in Biology and Medicine 26:41-52.
Back to JavaScript page