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

Hi all,

just wanted to share a little algo for the initial sample size guess for the Potvin methods.
This is an area where speed gains are possible. A good initial sample size guess can eliminate quite some computation time. As I never got Zhang's method I played a little around with an entirely empirical idea.

My idea is that at least the upper part of a curve of power as function of sample size can be modeled as a kind of sigmoid function. I googled around to find a few expressions for such curves. The logistic function is one such. We can write the approximation something like:
Power=1/(1+exp(-k(N-x0))) 
where N is the sample size.

If we have two estimates of power p1, p2 at sample sizes nps1 and nps2 (I use number of subjects per sequence, abbreviated as nps), then we can determine the constants:
 a2=log(1/p2 - 1) a1=log(1/p1 - 1) x0=(a2*nps1-a1*nps2)/(a2-a1) k=a1/(x0-nps1) 

We can then solve for the desired power Pwr.T:
nps= x0+ (log(1/Pwr.T -1) / (-k))
- and this should of course converted to integer.

It turns out in my application to work really, really well.
The "only" issue is if the initial nps1 and nps2 are chosen poorly; p1 needs to be "not too close" to zero and p2 needs to be "not too close" to 1. But that's it.
My current implementation is this:

GetStartNps.X3=function(GMR, CV, Pwr.T) {   nps1=6   p1=Power.calc(nps1, GMR, CV, Is.St2=1)  ##equation in Potvin et al.   for (i in 1:3)    if (p1<0.1) { nps1=4*nps1;p1=Power.calc(nps1, GMR, CV, Is.St2=1);}   nps2=20*nps1   p2=Power.calc(nps2, GMR, CV, Is.St2=1)   f=2.4   while(p2>0.99) { nps2=floor(nps2/f);p2=Power.calc(nps2, GMR, CV, Is.St2=1);}   a2=log(1/p2 - 1)   a1=log(1/p1 - 1)   x0=(a2*nps1-a1*nps2)/(a2-a1)   k=a1/(x0-nps1)   Nps=floor(    x0+ (log(1/Pwr.T -1) / (-k))     )   if (Nps<6) Nps=6   return(Nps) }

Works well for me for assumed GMR's close to 1 (such as 0.95) and I am sure if anyone cares to fiddle with it it can be improved much, much further to work well in "all" scenarios. Play around with the constants in red to get the optimization that works for you.

Pass or fail!
ElMaestro