yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-19 14:14
(1883 d 22:17 ago)

Posting: # 20502
Views: 6,369
 

 about package randomizeBE [🇷 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.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-20 16:04
(1882 d 20:27 ago)

@ yjlee168
Posting: # 20505
Views: 5,072
 

 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.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2019-08-24 18:26
(1878 d 18:05 ago)

@ yjlee168
Posting: # 20512
Views: 5,014
 

 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 21:32
(1878 d 14:59 ago)

@ d_labes
Posting: # 20514
Views: 5,003
 

 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.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-08-25 15:43
(1877 d 20:48 ago)

@ yjlee168
Posting: # 20515
Views: 5,151
 

 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!


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
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-25 17:19
(1877 d 19:12 ago)

@ Helmut
Posting: # 20516
Views: 5,209
 

 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.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-08-25 18:26
(1877 d 18:05 ago)

@ yjlee168
Posting: # 20517
Views: 5,036
 

 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.

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
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2019-08-25 19:08
(1877 d 17:23 ago)

@ Helmut
Posting: # 20518
Views: 4,942
 

 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.9.1:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
d_labes
★★★

Berlin, Germany,
2019-08-25 21:39
(1877 d 14:52 ago)

@ Helmut
Posting: # 20519
Views: 5,009
 

 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
UA Flag
Activity
 Admin contact
23,258 posts in 4,886 threads, 1,671 registered users;
82 visitors (0 registered, 82 guests [including 7 identified bots]).
Forum time: 12:32 CEST (Europe/Vienna)

Tortured data will confess to anything.    Fredric Menger

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