n iteratively from power [Power / Sample Size]

posted by Helmut Homepage – Vienna, Austria, 2021-10-24 10:54 (45 d 01:10 ago) – Posting: # 22655
Views: 517

Hi Imph,

» 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
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

Activity
 Admin contact
21,788 posts in 4,557 threads, 1,548 registered users;
online 16 (0 registered, 16 guests [including 5 identified bots]).
Forum time: Wednesday 11:05 CET (Europe/Vienna)

There is no adequate defense, except stupidity,
against the impact of a new idea.    Percy Williams Bridgman

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5