BEQool
★    

2023-03-31 12:05
(390 d 01:56 ago)

Posting: # 23518
Views: 1,585
 

 CI.BE in PowerTOST [🇷 for BE/BA]

Hello everyone!

I am a complete beginner in BEQ field and lately I have been going through this forum a lot and have learned so much and I would like to thank you all for contributing to thorough explanations and interesting discussions.

Regarding my question, I was calculating confidence intervals in R using package PowerTOST and function CI.BE and I think I have noticed a minor mistake in CI calculations when having unbalanced design with odd total number of subjects without defining number of subjects in each sequence. If I am not mistaken, in this case the program incorrectly calculates CI assuming balanced design with half (0.5) of a subject in each sequence and doesnt assume an unbalanced design with small imbalanced as it does in other functions (for example when calculating power using power.TOST).

An example:
CI.BE(pe=1.0659, CV=0.1539, n=27)
    lower     upper
0.9927168 1.1444783

CI.BE(pe=1.0659, CV=0.1539, n=c(13.5,13.5))
    lower     upper
0.9927168 1.1444783

CI.BE(pe=1.0659, CV=0.1539, n=c(14,13))
    lower     upper
0.9926683 1.1445341


Notice that CI for n=27 are the same as for n=c(13.5,13.5), however the correct CI should probably be the same as for n=c(14,13). Not big of a difference, however it could be relevant in some cases?

I am sorry if this has already been discussed before, I went through forum and havent found anything relevant.


Best regards
BEQool
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2023-03-31 13:41
(390 d 00:20 ago)

@ BEQool
Posting: # 23519
Views: 1,356
 

 Bug in PowerTOST:CI.BE

Hi BEQool,

❝ […] I would like to thank you all for contributing to thorough explanations and interesting discussions.


Welcome (also in the name of other members of the forum).

❝ […] I was calculating confidence intervals in R using package PowerTOST and function CI.BE and I think I have noticed a minor mistake in CI calculations when having unbalanced design with odd total number of subjects without defining number of subjects in each sequence. If I am not mistaken, in this case the program incorrectly calculates CI assuming balanced design with half (0.5) of a subject in each sequence and doesnt assume an unbalanced design with small imbalanced as it does in other functions (for example when calculating power using power.TOST).


[image]Oops – THX for discovering a bug! We will correct the function and update the package as soon as possible.

BTW, the problem applies not only to odd total sizes:

library(PowerTOST)
pe <- 0.95
CV <- 0.3
# both n1 and n2 are even, same total n
n  <- 40
n1 <- seq(20, 30, 2)
n2 <- n - n1
CI <- data.frame(n1 = n1, n2 = n2, lower = NA_real_, upper = NA_real_)
for (i in 1:nrow(CI)) {
  CI[i, 3:4] <- CI.BE(pe = pe, CV = CV, n = CI[i, 1:2])
}
print(round(CI, 4), row.names = FALSE)

 n1 n2  lower  upper
 20 20 0.8505 1.0612
 22 18 0.8500 1.0618
 24 16 0.8485 1.0636
 26 14 0.8459 1.0669
 28 12 0.8419 1.0719
 30 10 0.8360 1.0795


The more imbalanced the design gets, the wider the CI. When we implement ‘best guess’ sequence-/group-sizes like in the other functions, it will still be what it says: A guess (trying to keep the design as balanced as possible).
If you give the total sample size, you will always get the first row of the data frame above, i.e.,

round(CI.BE(pe = pe, CV = CV, n = n), 4)
 lower  upper
0.8505 1.0612


Unless a study is balanced, please give always the vector of subjects / sequence (crossovers) or subjects / group (parallel designs).


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
BEQool
★    

2023-04-03 07:38
(387 d 06:22 ago)

@ Helmut
Posting: # 23521
Views: 1,258
 

 Bug in PowerTOST:CI.BE

Great, thank you for additional explanation as well!

BEQool
UA Flag
Activity
 Admin contact
22,993 posts in 4,828 threads, 1,658 registered users;
65 visitors (0 registered, 65 guests [including 6 identified bots]).
Forum time: 14:01 CEST (Europe/Vienna)

So far as I can remember,
there is not one word in the Gospels
in praise of intelligence.    Bertrand Russell

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