Initial sample size guess for the Potvin methods [Two-Stage / GS Designs]

posted by ElMaestro  – Belgium?, 2017-08-19 16:14  – Posting: # 17711
Views: 23,545

(edited by ElMaestro on 2017-08-19 17:14)

Hi Hötzi,

» Error in Power.calc(nps1, GMR, CV, Is.St2 = 1) :
»   could not find function "Power.calc"
» Did I specify the arguments wrongly?

That's why I included the remark:
##equation in Potvin et al.
I thought you'd be plugging in your own, but be that as it may.


An implementation of the function is here:

alpha1=0.0294
alpha2=0.05
vecQT1=c(1:5000)
vecQT2=c(1:5000)
for (i in 1:5000)
   {
    vecQT1[i]=qt(p=1-alpha1, df=i)
    vecQT2[i]=qt(p=1-alpha2, df=i)
   }



Power.calc=function(Nps, GMR, CV, Is.St2=0)
{
  s=sqrt(log(1+CV*CV))
  nom1=log(1.25/GMR)
  nom2=-log(1.25*GMR)
  den=s*sqrt(2/(2*Nps))
  df=Nps*2-2
  if (Is.St2==T) df=df-1
  ##cat("1-a=", 1-alpha, "df=",df,"\n")
  if (Is.St2==0) q=vecQT1[df]
    else         q=vecQT2[df]
  pw=pt( (nom1/den) -q, df) - pt( (nom2/den) +q, df)
  if (pw<0) pw=0.01
  return(pw)

}



Edit: Forgot to write: For classical B the alphas are (0.0294, 0.0294) and for C they are (0.05, 0.0294) though that isn't related to the topic. Second, Hötzi, you gave a little table which I am not very sure how to read. Note this isn't about the sample size calculation itself, this is about the initial guess used for the sample size calculation by up/down iteration.

I could be wrong, but...
Best regards,
ElMaestro

Complete thread:

Activity
 Admin contact
20,138 posts in 4,246 threads, 1,387 registered users;
online 4 (0 registered, 4 guests [including 3 identified bots]).
Forum time (Europe/Vienna): 23:54 CET

The fundamental cause of trouble in the world today is
that the stupid are cocksure
while the intelligent are full of doubt.    Bertrand Russell

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