Example(s) [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2015-08-13 16:58 (3502 d 14:58 ago) – Posting: # 15258
Views: 12,440

Hi BE-proff,

❝ I will accept all available scripts (if possible) but for BE studies I need cross-over, parallel, replicative designs (judging on PASS).


After library(PowerTOST) type help(package=PowerTOST). All linked functions contain not only de­scrip­tions of required parameters (and their defaults – which you could leave out) but at the end some examples. Compare them to PASS (or the other way ’round).


Edit: Code to explore this example.

library(PowerTOST)
N     <- c(50, 150, 250, 350, 450, 550) # vector of sample sizes
RL    <- 0.9                            # lower acceptance limit
UL    <- 1/RL                           # upper acceptance limit
R1    <- 1                              # assumed ratio
COV   <- 0.5                            # assumed CV
Alpha <- 0.05                           # guess what!
Ns    <- length(N)                      # number of sample sizes
                                        # to explore
res   <- matrix(nrow=Ns, ncol=8, byrow=T,
           dimnames=list(NULL,
           c("Power", "N", "RL", "RU", "R1", "COV", "Alpha", "Beta")))
                                        # Define the result matrix:
                                        # 6 rows (sample size)
                                        # 8 columns
                                        # vector of column headers
res[, 2] <- N                           # fill in the given stuff
res[, 3] <- rep(RL, Ns)                 # to the respective
res[, 4] <- rep(UL, Ns)                 # cells of the
res[, 5] <- rep(R1, Ns)                 # matrix
res[, 6] <- rep(COV, Ns)
res[, 7] <- rep(Alpha, Ns)
for(j in 1:Ns) {                        # loop over sample sizes
  res[j, 1] <- power.TOST(alpha=Alpha, CV=COV, theta0=R1,
                 theta1=RL, theta2=UL, n=N[j], method="exact")

}
res[, 8] <- 1-res[, 1]
res <- data.frame(round(res, 4))        # cosmetics for
print(res, row.names=F)                 # printing

Gives…

  Power   N  RL     RU R1 COV Alpha   Beta
 0.0000  50 0.9 1.1111  1 0.5  0.05 1.0000
 0.2190 150 0.9 1.1111  1 0.5  0.05 0.7810
 0.6002 250 0.9 1.1111  1 0.5  0.05 0.3998
 0.8064 350 0.9 1.1111  1 0.5  0.05 0.1936
 0.9101 450 0.9 1.1111  1 0.5  0.05 0.0899
 0.9596 550 0.9 1.1111  1 0.5  0.05 0.0404

… which exactly match PASS’ results. I was wrong (and Detlew right). Here PASS’ uses the exact method.

For the noncentral t I got…

  Power   N  RL     RU R1 COV Alpha   Beta
 0.0000  50 0.9 1.1111  1 0.5  0.05 1.0000
 0.2189 150 0.9 1.1111  1 0.5  0.05 0.7811
 0.6002 250 0.9 1.1111  1 0.5  0.05 0.3998
 0.8064 350 0.9 1.1111  1 0.5  0.05 0.1936
 0.9101 450 0.9 1.1111  1 0.5  0.05 0.0899
 0.9596 550 0.9 1.1111  1 0.5  0.05 0.0404

Slight differences for low samples sizes compared to the exact method.

Occasionally slight differences for the parallel design example.

library(PowerTOST)
N1    <- seq(50, 550, 100)
N2    <- N1
N     <- N1+N2
RL    <- 0.8
UL    <- 1/RL
R1    <- c(1, 1.05)
COV   <- 1.5
Alpha <- 0.05
Ns    <- length(N)
Rs    <- length(R1)
res   <- matrix(nrow=Ns*Rs, ncol=9, byrow=T,
           dimnames=list(NULL,
           c("Power", "N1", "N2", "N", "R1", "COV", "RL", "RU", "Alpha")))
res[, 2] <- rep(N1, Rs)
res[, 3] <- rep(N2, Rs)
res[, 4] <- rep(N, Rs)
res[, 5] <- rep(R1, each=Ns)
res[, 6] <- rep(COV, Ns*Rs)
res[, 7] <- rep(RL, Ns*Rs)
res[, 8] <- rep(UL, Ns*Rs)
res[, 9] <- rep(Alpha, Ns*Rs)
l     <- 0
for(k in 1:Rs) {   # loop over ratios
  for(j in 1:Ns) { # loop over sample sizes
    l <- l+1
    res[l, 1] <- power.TOST(alpha=Alpha, CV=COV, theta0=R1[k],
                   theta1=RL, theta2=UL, n=N[j], method="exact",
                   design="parallel")
  }
}
res <- data.frame(round(res, 5))
print(res, row.names=F)

   Power  N1  N2    N   R1 COV  RL   RU Alpha
 0.00000  50  50  100 1.00 1.5 0.8 1.25  0.05
 0.10488 150 150  300 1.00 1.5 0.8 1.25  0.05
 0.48431 250 250  500 1.00 1.5 0.8 1.25  0.05
 0.71606 350 350  700 1.00 1.5 0.8 1.25  0.05
 0.84896 450 450  900 1.00 1.5 0.8 1.25  0.05
 0.92185 550 550 1100 1.00 1.5 0.8 1.25  0.05
 0.00000  50  50  100 1.05 1.5 0.8 1.25  0.05
 0.09731 150 150  300 1.05 1.5 0.8 1.25  0.05
 0.43421 250 250  500 1.05 1.5 0.8 1.25  0.05
 0.63561 350 350  700 1.05 1.5 0.8 1.25  0.05
 0.75960 450 450  900 1.05 1.5 0.8 1.25  0.05
 0.83925 550 550 1100 1.05 1.5 0.8 1.25  0.05


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,409 posts in 4,921 threads, 1,667 registered users;
65 visitors (0 registered, 65 guests [including 10 identified bots]).
Forum time: 06:56 CET (Europe/Vienna)

They must find it difficult…; those who have taken authority as the truth,
rather than truth as the authority.    Gerald Massey

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