Appendix C, Table I [Power / Sample Size]
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)
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
Δ = 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]](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:
- Determination of sample size including the factor of σD junhao 2016-07-08 04:34 [Power / Sample Size]
- Sample size taking into account SbF d_labes 2016-07-13 13:49
- Sample size taking into account SbF junhao 2016-07-14 05:54
- Sample size taking into account SbF d_labes 2016-07-19 09:18
- Appendix C, Table IHelmut 2016-07-19 15:07
- Appendix C, Table I d_labes 2016-07-20 11:27
- I don’t care Helmut 2016-07-20 15:45
- Appendix C, Table I d_labes 2016-07-20 11:27
- Appendix C, Table IHelmut 2016-07-19 15:07
- Sample size taking into account SbF d_labes 2016-07-19 09:18
- Sample size taking into account SbF junhao 2016-07-14 05:54
- Sample size taking into account SbF d_labes 2016-07-13 13:49