Simulations [Power / Sample Size]
❝ I mean to say always it is coming in the interval 95 to 99 and some times 100 ofcourse one time only, some times we are getting less power on 80s but very less times.
It might be in the actual study that the CV is lower and/or the GMR closer to 1 than assumed. Power is especially sensitive to the GMR. We can also simulate studies and assess the outcome. The GMR follows the lognormal distribution and the variance the χ² distribution with n–2 degrees of freedom in a 2×2×2 crossover. Try this R-code (the library
PowerTOST
will be installed if not available):### housekeeping ###
rm(list=ls(all=TRUE))
packages <- c("PowerTOST", "MASS")
inst <- packages %in% installed.packages()
if (length(packages[!inst]) > 0) install.packages(package[!inst])
invisible(lapply(packages, require, character.only=TRUE))
### give the relevant data below ###
CV <- 0.20 # assumed CV
theta0 <- 0.95 # assumed T/R-ratio
target <- 0.90 # target (desired) power
nsims <- 1e4 # number of simulated studies
### change below this line only if you know what you are doing ###
plan <- sampleN.TOST(CV=CV, theta0=theta0, targetpower=target, print=FALSE)
n <- plan[["Sample size"]]
sim.pwr <- power.TOST.sim(CV=CV, theta0=theta0, n=n, nsims=nsims)
cat(paste0("Assumed CV = ", CV, ", GMR = ", theta0, "; target power = ", target,
";\nestimated sample size = ", n, " (power = ", signif(plan[["Achieved power"]], 4),
").\nAverage power in ", nsims, " simulated studies: ", signif(sim.pwr, 4), "\n"))
Assumed CV = 0.2, GMR = 0.95; target power = 0.9;
estimated sample size = 26 (power = 0.9176).
Average power in 10000 simulated studies: 0.9208
If you are interested in distributions of the GMR, CVs, and powers in the simulated studies, continue:
df <- n-2
se <- CV2se(CV)*sqrt(0.5/n) # Cave: simple formula for balanced sequences
mse <- CV2mse(CV)
res <- data.frame(GMR=rep(NA, nsims), CV=NA, power=NA)
names(res)[3] <- "post hoc power"
set.seed(123456)
res$GMR <- exp(rnorm(n=nsims, mean=log(theta0), sd=sqrt(0.5/n)*sqrt(mse)))
res$CV <- mse2CV(mse*rchisq(n=nsims, df=df)/df)
for (j in 1:nsims) {
res[j, 3] <- power.TOST(CV=res$CV[j], theta0=res$GMR[j], n=n)
}
cat("Results of", nsims, "simulated studies:\n"); summary(res)
Results of 10000 simulated studies:
GMR CV post hoc power
Min. :0.8454 Min. :0.09836 Min. :0.2635
1st Qu.:0.9326 1st Qu.:0.17808 1st Qu.:0.8374
Median :0.9505 Median :0.19758 Median :0.9189
Mean :0.9508 Mean :0.19850 Mean :0.8887
3rd Qu.:0.9679 3rd Qu.:0.21801 3rd Qu.:0.9683
Max. :1.0493 Max. :0.31336 Max. :1.0000
Explore also boxplots and a histograms:
col <- "bisque"
boxplot(res, col=col, boxwex=0.65, las=1)
grid()
ylab <- "relative frequency density"
op <- par(no.readonly=TRUE)
np <- c(4.5, 4.5, 1, 0.3) + 0.1
par(mar=np)
split.screen(c(1, 3))
screen(1)
truehist(res[, 1], col=col, lty=0, xlab="GMR", las=1, bty="o", ylab=ylab, log="x")
screen(2)
truehist(res[, 2], col=col, lty=0, xlab="CV", las=1, bty="o", ylab=ylab)
screen(3)
truehist(res[, 3], col=col, lty=0, xlab="post hoc power", las=1, bty="o", ylab=ylab)
abline(v=plan[["Achieved power"]], col="blue")
close.screen(all=TRUE)
par(op)
Even if the study was planned for 90% power (like in the example) I strongly doubt that you will always get a post hoc power of 95–99%:
cat("Simulated studies with post hoc power [0.95, 0.99]:", sprintf("%.2f%%",
100*length(res[, 3][res[, 3] >= 0.95 & res[, 3] <=0.99])/nsims), "\n")
Simulated studies with post hoc power [0.95, 0.99]: 25.28%
If the study was planned for 80% power it will be even less likely:
Simulated studies with post hoc power [0.95, 0.99]: 12.63%
As ElMaestro suggested: Can you give us one example? We need the CV, the GMR, the number of eligible subjects, and your “power”. If the study was imbalanced, please give the number of subjects in each sequence.
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 is getting high kms.srinivas 2017-12-26 07:39 [Power / Sample Size]
- Power is getting high? d_labes 2017-12-26 12:08
- Stop estimating post hoc power! Helmut 2017-12-26 12:22
- Stop estimating post hoc power! kms.srinivas 2017-12-26 13:00
- Stop estimating post hoc power! ElMaestro 2017-12-26 14:11
- SimulationsHelmut 2017-12-26 15:51
- Simulations BE-proff 2017-12-27 06:53
- Simulations ElMaestro 2017-12-27 07:25
- Simulations Yura 2017-12-27 08:23
- Simulations kms.srinivas 2017-12-27 09:11
- Simulations Yura 2017-12-27 10:07
- α and 1–β Helmut 2017-12-27 12:57
- α and 1–β Yura 2017-12-27 13:33
- α and 1–β Helmut 2017-12-27 14:31
- α and 1–β Yura 2017-12-28 06:50
- Educate the IEC and regulators Helmut 2017-12-28 11:30
- α and 1–β Yura 2017-12-28 06:50
- α and 1–β Helmut 2017-12-27 14:31
- α and 1–β Yura 2017-12-27 13:33
- α and 1–β Helmut 2017-12-27 12:57
- “Forced BE” 101 Helmut 2017-12-27 12:23
- “Forced BE” 101 kms.srinivas 2017-12-27 12:41
- Would you be so kind answering our questions? Helmut 2017-12-27 13:02
- Would you be so kind answering our questions? kms.srinivas 2017-12-28 05:53
- Yes, but why? Helmut 2017-12-28 11:47
- Yes, but why? DavidManteigas 2017-12-28 16:59
- Optimists and pessimists Helmut 2017-12-28 17:33
- "normal" GMR setting d_labes 2017-12-28 18:57
- Example for discussion mittyri 2017-12-28 22:06
- Example for discussion Helmut 2017-12-28 22:33
- I prefer to play it safe Helmut 2017-12-28 22:10
- Example for discussion mittyri 2017-12-28 22:06
- "normal" GMR setting d_labes 2017-12-28 18:57
- Full ACK d_labes 2017-12-28 17:41
- About GMR 1.10 kms.srinivas 2017-12-29 13:20
- Better 0.95 or 0.90 Helmut 2017-12-29 16:18
- Optimists and pessimists Helmut 2017-12-28 17:33
- Yes, but why? Yura 2017-12-29 13:46
- Buffon's needle Astea 2018-01-20 23:55
- Buffon's needle Oleg777 2018-10-09 22:48
- 0.95 or 1.05 Helmut 2018-10-10 13:41
- Buffon's needle Helmut 2018-10-10 12:46
- Buffon's needle Astea 2018-10-11 23:14
- School maths Helmut 2018-10-12 01:10
- School russian Astea 2018-10-12 12:41
- Offtop: Umschrift der westlichen Eigennamen auf Russisch mittyri 2018-10-12 23:25
- School maths Helmut 2018-10-12 01:10
- Buffon's needle Astea 2018-10-11 23:14
- Buffon's needle Oleg777 2018-10-09 22:48
- Yes, but why? DavidManteigas 2017-12-28 16:59
- Yes, but why? Helmut 2017-12-28 11:47
- EEU? mittyri 2017-12-28 21:52
- EEU? Yura 2017-12-29 13:41
- EEU - pharmacokinetic equation??? mittyri 2017-12-29 14:11
- EEU? Beholder 2018-01-16 15:10
- EEU? Yura 2017-12-29 13:41
- Would you be so kind answering our questions? kms.srinivas 2017-12-28 05:53
- Would you be so kind answering our questions? Helmut 2017-12-27 13:02
- “Forced BE” 101 kms.srinivas 2017-12-27 12:41
- Simulations Yura 2017-12-27 10:07
- Simulations kms.srinivas 2017-12-27 09:11
- Simulations xtianbadillo 2018-01-18 22:22
- Simulations BE-proff 2017-12-27 06:53
- Stop estimating post hoc power! kms.srinivas 2017-12-26 13:00
- Numbers don't lie ElMaestro 2017-12-28 20:13