Simplified R-code [🇷 for BE/BA]
❝ Gender and subject are an entity (at least in almost all cases except transgender subjects).
❝ Thus taking e.g. 8 males and 8 females and randomize them to the sequence groups is enough IMHO.
Good point!
@Ana Cristina: Simplified R-code (changes) including the runs test for randomness:
library(randomizeBE)
blocksize <- 8
sex <- rep(c("F", "M"), each=blocksize)
random <- RL4(nsubj=2*blocksize, seqs=c("TR", "RT"),
blocksize=blocksize, randctrl=TRUE)
random$rl <- cbind(random$rl, sex=sample(sex),
"period 1"=paste0(substr(random$rl$sequence, 1, 1), " "),
"period 2"=paste0(substr(random$rl$sequence, 2, 2), " "))
random$rl <- random$rl[, c("subject", "sex", "seqno", "sequence",
"period 1", "period 2")]
print(random, sumry=TRUE)
Gives with a random seed on my machine
Randomization table created: 2018-02-26 15:45:26
(seed: 7849936 blocksize: 8 )
subject sex seqno sequence period 1 period 2
1 F 1 TR T R
2 M 2 RT R T
3 M 1 TR T R
4 M 2 RT R T
5 F 2 RT R T
6 F 2 RT R T
7 M 1 TR T R
8 F 1 TR T R
9 F 2 RT R T
10 M 1 TR T R
11 M 1 TR T R
12 M 1 TR T R
13 M 1 TR T R
14 F 2 RT R T
15 F 2 RT R T
16 F 2 RT R T
Summary of randomisation
16 subjects randomized into 2 sequence groups.
Number of subjects in sequence groups:
RT TR
8 8
Runs test of randomness: p.value=0.6048
Note that if you change the names of columns (like in this post) to Portuguese and/or remove the
sequence
column, the summary will not work any more.Edit: Don’t use this code. For an update see this post.
Dif-tor heh smusma 🖖🏼 Довге життя Україна!
![[image]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- randomization Ana Cristina 2018-02-23 21:33 [🇷 for BE/BA]
- randomization ElMaestro 2018-02-23 22:24
- randomization Ana Cristina 2018-02-24 16:47
- randomization ElMaestro 2018-02-24 17:32
- package randomizeBE for R on steroids Helmut 2018-02-24 17:52
- Randomization of gender d_labes 2018-02-26 11:56
- Simplified R-codeHelmut 2018-02-26 15:46
- Simplified R-code Ana Cristina 2018-02-27 13:16
- Updated R-code Helmut 2018-02-27 17:06
- Gender in crossover d_labes 2018-02-28 08:43
- Gender in crossover nobody 2018-02-28 10:14
- Sex in crossover Helmut 2018-02-28 12:42
- Sex in crossover Helmut 2018-02-28 12:27
- OT: Sex / gender d_labes 2018-02-28 14:42
- OT: Sex / gender Helmut 2018-02-28 14:58
- OT: Sex / gender Ana Cristina 2018-03-01 03:16
- OT: Sex / gender Helmut 2018-02-28 14:58
- OT: Sex / gender d_labes 2018-02-28 14:42
- Gender in crossover nobody 2018-02-28 10:14
- Updated R-code Beholder 2020-04-08 12:31
- Gender in crossover d_labes 2018-02-28 08:43
- Updated R-code Helmut 2018-02-27 17:06
- Simplified R-code Ana Cristina 2018-02-27 13:16
- Simplified R-codeHelmut 2018-02-26 15:46