An Algorithm for Making a Balanced Latin Square Design

1. Let's say you have 6 conditions (but any even n will work). Make an n x n table.

           
           
           
           
           
           

2. Next, label each of the columns 1 through n, alternating between successive columns as below.

1 2 n 3 n-1 4
           
           
           
           
           

3. Now label the left hand column from 1 ascending to n.

1 2 n 3 n-1 4
2          
3          
4          
5          
6          

4. Move to the right by one column, and fill in the next column by incrementing the values with each successive row (wrapping so that 1 follows n)

1 2 n 3 n-1 4
2 3        
3 4        
4 5        
5 6        
6 1        

5. Repeat step 4 until the table is filled.

1 2 6 3 5 4
2 3 1 4 6 5
3 4 2 5 1 6
4 5 3 6 2 1
5 6 4 1 3 2
6 1 5 2 4 3

 

Now you can run your experiment using the first row as condition order A, the second row as condition order B, and so on.

References

Bradley, J. V. Complete counterbalancing of immediate sequential effects in a Latin square design. J. Amer. Statist. Ass.,.1958, 53, 525-528.

A literature survey of latin squares