Select Items from Categories for Treatments
Enter from 1 to 10 for Number of different Categories:
Enter up to 100 Items in each Category as appropriate:
#1 Items: #2 Items: #3 Items: #4 Items:
#5 Items: #6 Items: #7 Items: #8 Items:
#9 Items: #10 Items:
Enter up to 10 Treatment Types (to treat Items from Categories):


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.
This program divides sample items K from one or more populations J into N treatment groups. For example, suppose that 4 species of bark beetle (J = 4) with KJ = 35, 42, 18 and 29 individuals, respectively, are to be evenly divided at random among 4 treatment groups (N = 4) so that individuals within a treatment can be injected with a different chemical dose in a known sequence (within groups or for all groups, although sequential information can be ignored).

One enters the number of different kinds of items, or species in this case, (4). Then the number of items (or individuals) for each kind of item (35, 42, 18 and 29) is entered. The number of treatments (4) is entered. A two-dimensional array holds the sequences of numbers for each kind of item and the number of each item. The program picks at random numbers from this array and places them non-redundantly into the treatment groups. Output of the program for 4 treatment groups (1-4) with item types (A-D) and the sequential numbers (which may or may not be used) is shown below.

SELECT ITEMS FROM CATEGORIES FOR TREATMENTS
ENTER NUMBER OF DIFFERENT CATEGORIES? 4
ENTER NUMBER OF ITEMS A? 35
ENTER NUMBER OF ITEMS B? 42
ENTER NUMBER OF ITEMS C? 18
ENTER NUMBER OF ITEMS D? 29
ENTER NUMBER OF TREATMENT GROUPS TO PLACE ITEMS? 4
ENTER NUMBER FOR RANDOM SEED? 1


TREATMENT 1 :A2 A4 A8 A9 A22 A20 A1 A17 B29 B7 B21 B4 B35 B19 B39 B14 B34 B26 C18 C8 C13 C7 D2 D20 D24 D27 D25 D5 D29

TREATMENT 2 :A5 A24 A30 A13 A26 A29 A35 A28 B8 B3 B42 B27 B9 B1 B2 B17 B31 B24 C4 C10 C1 C12 D8 D11 D26 D10 D17 D7 D15

TREATMENT 3 :A10 A33 A21 A7 A12 A25 A23 A3 B40 B6 B15 B12 B20 B11 B10 B36 B38 B13 C15 C14 C3 C5 D12 D1 D16 D9 D21 D22 D23

TREATMENT 4 :A15 A32 A34 A6 A14 A31 A18 A16 B22 B23 B37 B16 B25 B33 B30 B32 B5 B18 C11 C9 C2 C16 D13 D28 D14 D6 D4 D3 D18
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.