yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-19 12:14

Posting: # 20502
Views: 1,129
 

 about package randomizeBE [R for BE/BA]

Dear Detlew and all others,

I recently tried to re-write GUI for your developed R package randomizeBE. And I got some error messages about the function sequences. Here is what I got
require("randomizeBE")
tmts<- c("R","T")
tmts
[1] "R" "T"
sequences("parallel", tmts=tmts)
Error in if (!is.null(tmts) & length(tmts) != ntmt) { :
  missing value where TRUE/FALSE needed
In addition: Warning message:
In sequences("parallel", tmts = tmts) : NAs introduced by coercion

sequences
function (design, tmts = NULL)
{
    seqs <- character()
    ntmt <- as.numeric(substr(design, 1, 1))           ### Q1: if this works for design=="parallel" too?
    if (!is.null(tmts) & length(tmts) != ntmt) {
        stop("Treatment codes must have ", ntmt, " entries!")
    }
    if (design == "2x2" | design == "2x2x2")
        seqs <- c("AB", "BA")
    if (design == "parallel")                          ### Q2: not working if tmts=c("R","T")?
        seqs <- c("A", "B")
    if (design == "3x3" | design == "3x3x3") {
        seqs <- c("ABC", "BCA", "CAB")
        seqs <- randLS(seqs)
...
}
sequences("parallel")
[1] "A" "B"
Warning message:
In sequences("parallel") : NAs introduced by coercion  ### Q3: is this warning message normal?
sequences("parallel", tmts=c("R","T1","T2"))           ### Q4: not implemented yet for this?
Error in if (!is.null(tmts) & length(tmts) != ntmt) { :
  missing value where TRUE/FALSE needed
In addition: Warning message:
In sequences("parallel", tmts = c("R", "T1", "T2")) :
  NAs introduced by coercion


Thanks in advanced.

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-20 14:04

@ yjlee168
Posting: # 20505
Views: 963
 

 about package randomizeBE

Dear all,

I re-checked the codes and found
as.numeric(substr("parallel", 1, 1))
[1] NA   ### from 'as.numeric("p")'
sequences("parallel")
[1] "A" "B"
Warning message:
In sequences("parallel") : NAs introduced by coercion


Q1: So this is where that warning message comes from.
Q2: Nope, cannot do it with sequences("parallel",tmts=c("R","T")).
Q3: Ok, it still works and it just happens to design=="parallel".
Q4: not implemented yet for sure.

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2019-08-24 16:26

@ yjlee168
Posting: # 20512
Views: 902
 

 about package randomizeBE

Dear Yung-jin,

» I re-checked the codes and found
» as.numeric(substr("parallel", 1, 1))
» [1] NA   ### from 'as.numeric("p")'
» sequences("parallel")
» [1] "A" "B"
» Warning message:
» In sequences("parallel") : NAs introduced by coercion

»
» Q1: So this is where that warning message comes from.

Correct. You have discovered a bug. Congratulation :-D.

» Q2: Nope, cannot do it with sequences("parallel",tmts=c("R","T")).

Warning still alive.

» Q3: Ok, it still works and it just happens to design=="parallel".

Also correct. It works, but with a stupid warning.

» Q4: not implemented yet for sure.

Correct, not implemented yet.

A new version with bug fix is on its way to CRAN.

Regards,

Detlew
yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-24 19:32

@ d_labes
Posting: # 20514
Views: 893
 

 about package randomizeBE

Dear Detlew,

Thank you so much for your replied messages. It confirms what I found.

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-08-25 13:43

@ yjlee168
Posting: # 20515
Views: 895
 

 randomizeBE 0.3-5

Dear Yung-jin,

sources of randomizeBE 0.3-5 on CRAN since yesterday.

Your test cases:

library(randomizeBE)
tmts <- c("R", "T")
# [1] "R" "T"

sequences("parallel")
# [1] "A" "B"

sequences("parallel", tmts=c("R", "T1", "T2"))
Error in sequences("parallel", tmts = c("R", "T1", "T2")) :
  Treatment codes must have 2 entries!


Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-25 15:19

@ Helmut
Posting: # 20516
Views: 875
 

 randomizeBE 0.3-5

Dear Helmut,

» sources of randomizeBE 0.3-5 on CRAN since yesterday.

Thank you for your messages. I just got upgraded.

packageVersion("randomizeBE")
[1] ‘0.3.5’

»...
» sequences("parallel")
» [1] "A" "B"
»
» sequences("parallel", tmts=c("R", "T1", "T2"))
» Error in sequences("parallel", tmts = c("R", "T1", "T2")) :
» Treatment codes must have 2 entries![/code][/indent]

Right. Though sequences() dose not work with tmts=c("R","T") or tmts=c("R","T1","T2"), RL4() still works very well.
RL4(24,seqs=c("R","T"))
Randomization table          created: 2019-08-25 20:13:13
(seed: 886436 blocksize: 4 )

 subject seqno sequence
       1     1        R
       2     1        R
       3     2        T
       4     2        T
       5     1        R
       6     1        R
       7     2        T
       8     2        T
       9     1        R
      10     2        T
      11     1        R
      12     2        T
      13     1        R
      14     1        R
      15     2        T
      16     2        T
      17     2        T
      18     2        T
      19     1        R
      20     1        R
      21     2        T
      22     1        R
      23     2        T
      24     1        R

RL4(24,seqs=c("R","T1","T2"))
Randomization table          created: 2019-08-25 20:15:06
(seed: 3637764 blocksize: 6 )

 subject seqno sequence
       1     2       T1
       2     3       T2
       3     3       T2
       4     2       T1
       5     1        R
       6     1        R
       7     1        R
       8     3       T2
       9     2       T1
      10     3       T2
      11     2       T1
      12     1        R
      13     3       T2
      14     2       T1
      15     1        R
      16     1        R
      17     3       T2
      18     2       T1
      19     3       T2
      20     2       T1
      21     2       T1
      22     1        R
      23     3       T2
      24     1        R

That means I cannot use RL4(...,seqs=seqs) where seqs=squences(...) if I prefer using "R", "T", "T1", "T2" for treatment abbreviated, instead of "A", "B", "C" etc.. Am I correct?

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-08-25 16:26

@ yjlee168
Posting: # 20517
Views: 865
 

 randomizeBE 0.3-5

Hi Yung-jin,

» That means I cannot use RL4(...,seqs=seqs) where seqs=squences(...) if I prefer using "R", "T", "T1", "T2" for treatment abbreviated, instead of "A", "B", "C" etc.. Am I correct?

I’m not sure whether I understand you correctly. See ?sequences. Only designs listed there are implemented. Hence, you can’t randomize a parallel design with >2 groups.
However,

sequences("4x4", tmts=c("R1", "R2", "T1", "T2"))
# [1] "R1T2R2T1" "R2T1T2R1" "T1R2R1T2" "T2R1T1R2"

williams(ntmt=4, tmts=c("R1", "R2", "T1", "T2"))
# [1] "R1T2T1R2" "R2T1T2R1" "T1R1R2T2" "T2R2R1T1"

work as designed.

Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-25 17:08

@ Helmut
Posting: # 20518
Views: 860
 

 randomizeBE 0.3-5

Dear Helmut,

You're right. Great and many thanks. I just get confused. It is much more convenient to use seqs=sequences(...) in RL4(...,seqs=seqs). Sorry about that. :-D

» ... I’m not sure whether I understand you correctly. See ?sequences. Only designs listed there are implemented. Hence, you can’t randomize a parallel design with >2 groups.

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2019-08-25 19:39

@ Helmut
Posting: # 20519
Views: 857
 

 randomizeBE 0.3-5

Dear both,

sequences() and williams() are only convenience functions to give you the sequences of a design from its short-hand name.
And as Helmut already stated: "parallel" is the short hand for 2-group parallel design and can't therefore used with the treatment codes T1, T2 and R.

But main function RL4() accepts of course the "sequences" (aka groups) T1, T2 and R as noticed above and gives you a randomization list also for that design (3-group parallel) not listed in sequences().

BTW: Since today randomizeBE v0.3-5 is available at CRAN also as windows binaries.

Regards,

Detlew
Activity
 Admin contact
20,145 posts in 4,248 threads, 1,385 registered users;
online 7 (0 registered, 7 guests [including 4 identified bots]).
Forum time (Europe/Vienna): 14:46 CET

A little Learning is a dang’rous Thing;
Drink deep, or taste not the Pierian Spring:
There shallow Draughts intoxicate the Brain,
And drinking largely sobers us again.    Alexander Pope

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