Example(s) [🇷 for BE/BA]
❝ 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 descriptions 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
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
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
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]](https://static.bebac.at/pics/Blue_and_yellow_ribbon_UA.png)
Helmut Schütz
![[image]](https://static.bebac.at/img/CC by.png)
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- Power calculation BE-proff 2015-08-13 13:44 [🇷 for BE/BA]
- Power calculation Helmut 2015-08-13 13:59
- Power calculation BE-proff 2015-08-13 14:44
- Example(s)Helmut 2015-08-13 14:58
- Power parallel group: PowerTOST/SAS/PASS d_labes 2015-08-14 10:29
- Power parallel group: PowerTOST/SAS/PASS Helmut 2015-08-14 15:34
- Power parallel group: PowerTOST/SAS/PASS d_labes 2015-08-14 10:29
- Slippery ground d_labes 2015-08-14 10:50
- Advanced example Helmut 2015-08-14 16:41
- Advanced example for 2X2X2 mittyri 2015-08-14 19:40
- Spaghetti viennese Helmut 2015-08-15 03:22
- Spaghetti viennese d_labes 2015-08-17 08:45
- Spaghetti viennese Helmut 2015-08-15 03:22
- Advanced example BE-proff 2015-08-17 08:55
- Advanced example for 2X2X2 mittyri 2015-08-14 19:40
- Advanced example Helmut 2015-08-14 16:41
- Example(s)Helmut 2015-08-13 14:58
- Power calculation BE-proff 2015-08-13 14:44
- Power calculation Helmut 2015-08-13 13:59