Table/R-code for AR [0.90/1.11] [Power / Sample Size]

posted by Helmut Homepage – Vienna, Austria, 2008-04-04 18:13 (6243 d 03:30 ago) – Posting: # 1764
Views: 7,443

Dear all,

I updated the sample size table (expected deviation of -5% from the reference, 80% and 90% power) according to exact results given in Table 5.3,[1] which are matched by results obtained by R-code given in this post with modifications[2] and David Dubin's FARTSSIE[3] (see this post).

       +-----------+-----------+-----------+
       |    [1]    |    [2]    |    [3]    |
+------+-----------+-----------+-----------+
|  CV% |  80%  90% |  80%  90% |  80%  90% |
+------+-----------+-----------+-----------+
|  5.0 |  14    18 |  14    18 |  14    18 |
|  6.0 |   .     . |  18    24 |  18    24 |
|  7.0 |   .     . |  24    32 |  24    32 |
|  7.5 |  26    36 |  26    36 |  26    36 |
|  8.0 |   .     . |  30    40 |  30    40 |
|  9.0 |   .     . |  36    50 |  36    50 |
| 10.0 |  44    60 |  44    60 |  44    60 |
| 11.0 |   .     . |  54    72 |  54    72 |
| 12.0 |   .     . |  62    86 |  62    86 |
| 12.5 |  68    94 |  68    94 |  68    94 |
| 13.0 |   .     . |  74   100 |  74   100 |
| 14.0 |   .     . |  84   116 |  84   116 |
| 15.0 |  96   132 |  96   132 |  96   132 |
| 17.5 | 130   180 | 130   180 | 130   180 |
| 20.0 | 168   232 | 168   232 | 168   232 |
| 22.5 | 212   292 | 212   292 | 212   292 |
| 25.0 | 258   358 | 258   358 | 258   358 |
+------+-----------+-----------+-----------+


The code (download link) was tested in versions 2.6.2, 2.5.1, 1.9.1, and 1.9.0.

#######################################################################
# Sample size calculation for a standard RT/TR                        #
# 2x2x2 cross-over design (multiplicative model)                      #
#######################################################################
# R-code based on SAS-code by
# (1) B. Jones and M.G. Kenward
#     Design and Analysis of Cross-Over Trials
#     Chapman & Hall/CRC, Boca Raton (2nd Edition 2000)
# (2) S. Patterson and B. Jones
#     Bioequivalence and Statistics in Clinical Pharmacology
#     Chapman & Hall/CRC, Boca Raton (2006)
# /*** WARNING : PROGRAM OFFERED FOR USE WITHOUT ANY GUARANTEES    ***/
# /*** NO LIABILITY IS ACCEPTED FOR ANY LOSS RESULTING FROM USE OF ***/
# /*** THIS SET OF SAS INTRUCTIONS                                 ***/
# Modification of degrees of freedom according to a
# personal message by D. Hauschke (E-mail 2006-01-05)
# Tested in R-versions 2.6.2 / 2.5.1 / 1.9.1 / 1.9.0
# 2008-04-04
# Helmut Schuetz
# BEBAC - Consultancy services for Bioequivalence
# and Bioavailability Studies
# 1070 Vienna, Austria
# ----------------------------------------------
a           <- 0.05      # alpha
theta1      <- 0.90      # lower acceptance limit
theta2      <- 1/theta1  # upper acceptance limit
ratio       <- 0.95      # expected ratio T/R
assign("target",
  c(0.8,0.9))            # target power
assign("CV",
  c(.05,.06,.07,.075,.08,
    .09,.1,.11,.12,.125,
    .13,.14,.15,.175,.2,
    .225,.25))           # intra-subject coefficients of variation
limit       <- 500       # upper sample size limit for search
# ----------------------------------------------
# Do not modify the code below this line unless
# you know what you are doing!
# ----------------------------------------------
for (i in CV)            # CV loop
  {
  if(i==CV[1]){
    title=paste(
      paste("   Sample size estimation for a standard\n",
        "  RT/TR 2x2x2 cross-over design (multi-\n",
        "  plicative model).\n",
        "  Expected ratio T/R =",
        format(round(ratio*100,2),nsmall=2,width=4),"%.\n\n"),
      paste(paste(format(round(target*100,2),nsmall=2,width=17),
        "%",sep="",collapse=""),"\n"),
      paste("  CV",
        paste(c(rep("   spl.size (pwr.)",
        length(target))),collapse=""),"\n"),
      paste("----",
        paste(c(rep(paste(rep("-",18),collapse=""),
        length(target))),collapse=""),"\n") )
    cat(title)
    }
  cat(paste(format(i*100,nsmall=1,width=4),"% ",sep=""))
  sigmaW    <- sqrt(log(1+i^2))
  s         <- sqrt(2)*sigmaW
  for (j in target)      # power loop
    {
    n       <- 6         # start value of sample size search
    repeat{
      df    <- n-2
      t1    <- qt(1-a,df)
      t2    <- -t1
      nc1   <- (sqrt(n))*((log(ratio)-log(theta1))/s)
      nc2   <- (sqrt(n))*((log(ratio)-log(theta2))/s)
      prob1 <- pt(t1,df,nc1)
      prob2 <- pt(t2,df,nc2)
      power <- prob2-prob1
      ppct  <- power*100
      if(power >= j | n > limit) break
      n     <- n+2       # increment for even sample size
      }
    if(n <= limit){
      cat(paste(format(n,width=5)," (",
        format(round(ppct,5),nsmall=5,width=8),"%) ",
        sep=""))
      } else
      cat(paste(">",format(limit,width=4)," (",
        format(round(ppct,5),nsmall=5,width=8),"%) ",
        sep=""))
    }
  cat("\n")
  }


You can modify the code to your needs:
a      (one-sided) alpha - needed in TOST / 90% CI (to obtain sample sizes for a 95% CI as needed for NTIDs by ANVISA, set a <- 0.025)
theta1 lower acceptance limit, where theta2=1/theta1
target set of target powers; if you want to get additionally e.g., 70% power, use: assign("target",c(0.7,0.8,0.9))
CV     set of CVs; each value gives one line of output
limit  upper limit of sample size; useful if set to a number lower than 500 to get the power obtained with a maximum feasible sample size

[1] D Hauschke, VW Steinijans and I Pigeot
    Bioequivalence Studies in Drug Development: Methods and Applications
    Wiley, New York, pp 118 (2007)
[3] D Dubins
    FARTSSIE v1.4
    Toronto, Ontario, Canada (2008)
    download link

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
23,424 posts in 4,927 threads, 1,671 registered users;
175 visitors (0 registered, 175 guests [including 6 identified bots]).
Forum time: 21:44 CEST (Europe/Vienna)

Young man, in mathematics you don’t understand things.
You just get used to them.    John von Neumann

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