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

posted by Helmut Homepage – Vienna, Austria, 2023-03-31 13:41 (447 d 08:40 ago) – Posting: # 23519
Views: 1,676

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:

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

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

Complete thread:

UA Flag
 Admin contact
23,059 posts in 4,841 threads, 1,647 registered users;
41 visitors (0 registered, 41 guests [including 8 identified bots]).
Forum time: 22:22 CEST (Europe/Vienna)

Friends don’t let friends use Excel for statistics!    Jonathan D. Cryer

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