## randomizeBE - randomness control [🇷 for BE/BA]

Dear All!

In the R-package

This suggestion was aimed to avoid some 'ordered' lists beside the fact that such lists are of course obtainable by dicing, also with low probability.

Internally

It is generalized to other cases using the dichotomizing of the values via <=median and > median. See f.i. german wikipedia. The english version suggests to omit values = median. IMHO this is not appropriate here where we are dealing with sequences.

Here some observations that the randomness control does not work that good in case of more than 2 sequences.

Example: 3 sequences numbered 1, 2, 3 (substitute a character representation whatever fits your needs. F.i. latin square "ABC", "BCA" and "CAB").

The 'alternating' random lists analogous to the 2x2 case give the following results:

Majority of them considered as compatible with null hypothesis: sequence is random.

The ordered list on the other hand is correctly considered as 'non-random':

BTW: You needn't dicing with function

Example:

BTW2: The runs test is implemented via normal approximation like the implementations in the R-packages

In the R-package

`randomizeBE`

you can control the randomness of the list by a Wald-Wolfowitz runs test as Helmut has suggested in this post .This suggestion was aimed to avoid some 'ordered' lists beside the fact that such lists are of course obtainable by dicing, also with low probability.

Internally

`randomizeBE`

uses the sequence numbers for the runs test. The runs test is originally formulated for dichotomous input only.It is generalized to other cases using the dichotomizing of the values via <=median and > median. See f.i. german wikipedia. The english version suggests to omit values = median. IMHO this is not appropriate here where we are dealing with sequences.

Here some observations that the randomness control does not work that good in case of more than 2 sequences.

Example: 3 sequences numbered 1, 2, 3 (substitute a character representation whatever fits your needs. F.i. latin square "ABC", "BCA" and "CAB").

The 'alternating' random lists analogous to the 2x2 case give the following results:

` list runs p.value`

1 2 3 1 2 3 1 2 3 1 2 3 0.2502

1 3 2 1 3 2 1 3 2 1 3 2 0.2502

2 1 3 2 1 3 2 1 3 2 1 3 0.0438

2 3 1 2 3 1 2 3 1 2 3 1 0.0438

3 1 2 3 1 2 3 1 2 3 1 2 0.2502

3 2 1 3 2 1 3 2 1 3 2 1 0.2502

Majority of them considered as compatible with null hypothesis: sequence is random.

The ordered list on the other hand is correctly considered as 'non-random':

` list runs p.value`

1 1 1 1 2 2 2 2 3 3 3 3 0.0028

BTW: You needn't dicing with function

`RL4()`

until you get one of the above lists to see the runs p-value. Use the function `runs.pvalue()`

and a numeric representation of the sequences.Example:

`rl <- rep(c(1,2,3),4)`

runs.pvalue(rl)

BTW2: The runs test is implemented via normal approximation like the implementations in the R-packages

`tseries`

or `lawstat`

. The drawback is that it by design will give only approximate p-values for such small lists as discussed here. If these approximate values are conservative or liberal I don't know.—

Regards,

Detlew

Regards,

Detlew

### Complete thread:

- randomizeBE - randomness controld_labes 2012-07-10 13:02 [🇷 for BE/BA]
- randomizeBE - randomness control Helmut 2012-07-10 14:20
- runs test - critical values d_labes 2012-07-10 16:58
- randomizeBE - randomness control d_labes 2012-07-12 10:34
- randomness control Helmut 2021-07-15 16:07
- randomness control Ohlbe 2021-07-15 17:59
- randomness control Helmut 2021-07-15 18:32

- randomness control d_labes 2021-07-18 11:15

- randomness control Ohlbe 2021-07-15 17:59

- randomness control Helmut 2021-07-15 16:07

- randomizeBE - randomness control Helmut 2012-07-10 14:20