ARANDOMIZE procedure

Randomizes and prints an experimental design (R.W. Payne).


Options

PRINT = string
Allows the (randomized) design to be printed; (design); default *

BLOCKSTRUCTURE = formula
Defines the block factors according to which the randomization is to be carried out; default takes the existing specification as defined by the BLOCKSTRUCTURE directive

EXCLUDE = factors
(Block) factors whose levels are not to be randomized

SEED = scalar
Seed to generate the random numbers used to define the randomization; default 0

LPERMUTE = string
Whether to randomly permute treatment factor levels (no, yes); default no


Parameters

OLDVECTOR = factors or variates
Vectors whose values are to be randomized; default is to use the factors occurring in the formula (if any) specified by the most recent TREATMENTSTRUCTURE directive

NEWVECTOR = factors or variates
Vectors to store the randomized values; by default these overwrite the values in the original vectors


Description

ARANDOMIZE provides a convenient way of randomizing the treatment allocations in an experimental design. It has several advantages over the RANDOMIZE directive (which is used inside the procedure).

   First of all, the BLOCKSTRUCTURE option, which (as in RANDOMIZE) specifies the block model formula to indicate how the randomization is to take place, will use any setting that has already been defined by the BLOCKSTRUCTURE directive as its default. Moreover, the formula need not index all the units of the design, as would be required by RANDOMIZE; if necessary ARANDOMIZE will set up an extra factor _units_ simular to the factor *units* used by ANOVA.

   ARANDOMIZE allows the original (unrandomized) values to be retained. There are two parameters: OLDVECTOR to specify the factors or variates to be randomized, and NEWVECTOR to allow new structures to be supplied to store the randomized values. If no NEWVECTOR is specified, the randomized values replace the original values of the corresponding OLDVECTOR. By default, NEWVECTOR is assumed to contain the list of factors in the model formula (if any) specified by the previous TREATMENTSTRUCTURE directive.

   The levels of the treatment factors can be randomized by setting option LPERMUTE=yes; ARANDOMIZE then randomly permutes the numbering of the levels of each treatment factor on the units of the design. There is also a PRINT option which can be set to design to print the design. The other two options, EXCLUDE and SEED, are as in RANDOMIZE. EXCLUDE lists block factors whose levels are not to be permuted during the randomization; for example the period factor might need to be excluded in the randomization of a trial to study carry over effects. SEED defines the seed used to generate the random numbers used for the randomization; the default of 0 ensures that a seed will be chosen at random if SEED is not set.


Options: PRINT, BLOCKSTRUCTURE, EXCLUDE, SEED, LPERMUTE.

Parameters: OLDVECTOR, NEWVECTOR.


Method

The GET directive is used to access any existing settings defined by the BLOCKSTRUCTURE or TREATMENTSTRUCTURE directives. AFUNITS, if necessary, forms the extra _units_ factor, and DUPLICATE generates new copies of the original vectors, if these are to be kept, before RANDOMIZE is used to produce the randomized values. Finally, if required, PDESIGN is used to print the design.


Action with RESTRICT

RESTRICT can be used, as usual, to restrict the set of units to be randomized.