Match Sequential Samples
Evenly to Treatments
Enter 1 to 10 Treatments to match Samples with:
Enter Number of Samples in Sequence:

JavaScript © 1997 by John A. Byers Chemical Ecology
```modified from BASIC code in:

Byers, J.A. 1996. Random selection algorithms for spatial and temporal
sampling. Computers in Biology and Medicine 26:41-52.
```
The program takes a sequence of numbers representing a series of samples and divides them into contiguous groups each containing the same number of samples as the desired number of different treatments. Then the samples of each group are matched at random to each of the different treatments. For example, to see which of four bark beetle species produce the most progeny in logs cut from a Norway spruce tree, one would want to balance as much as possible the bark areas and thickness among the species. Reducing this source of variation could be done by cutting 20 logs from along the trunk (numbered 1 to 20) and dividing them into 5 contiguous groups of 4 logs each and uniquely assigning at random each log within a group to one of the four species treatments so that all treatments are represented within each group (i.e. each species colonizes similar areas and regions of the tree).

One enters the number of samples (20), the number of different treatments (4). For each group of samples (5 groups) the program picks at random a number representing a treatment and matches this to the samples in sequence within the group. However, the program first checks to see that none of the preceding samples within the group have the same treatment, if so, then another random number is picked until a unique treatment is found. Output of the program for 4 treatments and 20 sample positions (1-20) is shown below. As can be seen, the 4 bark beetle species would be fairly evenly distributed along the trunk in various logs of similar areas.
```MATCH SEQUENTIAL SAMPLES EVENLY TO TREATMENTS
NUMBER OF SAMPLES IN SEQUENCE = 20
NUMBER OF TREATMENTS TO MATCH SAMPLES WITH = 4

TREATMENT 1 : 1  6  11  15  19
TREATMENT 2 : 3  8  12  16  18
TREATMENT 3 : 2  7   9  13  17
TREATMENT 4 : 4  5  10  14  20

other related programs:
Byers, J.A. 1993. Randomization algorithms in BASIC for experimental
design. Computers in Biology and Medicine 23:167-176.

Byers, J.A. 1991. BASIC algorithms for random sampling and treatment
randomization. Computers in Biology and Medicine 21:69-77.
```