Advanced example for 2X2X2 [🇷 for BE/BA]
Dear Helmut, Detlew and BE-proff!
Helmut, THX a lot for this great code!
I think the version for 2X2X2 would be also useful (your code a little bit changed):
Detlew, what about implementation in PowerTOST both branches?
PS: Helmut&Detlew, it seems sometimes that you're thinking on R
Helmut, THX a lot for this great code!
I think the version for 2X2X2 would be also useful (your code a little bit changed):
library(PowerTOST)
f1 <- function(x) power.TOST(CV=CV.Cmax, theta0=x, n=n1.AUC, des=des)-pwr
f2 <- function(x) power.TOST(CV=CV.AUC, theta0=x, n=n1.Cmax, des=des)-pwr
CV.Cmax <- 0.29 # 2X2X2 even for HVD/HVDPs
CV.AUC <- 0.25 # as well!
TR.Cmax <- 0.95 # May change to a nicer value if CV <0.3
TR.AUC <- 0.94 # same!
pwr <- 0.8 # target
des <- "2x2x2" # RT|TR
res <- matrix(nrow=2, ncol=7, byrow=T, dimnames=list(NULL,
c("Method", "metric", "GMR", "CV", "n",
"power", "GMRlo")))
res.Cmax <- sampleN.TOST(CV=CV.Cmax, theta0=TR.Cmax, targetpower=pwr,
des=des, details=F, print=F)
n1.Cmax <- res.Cmax[["Sample size"]]
pwr.Cmax <- res.Cmax[["Achieved power"]]
res.AUC <- sampleN.TOST(CV=CV.AUC, theta0=TR.AUC, targetpower=pwr,
des=des, print=F) # ABE
n1.AUC <- res.AUC[["Sample size"]]
pwr.AUC <- res.AUC[["Achieved power"]]
if(n1.Cmax >= n1.AUC) {
pwr.AUC <- power.TOST(CV=CV.AUC, theta0=TR.AUC, n=n1.Cmax, des=des)
TR.AUC.min <- uniroot(f2, interval=c(0, 1), tol=1e-6)$root
cat(paste0("PK metric driving the sample size: Cmax\n",
"Sample size: ", n1.Cmax, " (ABE, power: ", sprintf("%.4f", pwr.Cmax), ")\n",
"Power of AUC (ABE): ", sprintf("%.4f", pwr.AUC), "\n",
"Lowest T/R-ratio of AUC which will give ", pwr, " power: ",
sprintf("%.4f", TR.AUC.min), "\n"))
res[1, ] <- c("ABE", "Cmax", sprintf("%.2f", TR.Cmax),
sprintf("%.2f", CV.Cmax), n1.Cmax,
sprintf("%.4f", pwr.Cmax), NA)
res[2, ] <- c("ABE", "AUC", sprintf("%.2f", TR.AUC),
sprintf("%.2f", CV.AUC), n1.Cmax, sprintf("%.4f", pwr.AUC), sprintf("%.4f", TR.AUC.min))
} else {
pwr.Cmax <- power.TOST (CV=CV.Cmax, theta0=TR.Cmax, n=n1.AUC, des=des)
TR.Cmax.min <- uniroot(f1, interval=c(0, 1), tol=1e-6)$root
cat(paste0("PK metric driving the sample size: AUC\n",
"Sample size: ", n1.AUC, " (ABE, power: ", sprintf("%.4f", pwr.AUC), ")\n",
"Power of Cmax (ABE): ", sprintf("%.4f", pwr.Cmax), "\n",
"Lowest T/R-ratio of Cmax which will give ", pwr, " power: ",
sprintf("%.4f", TR.Cmax.min), "\n"))
res[1, ] <- c("ABE", "AUC", sprintf("%.2f", TR.AUC),
sprintf("%.2f", CV.AUC), n1.AUC, sprintf("%.4f", pwr.AUC), NA)
res[2, ] <- c("ABE", "Cmax", sprintf("%.2f", TR.Cmax),
sprintf("%.2f", CV.Cmax), n1.AUC, sprintf("%.4f", pwr.Cmax),
sprintf("%.4f", TR.Cmax.min))
}
res <- data.frame(res)
print(res, row.names=F)
Detlew, what about implementation in PowerTOST both branches?

PS: Helmut&Detlew, it seems sometimes that you're thinking on R

—
Kind regards,
Mittyri
Kind regards,
Mittyri
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 2X2X2mittyri 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 2X2X2mittyri 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