Description Usage Arguments Details Value Note Author(s) See Also Examples

This function creates a randomization list of subjects, patients
into sequences of treatments.

It is mainly intended for use in crossover studies but may be used also
for parallel group designs if for sequences c("T","R") is used.

1 2 |

`nsubj` |
Number of subjects, patients ... to be randomized. |

`seqs` |
Character representation of the sequences. |

`blocksize` |
Size of the blocks to randomize within. |

`seed` |
An integer for the initialisation of the random number generator. |

`randctrl` |
Shall the creation of the randomlist controlled by a runs test of randomness? |

`pmethod` |
A character string describing the method for the p-value calculation of the runs
test. |

`alpha` |
Critical alpha value for re-creation of the randomlist based on the runs test. |

As default the randomization is done as block randomization.

If `blocksize`

is given as a vector of numbers the sizes of the blocks
are randomly chosen from that vector.

If `blocksize=0`

then the randomization takes place in the one block
with all subjects.

The randomization is in the default settings controlled by a Wald-Wolfowitz
runs test of randomness, i.e. if this test shows significant deviation from randomness
(p-value<0.025 as default) the randomization list is recreated.

This behavior may be switched off by setting `randctrl=FALSE`

if you don't
see any needfulness for such a control.

The reason for such a control was originally to avoid randomlists with only
'alternating' sequences f.i. "TR" "RT" "TR" "RT" ...

See http://forum.bebac.at/mix_entry.php?id=8745

In its original form the runs test is only defined for dichotomous outcomes
(i.e if 2 sequences are used).

If more than 2 sequences are used the runs test is modified by dichotomizing
the sample of sequence numbers into cases < median and > median.

See package `lawstat`

or http://de.wikipedia.org/wiki/Run-Test for this.

Returns a list of class "rl4". This list has the components

`rl ` |
A data.frame with the random list. |

`seed ` |
The used seed. |

`blocksize ` |
The used blocksize. |

`ninseqs ` |
A named vector containing the number of subjects in the sequence groups. |

`runs.pvalue ` |
The p-value of a runs test of randomness. |

`date ` |
Date and time of creation. |

The class rl4 has the S3 method `print.rl4`

.

The blocksize(s) should be a multiple of the used # of sequences.
If this is not the case it (they) will be adjusted accordingly.

The number of subjects should be a multiple of the used # of sequences.
If this is not the case a warning is thrown that the design is not balanced.

The default for `pmethod`

is the calculation via standard normal approximation.
This has shown the 'best' potential in rejecting the randomness for alternating
random lists.

The randomness control does not work properly if more than 2 sequences are used.
In that case a test of repeated patterns of sequences in blocks of length=nseq is
done additionally to the runs test. Example (seqno) 1 2 3 1 2 3 ...

D. Labes

Part of the code for using the runs test for randomness
according to a suggestion by Helmut Schuetz.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
# block randomization of 12 subjects for a 2x2 cross-over using the defaults
# seqs = c("TR", "RT"), blocksize=4 and seed from Sys.time()
RL4(nsubj=12)
# block randomization of a full replicate design with randomly
# chosen blocksizes 2 or 4
rl <- RL4(nsubj=12, blocksize=c(2, 4), seqs=c("TRRT","RTTR"))
print(rl)
# randomization of 12 subjects for a 2x2 cross-over
# where the original random list don't pass the runs test
# watch the message.
RL4(nsubj=12, blocksize=0, seed=10)
#if you don't worry about some 'extreme' lists
RL4(nsubj=12, blocksize=0, seed=10, randctrl=FALSE)
# randomness control does'nt work that good in case of more
# than 2 sequences: 3x3 latin square example
rl <- RL4(nsubj=12, seq <- c("ABC","BCA","CAB"), blocksize=3, seed=5125)
print(rl, sumry=TRUE)
# gives runs p.value=0.2502
``` |

```
Randomization table created: 2018-05-10 08:58:54
(seed: 6718521 blocksize: 4 )
subject seqno sequence
1 2 RT
2 1 TR
3 2 RT
4 1 TR
5 2 RT
6 1 TR
7 2 RT
8 1 TR
9 2 RT
10 2 RT
11 1 TR
12 1 TR
Randomization table created: 2018-05-10 08:58:54
(seed: 1771231 blocksize: 4 4 2 2 )
subject seqno sequence
1 2 RTTR
2 1 TRRT
3 2 RTTR
4 1 TRRT
5 1 TRRT
6 2 RTTR
7 2 RTTR
8 1 TRRT
9 2 RTTR
10 1 TRRT
11 2 RTTR
12 1 TRRT
All nseq blocks equal. Recreating randomlist.
All nseq blocks equal. Recreating randomlist.
Randomization table created: 2018-05-10 08:58:54
(seed: 26 blocksize: 12 )
subject seqno sequence
1 1 TR
2 2 RT
3 1 TR
4 2 RT
5 1 TR
6 1 TR
7 1 TR
8 1 TR
9 2 RT
10 2 RT
11 2 RT
12 2 RT
Randomization table created: 2018-05-10 08:58:54
(seed: 10 blocksize: 12 )
subject seqno sequence
1 1 TR
2 2 RT
3 1 TR
4 2 RT
5 1 TR
6 2 RT
7 1 TR
8 2 RT
9 1 TR
10 2 RT
11 1 TR
12 2 RT
Warning message:
In RL4(nsubj = 12, blocksize = 0, seed = 10, randctrl = FALSE) :
Recurrent pattern of sequences detected.
All nseq blocks equal. Recreating randomlist.
All nseq blocks equal. Recreating randomlist.
Randomization table created: 2018-05-10 08:58:54
(seed: 5225 blocksize: 3 )
subject seqno sequence
1 3 CAB
2 1 ABC
3 2 BCA
4 1 ABC
5 3 CAB
6 2 BCA
7 2 BCA
8 3 CAB
9 1 ABC
10 1 ABC
11 3 CAB
12 2 BCA
Summary of randomisation
12 subjects randomized into 3 sequence groups.
Number of subjects in sequence groups:
ABC BCA CAB
4 4 4
Runs test of randomness: p.value=0.6456
```

randomizeBE documentation built on June 20, 2018, 5:01 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.