Ana Cristina
☆    

Brazil,
2018-02-23 22:33
(2225 d 00:09 ago)

Posting: # 18453
Views: 15,423
 

 randomization [🇷 for BE/BA]

For example:
I have 16 subjects and two sequences (TR and RT) and of these 16 subjects:
8 are female (4 in the TR sequence and 4 in the RT sequence)
8 are male (4 in the TR sequence and 4 in the RT sequence)

I would like to know if anyone has the formula to do in R the balanced randomization by sex and sequence as in this example.
I need something general similar to this example and that generates a seed.

sujeito sexo seq period 1 period 2
1 F 1 T R
2 M 2 R T
3 M 1 T R
4 M 2 R T
5 F 1 T R
6 F 2 R T
7 M 2 R T
8 M 1 T R
9 M 1 T R
10 M 2 R T
11 F 2 R T
12 F 1 T R
13 F 2 R T
14 F 1 T R
15 M 1 T R
16 F 2 R T

thank you,

Ana Cristina


Edit: Category changed; see also this post #1. [Helmut]
ElMaestro
★★★

Denmark,
2018-02-23 23:24
(2224 d 23:18 ago)

@ Ana Cristina
Posting: # 18454
Views: 13,785
 

 randomization

Hi A.C.,


Let us say you have 16 subjects.
8 will be female, 8 will be male. As you enroll them into the study you assign subjects numbers sequentially so that the females are 1..8, and the males are 9..16.

The follwing code will provide a randomizer:

## we have N subjects, N is divisible by 4
## N/2 will be males, N/2 will be females
## N/4 will be males in TR
## N/4 will be males in RT
## N/4 will be females in TR
## N/4 will be females in RT

Ana.Cristinas.Randomizer=function(Seed, N)
{
  if (N %% 4 != 0) {cat("N not divisible by four.!\n");return("Error.")}
  Gender=c(rep("F", N/2), rep("M", N/2))
  Subject=c(1:N)
  ##We need to assign sequences to both genders
  ##N/4 males are assigned to TR and N/4 to RT
  Seqx=c(rep("TR", N/4), rep("RT", N/4))
  ##Seqx is just an 'unrandomised' block that applies to both genders. 
  ##Now we permute the sequences(=resample without replacement) for M and F
  Seq=c(sample(Seqx, replace=F), sample(Seqx, replace=F))
  TrtP1=substr(Seq,1,1)
  TrtP2=substr(Seq,2,2)
  Rslt=data.frame(Subject, Gender, Seq, TrtP1, TrtP2)
  return(Rslt)
}

##can be run with e.g.
Ana.Cristinas.Randomizer(12312351, 16)


It is a good idea to use a new seed every time and to record the one you are actually using.
Note also that this algo assigns unique subjects numbers to every participant. Then we do not need to worry about Subject%in%Sequence and we are compliant with ICH E6 §1.58 (unique identifier). :-D

Pass or fail!
ElMaestro
Ana Cristina
☆    

Brazil,
2018-02-24 17:47
(2224 d 04:54 ago)

@ Ana Cristina
Posting: # 18456
Views: 13,743
 

 randomization

Dear ElMaestro,

Perfect thank you!


Just one detail: in the output (result) the subjects appear in the sequence (1 to 8 female and 9 to 16 male). Is it possible to randomize so that the output genre appears like this? For example ... not necessarily in that sequence .... but randomized the genre.

1 F
2 M
3 F
4 M
5 M
6 F
?????

And another detail, I need in the output of the result to appear the seed used and the date and time that the randomization was performed. It's possible?

By the function randomizeBE the result appears like this:
Example: seed 2047732 blocksize: 2 created: 2018-02-24 12:38:06

Sorry about my English,


Thank you,

Ana Cristina
ElMaestro
★★★

Denmark,
2018-02-24 18:32
(2224 d 04:10 ago)

@ Ana Cristina
Posting: # 18457
Views: 13,766
 

 randomization

Hello Ana Cristina,

I am thinking you can play around with this:


Ana.Cristinas.Randomizer2=function(Seed, N, WriteFile=F)
{
  if (N %% 4 != 0) {cat("N not divisible by four.!\n");return("Error.")}
  Gender=rep(c("F", "M"), N/2)
  Subject=c(1:N)
  Seqx=c(rep("TR", N/2), rep("RT", N/2))
  SeqF=sample(Seqx, replace=F)
  SeqM=sample(Seqx, replace=F)
  Seq=NULL
  for (i in 1:(N/2)) Seq=c(Seq, SeqF[i], SeqM[i])
  TrtP1=substr(Seq,1,1)
  TrtP2=substr(Seq,2,2)
  Rslt=data.frame(Subject, Gender, Seq, TrtP1, TrtP2)
  L1=paste("\n\nDate: ", format(Sys.Date(), format="%B %d %Y"),
     " Seed=", Seed, "\n\n", sep="")
  L2="\n\n\n\n\n______________________________\n"
  L3="Signature, date\n"
  if (WriteFile)
  {
    FN=paste(format(Sys.Date(), format="%B %d %Y"), " ", Seed,".txt", sep="")
    sink(file=FN)
    cat(L1)
    print(Rslt, row.names=F)
    cat(L2)
    cat(L3)   
    sink()
  }
  cat(L1)
  print(Rslt)
  return("Success.")
}

##can be run with e.g.
Ana.Cristinas.Randomizer2(12341234, 16, TRUE)


When the last argument is TRUE the function will print the randomisation code into a text file which is dated, contains the seed and which you can print and date+sign by hand. The filename is unique to the combination of date and seed.

Pass or fail!
ElMaestro
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-24 18:52
(2224 d 03:50 ago)

@ Ana Cristina
Posting: # 18458
Views: 13,954
 

 package randomizeBE for R on steroids

Hi Ana,

❝ By the function randomizeBE the result appears like this:

❝ Example: seed 2047732 blocksize: 2 created: 2018-02-24 12:38:06


Function RL4() of package randomizeBE generates a list containing as one of its elements the data frame rl. You can manipulate it as you like: Add a column for sex, shuffle it, and assign new subject numbers. If you want to see what is going on behind the scenes, uncomment the print-lines.

library(randomizeBE)
n         <- 16
blocksize <- n/2
random    <- RL4(nsubj=n, seqs=c("TR", "RT"),
                 blocksize=blocksize, randctrl=TRUE)
random$rl <- cbind(random$rl, sex="F", stringsAsFactors=FALSE) # "F" default
# change second half to "M"
random$rl$sex[which(random$rl$subject > blocksize)] <- "M"
# print(random$rl, row.names=FALSE) # intermediate
random$rl <- random$rl[sample(nrow(random$rl)), ] # shuffle
# print(random$rl, row.names=FALSE) # intermediate
random$rl$subject <- 1:n # new subject numbers
print(random) # final


Gave on my machine without a specified seed (i.e., based on the system clock and the process ID)

Randomization table          created: 2018-02-24 17:51:34
(seed: 7952217 blocksize: 8 )

 subject seqno sequence sex
       1     1       TR   F
       2     2       RT   M
       3     1       TR   F
       4     1       TR   M
       5     2       RT   F
       6     1       TR   F
       7     2       RT   M
       8     2       RT   M
       9     1       TR   M
      10     1       TR   M
      11     2       RT   M
      12     2       RT   F
      13     1       TR   F
      14     2       RT   F
      15     1       TR   M
      16     2       RT   F


You have to give the code in the SAP. Otherwise an assessor will not be able to reproduce it.

If you want to get output similar to your original post, add these lines before the final print(random)

random$rl <- cbind(random$rl, per.1=NA, per.2=NA)
random$rl$per.1 <- paste0(substring(random$rl$sequence, 1, 1), "   ")
random$rl$per.2 <- paste0(substring(random$rl$sequence, 2, 2), "   ")
random$rl$sequence <- NULL
random$rl <- random$rl[, c("subject", "sex", "seqno", "per.1", "per.2")]
names(random$rl) <- c("sujeito", "sexo", "seq", "period 1", "period 2")


to get:

Randomization table          created: 2018-02-24 17:51:34
(seed: 7952217 blocksize: 8 )

 sujeito sexo seq period 1 period 2
       1    F   1     T        R   
       2    M   2     R        T   
       3    F   1     T        R   
       4    M   1     T        R   
       5    F   2     R        T   
       6    F   1     T        R   
       7    M   2     R        T   
       8    M   2     R        T   
       9    M   1     T        R   
      10    M   1     T        R   
      11    M   2     R        T   
      12    F   2     R        T   
      13    F   1     T        R   
      14    F   2     R        T   
      15    M   1     T        R   
      16    F   2     R        T   




Edit: Don’t use this code. For an update see this post.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
d_labes
★★★

Berlin, Germany,
2018-02-26 12:56
(2222 d 09:45 ago)

@ Ana Cristina
Posting: # 18463
Views: 13,577
 

 Randomization of gender

Dear Ana Cristina,

just out of curiosity: Why do you want to randomize the Gender :confused:?

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.

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-26 16:46
(2222 d 05:55 ago)

@ d_labes
Posting: # 18468
Views: 13,633
 

 Simplified R-code

Dear Detlew & Ana Cristina,

❝ 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]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Ana Cristina
☆    

Brazil,
2018-02-27 14:16
(2221 d 08:26 ago)

@ Helmut
Posting: # 18470
Views: 13,345
 

 Simplified R-code

Dear,


Now it's already randomized by gender as well. When I say randomize by gender, it should not generate the answer:
1 F
2 F
3 F
4 F
5 F
6 F
7M
8M
9M
10 M
11 M
12M

And generate yes to an example:

1 F
2 F
3M
4 F
5 F
6 F
7 M
8 M
9 F
10 M
11 M
12M
And that's okay.
My question now, for me to do the same for 3x3 crossover studies: (TTR) (RRT)
and 4x4: (TTRR) (TRTR) ...
how to change the formula?

Ana Cristina
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-27 18:06
(2221 d 04:36 ago)

@ Ana Cristina
Posting: # 18471
Views: 13,754
 

 Updated R-code

Hi Ana,

❝ Now it's already randomized by gender as well. When I say randomize by gender, it should not generate the answer:

❝ 1 F

❝ 2 F

❝ 3 F

❝ 4 F

❝ 5 F

❝ 6 F

❝ 7 M

❝ 8 M

❝ 9 M

❝ 10 M

❝ 11 M

❝ 12 M


Did you try it? It doesn’t. But don’t use my previous codes because you might get different numbers of females and males in the sequences. :angry: In my last example:

RT, F: 6
RT, M: 2
TR, F: 2
TR, M: 6


❝ My question now, for me to do the same for 3x3 crossover studies: (TTR) (RRT)


That’s an unusual design.

❝ and 4x4: (TTRR) (TRTR) ...


And this one is strange, IMHO.

❝ how to change the formula?


I packed everything into a function with some fair degree of error handling.

random.sex <- function(n, sequences = c("TR", "RT"),
                       seed, extend = c("no", "down", "up")) {
  require(randomizeBE)
  if (missing(n)) stop("Number of subjects must be given.")
  ext <- switch(match.arg(extend, c("no", "down", "up")),
                no   = 0,
                down = -1,
                up   = +1,
                stop("invalid 'extend'."))
  sequences <- sort(sequences, decreasing = TRUE)
  no.seqs   <- length(sequences)
  if (n %% no.seqs != 0)
    stop("Number of subjects must be a multiple of sequences.")
  n.orig <- n
  if (n %% (no.seqs*2) != 0 & ext != 0) {
    if (ext == -1) {
      n <- n - no.seqs
      msg <- "decreased"
    } else {
      n <- n + no.seqs
      msg <- "increased"
    }
  }
  if (missing(seed)) seed <- runif(1, max = 1E7)
  blocksize <- n/no.seqs
  sex       <- rep(c("F", "M"), each = blocksize / no.seqs)
  if (length(sex) == 0) sex <- c("F", "M")
  periods   <- unique(nchar(sequences))
  per.name  <- paste("period", 1:periods)
  random    <- RL4(nsubj = n, seqs = sequences, seed = seed,
                   blocksize = blocksize, randctrl = TRUE)
  per       <- as.data.frame(matrix(nrow = nrow(random$rl),
                                    ncol = periods,
                                    dimnames=list(NULL, per.name)))
  for (j in 1:periods) {
    per[, j] <- paste0(substr(random$rl$sequence, j, j), "   ")
  }
  random$rl <- cbind(random$rl, per, stringsAsFactors = FALSE)
  for (j in 1:no.seqs) {
    suppressWarnings(
      random$rl$sex[random$rl$sequence == sequences[j]] <- sample(sex)
    )
  }
  random$rl <- random$rl[, c("subject", "sex", "seqno", "sequence",
                             per.name)]
  cat("\n"); print(random, sumry = TRUE)
  collect <- NULL
  for (j in no.seqs:1) {
    F <- sum(random$rl$sex[random$rl$sequence == sequences[j]] == "F")
    M <- sum(random$rl$sex[random$rl$sequence == sequences[j]] == "M")
    cat(paste0("\n", sequences[j], ", F: ", F,
               "\n", sequences[j], ", M: ", M))
    collect <- c(collect, M, F)
  }
  cat("\n")
  if (length(unique(collect)) > 1 & ext == 0)
    cat("Warning message:",
        "\nBalanced randomisation by sex not possible",
        "\nwith the given sample size.\n")
  if (ext != 0 & n != n.orig)
    cat("Sample size", msg, "from", n.orig, "to",
        "\nget balanced randomisation by sex.\n")
}


Examples:

random.sex(n = 12, sequences = c("TR", "RT")) gives

Randomization table          created: 2018-02-27 16:54:34
(seed: 666027 blocksize: 6 )

 subject sex seqno sequence period 1 period 2
       1   M     2       RT     R        T   
       2   F     2       RT     R        T   
       3   M     1       TR     T        R   
       4   F     1       TR     T        R   
       5   F     1       TR     T        R   
       6   M     2       RT     R        T   
       7   F     2       RT     R        T   
       8   F     2       RT     R        T   
       9   M     1       TR     T        R   
      10   F     1       TR     T        R   
      11   M     1       TR     T        R   
      12   M     2       RT     R        T   


Summary of randomisation

12 subjects randomized into 2 sequence groups.
Number of subjects in sequence groups:
RT TR
 6  6
Runs test of randomness: p.value=0.2259

RT, F: 3
RT, M: 3
TR, F: 3
TR, M: 3


random.sex(n = 12, sequences = c("TRT", "RTR")) gives

Randomization table          created: 2018-02-27 16:55:15
(seed: 6305806 blocksize: 6 )

 subject sex seqno sequence period 1 period 2 period 3
       1   F     2      RTR     R        T        R   
       2   F     1      TRT     T        R        T   
       3   M     2      RTR     R        T        R   
       4   M     1      TRT     T        R        T   
       5   M     2      RTR     R        T        R   
       6   M     1      TRT     T        R        T   
       7   F     2      RTR     R        T        R   
       8   F     1      TRT     T        R        T   
       9   M     2      RTR     R        T        R   
      10   F     2      RTR     R        T        R   
      11   F     1      TRT     T        R        T   
      12   M     1      TRT     T        R        T   


Summary of randomisation

12 subjects randomized into 2 sequence groups.
Number of subjects in sequence groups:
RTR TRT
  6   6
Runs test of randomness: p.value=0.0693

RTR, F: 3
RTR, M: 3
TRT, F: 3
TRT, M: 3


random.sex(n = 12, sequences = c("TRTR", "RTRT")) gives

Randomization table          created: 2018-02-27 16:56:30
(seed: 3391479 blocksize: 6 )

 subject sex seqno sequence period 1 period 2 period 3 period 4
       1   F     2     RTRT     R        T        R        T   
       2   F     1     TRTR     T        R        T        R   
       3   M     1     TRTR     T        R        T        R   
       4   F     2     RTRT     R        T        R        T   
       5   F     1     TRTR     T        R        T        R   
       6   M     2     RTRT     R        T        R        T   
       7   M     2     RTRT     R        T        R        T   
       8   M     1     TRTR     T        R        T        R   
       9   M     2     RTRT     R        T        R        T   
      10   F     1     TRTR     T        R        T        R   
      11   M     1     TRTR     T        R        T        R   
      12   F     2     RTRT     R        T        R        T   


Summary of randomisation

12 subjects randomized into 2 sequence groups.
Number of subjects in sequence groups:
RTRT TRTR
   6    6
Runs test of randomness: p.value=0.2259

RTRT, F: 3
RTRT, M: 3
TRTR, F: 3
TRTR, M: 3


random.sex(n = 12, sequences = c("TRR", "RTR", "RRT")) gives

Randomization table          created: 2018-02-27 16:57:49
(seed: 1819956 blocksize: 3 )

 subject sex seqno sequence period 1 period 2 period 3
       1   M     1      TRR     T        R        R   
       2   F     2      RTR     R        T        R   
       3   M     3      RRT     R        R        T   
       4   M     2      RTR     R        T        R   
       5   F     1      TRR     T        R        R   
       6   F     3      RRT     R        R        T   
       7   M     1      TRR     T        R        R   
       8   F     2      RTR     R        T        R   
       9   M     3      RRT     R        R        T   
      10   F     1      TRR     T        R        R   
      11   F     3      RRT     R        R        T   
      12   M     2      RTR     R        T        R   


Summary of randomisation

12 subjects randomized into 3 sequence groups.
Number of subjects in sequence groups:
RRT RTR TRR
  4   4   4
Runs test of randomness: p.value=0.2502

RRT, F: 2
RRT, M: 2
RTR, F: 2
RTR, M: 2
TRR, F: 2
TRR, M: 2
Warning message:
Blocksize is not a multiple of sequences! Blocksize adapted to 3.


random.sex(n = 12, sequences = williams(ntmt = 3)) gives

Randomization table          created: 2018-02-27 21:13:16
(seed: 2807886 blocksize: 6 )

 subject sex seqno sequence period 1 period 2 period 3
       1   M     3      BCA     B        C        A   
       2   F     2      CAB     C        A        B   
       3   M     4      BAC     B        A        C   
       4   F     6      ABC     A        B        C   
       5   M     5      ACB     A        C        B   
       6   M     1      CBA     C        B        A   
       7   F     3      BCA     B        C        A   
       8   F     4      BAC     B        A        C   
       9   F     5      ACB     A        C        B   
      10   F     1      CBA     C        B        A   
      11   M     6      ABC     A        B        C   
      12   M     2      CAB     C        A        B   


Summary of randomisation

12 subjects randomized into 6 sequence groups.
Number of subjects in sequence groups:
ABC ACB BAC BCA CAB CBA
  2   2   2   2   2   2
Runs test of randomness: p.value=1.0000

ABC, F: 1
ABC, M: 1
ACB, F: 1
ACB, M: 1
BAC, F: 1
BAC, M: 1
BCA, F: 1
BCA, M: 1
CAB, F: 1
CAB, M: 1
CBA, F: 1
CBA, M: 1


random.sex(n = 12, sequences = williams(ntmt = 4)) gives

Randomization table          created: 2018-02-27 21:40:29
(seed: 8600620 blocksize: 4 )

 subject sex seqno sequence period 1 period 2 period 3 period 4
       1   M     3     BCAD     B        C        A        D   
       2   F     2     CDBA     C        D        B        A   
       3   M     4     ABDC     A        B        D        C   
       4   F     1     DACB     D        A        C        B   
       5   F     3     BCAD     B        C        A        D   
       6   M     2     CDBA     C        D        B        A   
       7   M     1     DACB     D        A        C        B   
       8   F     4     ABDC     A        B        D        C   
       9   F     1     DACB     D        A        C        B   
      10   F     2     CDBA     C        D        B        A   
      11   M     3     BCAD     B        C        A        D   
      12   M     4     ABDC     A        B        D        C   


Summary of randomisation

12 subjects randomized into 4 sequence groups.
Number of subjects in sequence groups:
ABDC BCAD CDBA DACB
   3    3    3    3
Runs test of randomness: p.value=0.2259

ABDC, F: 1
ABDC, M: 2
BCAD, F: 1
BCAD, M: 2
CDBA, F: 2
CDBA, M: 1
DACB, F: 2
DACB, M: 1
Warning message:
Balanced randomisation by sex not possible
with the given sample size.


Note the warning. You would need 8 or 16 subjects if you want sex balanced within the 4 sequences. If you insist in this, you can used the optional argument extend="up". Decreasing the sample size by extend="down" is also supported but doesn’t make much sense.
random.sex(n = 12, sequences = williams(ntmt = 4), extend = "up") gives

Randomization table          created: 2018-02-28 00:29:38
(seed: 2223505 blocksize: 4 )

 subject sex seqno sequence period 1 period 2 period 3 period 4
       1   F     1     DACB     D        A        C        B   
       2   F     2     CDBA     C        D        B        A   
       3   M     3     BCAD     B        C        A        D   
       4   F     4     ABDC     A        B        D        C   
       5   M     2     CDBA     C        D        B        A   
       6   M     4     ABDC     A        B        D        C   
       7   F     3     BCAD     B        C        A        D   
       8   M     1     DACB     D        A        C        B   
       9   F     1     DACB     D        A        C        B   
      10   M     3     BCAD     B        C        A        D   
      11   F     2     CDBA     C        D        B        A   
      12   F     4     ABDC     A        B        D        C   
      13   M     1     DACB     D        A        C        B   
      14   M     4     ABDC     A        B        D        C   
      15   M     2     CDBA     C        D        B        A   
      16   F     3     BCAD     B        C        A        D   


Summary of randomisation

16 subjects randomized into 4 sequence groups.
Number of subjects in sequence groups:
ABDC BCAD CDBA DACB
   4    4    4    4
Runs test of randomness: p.value=0.1205

ABDC, F: 2
ABDC, M: 2
BCAD, F: 2
BCAD, M: 2
CDBA, F: 2
CDBA, M: 2
DACB, F: 2
DACB, M: 2
Sample size increased from 12 to
get balanced randomisation by sex.


If you want to reproduce a run, add the argument seed=X to the function call (where X is the seed given in the output of the previous run).

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
d_labes
★★★

Berlin, Germany,
2018-02-28 09:43
(2220 d 12:58 ago)

@ Helmut
Posting: # 18478
Views: 13,324
 

 Gender in crossover

Dear Helmut, dear Ana,

again asked: Why do you want to randomize gender (sex)?

Usually we randomize factors we want control for.
But you can't control for gender (sex) in crossover experiments as long as you have subject in your evaluation model.
Try it. Make an ANOVA with factors subject, period, treatment and additional gender.
It bombs you out! Because subject and gender are confounded.

Moreover it is highly debatable that gender differences are observable in crossover designs where we deal with differences between Test and Reference, both with the same active API in it.
If there are gender differences in response to the API they are supposedly present in both formulations and cancel out.
If not you have a gender-by-treatment interaction, aka subject-by-treatment interaction. The times of such an term are gone long years before when the "individual bioequivalence" was disestablished.

Regards,

Detlew
nobody
nothing

2018-02-28 11:14
(2220 d 11:28 ago)

@ d_labes
Posting: # 18480
Views: 13,294
 

 Gender in crossover

❝ Moreover it is highly debatable that gender differences are observable in crossover designs where we deal with differences between Test and Reference, both with the same active API in it.

❝ If there are gender differences in response to the API they are supposedly present in both formulations and cancel out.


But if in, let's say, males Cmax is always 50% higher or AUC 40% lower you should see something in your data (plots)...

Totally out of discussion that it's not the purpose of BE-studies to investigate sex as a covariate in PK. But in the times of SJWs and alike you have to justify (!) if you don't want to have this aspect investigated in your BE-study.

Kindest regards, nobody
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-28 13:42
(2220 d 08:59 ago)

@ nobody
Posting: # 18482
Views: 13,341
 

 Sex in crossover

Hi nobody,

❝ […] it's not the purpose of BE-studies to investigate sex as a covariate in PK.


Agree. For ages we routinely included ♀/♂ in our studies. Bioanalysts were in :love: with females cause their concentrations were higher…

❝ But in the times of SJWs and alike you have to justify (!) if you don't want to have this aspect investigated in your BE-study.


BfArM = early SJW? In March 2005 we received a deficiency letter. Relevant section in all of its doubtful beauty:

Gemäß §7 Abs. 2; Ziffer 12 GCP-V fehlt im Prüfplan eine Begründung dafür, dass die ge­wählte Geschlechter­verteilung in der Gruppe der betroffenen Personen zur Feststellung möglicher geschlechts­spezifischer Unterschiede bei der Wirksamkeit oder Unbedenklichkeit des geprüften Arzneimittels angemessen ist.

Heck, it was a “sprinkle study” and the drug has no sex-related differences in PK. Since that time, ♂ only.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-28 13:27
(2220 d 09:14 ago)

@ d_labes
Posting: # 18481
Views: 13,371
 

 Sex in crossover

Dear Detlew,

❝ again asked: Why do you want to randomize gender (sex)?


Ana Christina wanted. I tried to help.

❝ Usually we randomize factors we want control for.

❝ But you can't control for gender (sex) in crossover experiments as long as you have subject in your evaluation model.


Sure. I knew that ANVISA in the past (dunno the current state) wanted to see analyses separately for sex (i.e., split of the data set, not as a covariate). Ana Christina  [image]… If one uses suitable software (:-D) imbalanced sequences are not a problem. I understand that (especially with many sequences and small sample sizes) one wants to keep sequences balanced at the beginning in order not to end up in disaster due to dropouts.

❝ Moreover it is highly debatable that gender differences are observable in crossover designs where we deal with differences between Test and Reference, both with the same active API in it.

❝ If there are gender differences in response to the API they are supposedly present in both formulations and cancel out.

❝ If not you have a gender-by-treatment interaction, aka subject-by-treatment interaction. The times of such an term are gone long years before when the "individual bioequivalence" was disestablished.


Agree.

PS: Even if not “politically correct” I prefer sex (biological state) over gender (the FDA’s definition: “A person’s self representation as male or female, or how that person is responded to by social institutions based on the individual’s gender presentation.”). The way you dress or act will not change the PK. ;-)

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
d_labes
★★★

Berlin, Germany,
2018-02-28 15:42
(2220 d 07:00 ago)

@ Helmut
Posting: # 18484
Views: 13,255
 

 OT: Sex / gender

Dear Helmut,

❝ ❝ again asked: Why do you want to randomize gender (sex)?


❝ Ana Christina wanted. I tried to help.

That honors you :clap:.

❝ ...

❝ PS: Even if not “politically correct” I prefer sex (biological state) over gender (the FDA’s definition: “A person’s self representation as male or female, or how that person is responded to by social institutions based on the individual’s gender presentation.”).


Was not aware of that subtle difference.
Sounds good to me: "Let's make gender" is crap :-D.

My wife (!) always state "To hell with all this gender bullshit!" if she hears something like "Lokomotivführer und Lokomotivführerinnen" (German politically correct notation of male or female engine driver, no english translation possible of the female denomination).

❝ The way you dress or act will not change the PK. ;-)


Are you sure :-D?

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2018-02-28 15:58
(2220 d 06:43 ago)

@ d_labes
Posting: # 18486
Views: 13,186
 

 OT: Sex / gender

Dear Detlew,

❝ ❝ Ana Christina wanted. I tried to help.

❝ That honors you :clap:.


Hope my code is not too confusing.

❝ My wife (!) always state "To hell with all this gender bullshit!" if she hears something like "Lokomotivführer und Lokomotivführerinnen" (German politically correct notation of male or female engine driver, no english translation possible of the female denomination).


Mine uses only Lokomotivführerinnen (without Binnen-I).

❝ ❝ The way you dress or act will not change the PK. ;-)

❝ Are you sure :-D?


No.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Ana Cristina
☆    

Brazil,
2018-03-01 04:16
(2219 d 18:25 ago)

@ Helmut
Posting: # 18487
Views: 13,109
 

 OT: Sex / gender

Dears,

Thank you very much for your cooperation, you have helped me a lot. I was able to make other randomizations from the ones you sent me and that serve the Center.
I do not know much about R, but I have learned a lot from you and I will continue my learning. I'll digress.

My goal is to run the whole R analysis of a bioequivalence study with the generation of the report ... One day I'll get there !

Note: thanks again and if I have any further questions, I will contact you,

Ana Cristina
Beholder
★    

Russia,
2020-04-08 14:31
(1450 d 09:10 ago)

@ Helmut
Posting: # 21319
Views: 5,973
 

 Updated R-code

Hi Helmut!

❝ Note the warning. You would need 8 or 16 subjects if you want sex balanced within the 4 sequences. If you insist in this, you can used the optional argument extend = "up". Decreasing the sample size by extend = "down" is also supported but doesn’t make much sense.


Another way to deal with situations, when we use not 8 or 16 subjects without increasing number of subjects, would be to slightly change F/M ratio from 50/50 to, for instance, F/M ratio 47/53 (30 subjects, 14 females and 16 males). How would the code to be changed in that case? If possible.

Best regards
Beholder
UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,636 registered users;
81 visitors (0 registered, 81 guests [including 4 identified bots]).
Forum time: 22:42 CET (Europe/Vienna)

Nothing shows a lack of mathematical education more
than an overly precise calculation.    Carl Friedrich Gauß

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5