n iteratively from power [Power / Sample Size]
❝ Thank you so much. Your response has been of great help.
Welcome.
❝ – By consulting Dileti's paper, I noticed that there is no formula for the calculation of the number of subjects. Is there a way or a reference to get the formula please.
You can only calculate power for a given sample size, i.e., you start with an assumption and then increase (or decrease) n to obtain at least the target power. See there for the details.
Step by step:
library(PowerTOST)
CV <- 0.25
theta0 <- 0.95
target <- 0.80
n <- 12 # minimum acc. to the GLs
power <- power.TOST(CV = CV, theta0 = theta0, n = n)
iter <- 1
res <- data.frame(iter = iter, n = n, power = power)
if (res$power[iter] < target) { # upwards
repeat {
power <- power.TOST(CV = CV, theta0 = theta0, n = n)
res[iter, ] <- c(iter, n, power)
if (power >= target) {
break
} else {
iter <- iter + 1
n <- n + 2
}
}
} else { # downwards
repeat {
power <- power.TOST(CV = CV, theta0 = theta0, n = n)
res[iter, ] <- c(iter, n, power)
if (power < target) {
res <- res[-nrow(res), ]
break
} else {
iter <- iter + 1
n <- n - 2
}
}
}
print(res, row.names = FALSE)
iter n power
1 12 0.3137351
2 14 0.4141013
3 16 0.5041795
4 18 0.5801284
5 20 0.6430574
6 22 0.6953401
7 24 0.7391155
8 26 0.7760553
9 28 0.8074395
In
PowerTOST
’s sample size functions you can show the iterations by setting the argument details
to TRUE
(by default only the final result is shown):sampleN.TOST(CV = 0.25, theta0 = 0.95, targetpower = 0.80, details = TRUE)
+++++++++++ Equivalence test - TOST +++++++++++
Sample size estimation
-----------------------------------------------
Study design: 2x2 crossover
Design characteristics:
df = n-2, design const. = 2, step = 2
log-transformed data (multiplicative model)
alpha = 0.05, target power = 0.8
BE margins = 0.8 ... 1.25
True ratio = 0.95, CV = 0.25
Sample size search (ntotal)
n power
26 0.776055
28 0.807439
Exact power calculation with
Owen's Q functions.
❝ – […] in the calculation of the degrees of freedom, for example (2n-2), where "n" has to be estimated. I would like to know on what basis this "n" is estimated.
See above.
Dif-tor heh smusma 🖖🏼 Довге життя Україна!
Helmut Schütz
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- Choosing formula for sample size Imph 2021-10-20 11:03 [Power / Sample Size]
- Exact (Owen’s Q) Helmut 2021-10-20 11:36
- Exact (Owen’s Q) Imph 2021-10-20 12:53
- Exact (Owen’s Q) Helmut 2021-10-20 13:26
- Exact (Owen’s Q) Imph 2021-10-24 10:41
- n iteratively from powerHelmut 2021-10-24 10:54
- aproximate n d_labes 2021-10-24 19:26
- Exact (Owen’s Q) Willem Talloen 2022-09-01 15:48
- PowerTOST & FDA Helmut 2022-09-01 16:31
- Exact (Owen’s Q) Imph 2021-10-24 10:41
- Exact (Owen’s Q) Helmut 2021-10-20 13:26
- Exact (Owen’s Q) Imph 2021-10-20 12:53
- Exact (Owen’s Q) Helmut 2021-10-20 11:36