Why not base 🇷? [Power / Sample Size]

posted by Helmut Homepage – Vienna, Austria, 2024-12-03 14:39 (42 d 22:10 ago) – Posting: # 24306
Views: 1,001

Hi Weidson,

the function CI.RatioF() can only handle parallel and 2×2×2 crossover designs but you have a replicate.
You mastered the evaluation in Excel. :-D
Alternatively an [image]-script following the FDA’s guidance (the raw data are given in Table AIV.6 of the 1995 guidance). The FDA took accurate calculations lightly (e.g., (–43.63 + –34.36) / 2  –38.99!).

raw   <- read.delim(file = "https://bebac.at/downloads/FDA162457Example.csv")
# Cave: only for complete data!
m <- function(x, treatment, sites) {
  (x$AUEC[x$treatment == treatment & x$site == sites[1]] +
   x$AUEC[x$treatment == treatment & x$site == sites[2]]) / 2
}
sites <- unique(raw$site)
Y     <- data.frame(subject = unique(raw$subject),
                    T = m(raw, "T", sites), R = m(raw, "R", sites))
X.T   <- mean(Y$T)
X.R   <- mean(Y$R)
s2.TT <- var(Y$T)  # in the guidance standard deviation σ
s2.RR <- var(Y$R)  # but actually sample variances
s2.TR <- cov(Y$T, Y$R)
pe    <- X.T / X.R
n     <- nrow(Y)
t     <- qt(p = 0.95, df = n - 1)
G     <- t^2 * s2.RR / (n * X.R^2)
if (G >= 1) {
  cat("With G =", G, "the study does not meet the in vivo bioequivalence requirements.\n")
} else {
  K  <- pe^2 + s2.TT / s2.RR * (1 - G) + s2.TR / s2.RR * (G * s2.TR / s2.RR - 2 * pe)
  ci <- setNames(c(100 * ((pe - G * s2.TR / s2.RR) + c(1, -1) * t / X.R *
                           sqrt(s2.RR / n * K)) / (1 - G)), c("lower", "upper"))
  i  <- "With a 90% confidence interval of"
  p  <- "the study passed bioequivalence.\n"
  f  <- "the study failed to show bioequivalence.\n"
  if (ci[["lower"]] >= 80 & ci[["upper"]] <= 125) {
    cat(sprintf("%s %.1f\u2013%.1f%% %s", i, ci[["lower"]], ci[["upper"]], p))
  } else {
    cat(sprintf("%s %.1f\u2013%.1f%% %s", i, ci[["lower"]], ci[["upper"]], f))
  }
}

You should get:

With a 90% confidence interval of 53.6–165.9% the study failed to show bioequivalence.


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

Complete thread:

UA Flag
Activity
 Admin contact
23,362 posts in 4,906 threads, 1,677 registered users;
89 visitors (0 registered, 89 guests [including 6 identified bots]).
Forum time: 12:49 CET (Europe/Vienna)

I have not failed 700 times. I have not failed once.
I have succeeded in proving
that those 700 ways will not work.    Thomas Alva Edison

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