Appendix C, Table I [Power / Sample Size]

posted by Helmut Homepage – Vienna, Austria, 2016-07-19 17:07 (3129 d 13:28 ago) – Posting: # 16493
Views: 6,239

Dear Detlew,

hijacking your code:

library(PowerTOST)
CVm <- function(sD, swT, swR=swT, design){
  if (design == "2x2") {
    s2diff <- (sD^2 + swT^2 + swR^2)/2
  }
  else if (design == "2x2x4") {
    s2diff <- sD^2 + (swT^2 + swR^2)/2
  } else stop("Design not implemented.")
  mse2CV(s2diff)
}
delta       <- 0.05
targetpower <- c(0.80, 0.90)
design      <- c("2x2", "2x2x4")
swT         <- c(0.15, 0.23, 0.30, 0.50)
sD          <- c(0.01, 0.10, 0.15)
method      <- "exact"
n           <- matrix(data=NA,
                      ncol=length(targetpower)*2+2,
                      nrow=length(swT)*length(sD))
dimnames(n) <- list(NULL, c("swT", "sD",
                    sort(paste0(sprintf("%i%%:", 100*targetpower),
                    rep(c("2P", "4P"), each=length(targetpower))))))
n[, 1]      <- rep(swT, each=length(sD))
n[, 2]      <- rep(sD, length(swT))
r           <- 0
for (j in seq_along(swT)) {
  for (k in seq_along(sD)) {
    r  <- r + 1
    c  <- 2
    for (l in seq_along(targetpower)) {
      for (m in seq_along(design)) {
        c <- c + 1
        CV <- CVm(sD[k], swT[j], design=design[m])
        n[r, c] <- sampleN.TOST(CV=CV, theta0=exp(-delta),
                                targetpower=targetpower[l],
                                design=design[m], method=method,
                                print=FALSE)[["Sample size"]]
      }
    }
  }
}
print(as.data.frame(n), row.names=FALSE)

Gives:

  swT   sD 80%:2P 80%:4P 90%:2P 90%:4P
 0.15 0.01     12      6     16      8
 0.15 0.10     14      8     18     10
 0.15 0.15     16     12     22     14
 0.23 0.01     24     12     32     16
 0.23 0.10     28     14     36     20
 0.23 0.15     30     18     40     24
 0.30 0.01     40     20     54     28
 0.30 0.10     42     22     56     30
 0.30 0.15     46     26     60     34
 0.50 0.01    108     54    146     74
 0.50 0.10    110     56    148     76
 0.50 0.15    114     60    152     80

Equal to, lower / higher than the reference (Appendix C, Table I):

                Δ = 0.05     
           80% Power 90% Power
           ───────────────────
 σWT   σD    2P  4P    2P  4P
──────────────────────────────
0.15  0.01   12   6    16   8
      0.10   14  10    18  12
      0.15   16  12    22  16
──────────────────────────────
0.23  0.01   24  12    32  16
      0.10   26  16    36  20
      0.15   30  18    38  24
──────────────────────────────
0.30  0.01   40  20    54  28
      0.10   42  24    56  30
      0.15   44  26    60  34
──────────────────────────────
0.50  0.01  108  54   144  72
      0.10  110  58   148  76
      0.15  112  60   150  80


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,380 posts in 4,914 threads, 1,662 registered users;
33 visitors (0 registered, 33 guests [including 8 identified bots]).
Forum time: 05:36 CET (Europe/Vienna)

Skill is a function of chance.
It’s an intuitive best-use of chance situations.    Philip K. Dick

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