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

### Options

`PRINT` = string token |
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 token |
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 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.

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.

### See also

Directive: `RANDOMIZE`

.

Procedures: `APERMTEST`

, `RPERMTEST`

.

Commands for: Design of experiments, Analysis of variance.

### Example

CAPTION 'ARANDOMIZE example',!t('Split plot design, see the ',\ 'Guide to Genstat, Part 2, Section 4.2.1.'); STYLE=meta,plain FACTOR [NVALUES=72; LEVELS=6] Block & [LEVELS=3] Wplot & [LEVELS=4] Subplot & [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen & [LEVELS=3; LABELS=!T(Victory,'Golden rain',Marvellous)] Variety GENERATE Block,Wplot,Subplot & Block,Variety,Nitrogen BLOCKSTRUCTURE Block/Wplot/Subplot TREATMENTSTRUCTURE Variety*Nitrogen ARANDOMIZE [PRINT=design; SEED=12345]