1. Home
  2. RANDOMIZE directive

RANDOMIZE directive

Randomizes the units of a designed experiment or the elements of a factor or variate.


BLOCKSTRUCTURE = formula Block model according to which the randomization is to be carried out; default * i.e. as a completely-randomized design
EXCLUDE = factors (Block) factors whose levels are not to be randomized
SEED = scalar Seed for the random-number generator; default 0


    factors or variates Structures whose units are to be randomized according to the defined block model


In its simplest form, RANDOMIZE performs a random permutation of the units of a list of factors or variates. You list these structures with the parameter of RANDOMIZE. Genstat gives them all exactly the same permutation, which is produced by a set of random numbers generated from the SEED option. For example


puts the values of X and Y into an identical random order. The seed can be any positive integer, but only the last six digits of its integer part are used. Thus the seeds 2144556 and 7144556.3 are both equivalent to the seed 144556. The default of zero continues the existing sequence of random numbers if RANDOMIZE has already been used in the current Genstat job. If RANDOMIZE has not yet been used, Genstat picks a seed at random. On the other hand, if you use the same (non-zero) seed more than once, you will get the same random numbers, and hence the same randomization.

The main use of RANDOMIZE, however, is to randomize the allocation of treatments to units in a designed experiment. In the analysis of designed experiments, the underlying structure of an experiment is defined by the block formula, as explained in the description of the BLOCKSTRUCTURE directive. Provided the only operators in a block formula are the nesting (/) and crossing (*) operators, this also specifies the correct randomization of the experiment.

The nesting operator specifies that one factor is to be randomized within another one. The simplest example is the randomized block design: its block formula is Blocks/Plots; a separate randomization of plots is done for each block. Another example is a split-plot design, the formula for which is Blocks/Wplots/Subplots; this means randomize first the levels of Blocks, then the levels of Wplots within levels of Blocks, and finally the levels of Subplots within the levels of Blocks and Wplots. In other words, there is a separate randomization of Wplots for each Block, and a separate randomization of Subplots for each Wplot. A similar formula and randomization would apply to a resolvable incomplete-block design.

The crossing operator specifies that the factors are to be randomized independently of each other. For example the formula Rows*Cols means randomize the levels of Rows and Cols separately. Thus the same randomization of Cols appears within each Row. This is the block formula associated with a row and column design, for example a Latin square.

You specify the block formula by the BLOCKSTRUCTURE option, which thus defines the way in which the randomization is to be carried out. Genstat does not randomize the factors in the block structure themselves, unless you put them into the parameter list. This is because the original order of the block-factor levels often describes actual positions in the experiment; for example, in a field. So you are most likely to want to keep these values, rather than the random ordering of them that is used to allocate treatments. The block formula for RANDOMIZE must index all the units; so a randomized block block design must be specified for example as Blocks/Plots and not just Blocks. To put a formula of just Blocks would not give Genstat any information about what to do with the elements of the blocks.

You should use the EXCLUDE option if you want to restrict the randomization so that one or more of the factors in the block formula is not randomized. The most common instance where this is required is when one of the treatment factors is time-order, which cannot be randomized.


Parameter: unnamed.

Action with RESTRICT

You can randomize only a subset of the units by applying a restriction to any of the vectors in the parameter list. All the vectors will be be treated as though they were restricted and, if more than one is restricted, they must all be restricted in exactly the same way.

See also

Directive: GENERATE.



Commands for: Design of experiments, Analysis of variance, Calculations and manipulation.


" Example RAND-1: A randomized block design in 4 blocks each of 4 plots"
UNITS [16]
" Set up block and treatment factors"
FACTOR [LEVELS=4; VALUES=4(1...4)] Blocks
  &  [VALUES=(1...4)4] Plots
  &  [LABELS=!T('A','B','C','D')] Dose
PRINT Blocks,Plots,Dose
" Randomize treatment factor Dose as a randomized block design"
PRINT Blocks,Plots,Dose
Updated on March 6, 2019

Was this article helpful?