sampleN.NTID(): Example [Power / Sample Size]

posted by Helmut Homepage – Vienna, Austria, 2022-05-18 14:30 (50 d 04:54 ago) – Posting: # 23002
Views: 286

Hi pharm07,

» Kindly guide me with this example, i want to check whether i am making a mistake or not.:confused:

In your second script you forgot to state theta0 = 0.95. Hence, the default theta = 0.975 was employed.

library(PowerTOST)
balance <- function(n, n.seq) {
  # Round up to obtain balanced sequences
  return(as.integer(n.seq * (n %/% n.seq + as.logical(n %% n.seq))))
}
nadj <- function(n, do.rate, n.seq) {
  # Round up to compensate for anticipated dropout-rate
  return(as.integer(balance(n / (1 - do.rate), n.seq)))
}
CV      <- c(0.045, 0.07)      # First element CVwT, second CVwR
do.rate <- 0.30                # Anticipated dropout-rate 30%
n       <- sampleN.NTID(CV = CV, theta0 = 0.95, targetpower = 0.90,
                        print = FALSE, details = FALSE)[["Sample size"]]
dosed   <- nadj(n, do.rate, 2) # Adjust the sample size
df      <- data.frame(dosed = dosed, eligible = dosed:(n - 2))
for (j in 1:nrow(df)) {
  df$dropouts[j] <- sprintf("%.1f%%", 100 * (1 - df$eligible[j] / df$dosed[j]))
  df$power[j]    <- suppressMessages(
                      power.NTID(CV = CV, theta0 = 0.95, n = df$eligible[j]))
}
print(df, row.names = FALSE)

 dosed eligible dropouts   power
   146      146     0.0% 0.97046
   146      145     0.7% 0.96815
   146      144     1.4% 0.96887
   146      143     2.1% 0.96730
   146      142     2.7% 0.96592
   146      141     3.4% 0.96512
   146      140     4.1% 0.96470
   146      139     4.8% 0.96316
   146      138     5.5% 0.96322
   146      137     6.2% 0.96172
   146      136     6.8% 0.96048
   146      135     7.5% 0.95969
   146      134     8.2% 0.95892
   146      133     8.9% 0.95649
   146      132     9.6% 0.95497
   146      131    10.3% 0.95505
   146      130    11.0% 0.95347
   146      129    11.6% 0.95245
   146      128    12.3% 0.95101
   146      127    13.0% 0.94969
   146      126    13.7% 0.94851
   146      125    14.4% 0.94723
   146      124    15.1% 0.94594
   146      123    15.8% 0.94386
   146      122    16.4% 0.94258
   146      121    17.1% 0.94121
   146      120    17.8% 0.94039
   146      119    18.5% 0.93931
   146      118    19.2% 0.93649
   146      117    19.9% 0.93461
   146      116    20.5% 0.93393
   146      115    21.2% 0.93164
   146      114    21.9% 0.92946
   146      113    22.6% 0.92741
   146      112    23.3% 0.92519
   146      111    24.0% 0.92361
   146      110    24.7% 0.92132
   146      109    25.3% 0.91851
   146      108    26.0% 0.91725
   146      107    26.7% 0.91563
   146      106    27.4% 0.91393
   146      105    28.1% 0.91186
   146      104    28.8% 0.90848
   146      103    29.5% 0.90711
   146      102    30.1% 0.90354
   146      101    30.8% 0.90250
   146      100    31.5% 0.89851

Dif-tor heh smusma 🖖 [image]
Helmut Schütz
[image]

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

Complete thread:

UA Flag
Activity
 Admin contact
22,193 posts in 4,651 threads, 1,574 registered users;
online 7 (1 registered, 6 guests [including 4 identified bots]).
Forum time: Thursday 19:24 CEST (Europe/Vienna)

Any sufficiently advanced technology
is indistinguishable from magic.    Arthur C. Clarke

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