Latin Square Design
A Latin square design where each treatment appears exactly once in each row and once in each column. Supports multiple squares (replicates) when rows and columns are multiples of the treatment count.
Design Reference — what this design is, parameters explained, output guide
Latin Square Design
Treatments are arranged so that each treatment appears exactly once in each row and once in each column within each square. This controls for two sources of variability simultaneously.
Use when: There are two known, orthogonal sources of variability (e.g. both row position and column position in a field, or time and operator in a lab experiment). The number of rows and columns must each be a multiple of the number of treatments.
Parameters
| Parameter | Type | Default | Min | Max | Description |
|---|---|---|---|---|---|
experiment_name |
text | "" |
— | — | Name of the experiment |
treatment_factor |
text | "Variety" |
— | — | Label for the treatment factor |
treatment_count |
integer | 3 |
2 | 100 | Number of treatments |
row_factor |
text | "Row" |
— | — | Label for the row factor |
row_count |
integer | 3 |
2 | — | Number of rows — must be a multiple of treatment_count |
column_factor |
text | "Column" |
— | — | Label for the column factor |
column_count |
integer | 3 |
2 | — | Number of columns — must be a multiple of treatment_count |
replicate_factor |
text | "Square" |
— | — | Label for the replicate (square) factor |
treatment_names |
list | None |
— | — | Optional custom treatment names |
seed |
integer | 0 |
— | — | Random seed |
Constraints
row_countmust be an exact multiple oftreatment_countcolumn_countmust be an exact multiple oftreatment_count- Total units =
row_count × column_countmust not exceed 5,000 - Number of squares =
(row_count / treatment_count) × (column_count / treatment_count)
Output
List View
| Column | Description |
|---|---|
| Unit | Sequential unit number |
| replicate_factor (e.g. Square) | Which square/replicate this unit belongs to |
| column_factor | Column position |
| row_factor | Row position |
| treatment_factor | Treatment at this position |
Layout View
One grid per square: - Rows = row positions - Columns = column positions - Cell contents = treatment at that position
Total units: row_count × column_count
What makes it a Latin Square?
In a standard t × t Latin square: - Each of the t treatments appears exactly once in each row - Each of the t treatments appears exactly once in each column
This means both row effects and column effects are balanced — neither will confound the treatment comparisons.
Multiple Squares
If row_count = 2 × treatment_count and column_count = treatment_count, you get two squares (replicates). The design is tiled with independent Latin squares.
Algorithm
- Start with a cyclic Latin square: row i has treatments shifted by i positions
- Randomly permute the treatment-to-symbol mapping
- Randomly permute row order within each square
- Randomly permute column order within each square
- Repeat for each square replicate