Nitpicker! [Two-Stage / GS Designs]

posted by ElMaestro  – Belgium?, 2017-08-22 17:59 (1076 d 20:06 ago) – Posting: # 17735
Views: 24,061

Hi again,

» (...) I don’t get the point of initializing a large vector of values and later picking out the suitable one.

The secant method is terrible if the initial guess is wrong. Terrible as in, converges to plus/minus infinity and will give errors, so it isn't a matter of many iterations.
What the code above does: The n'th CV is probably going to be not so far from the (n-1)'th CV, and therefore it is a good guess. Therefore, if we only guess one CV reasonably (the 6th) then we get the corresponding 6'th critical CV, and from that point and onwards we can use the previously generated critical CV as the guess, i.e. when we want the 7'th value we use the 6th value as a guess, and so on. That's how these lines seem to work very fast.

You can also play around with regula falsi or whatever the heck Wikipedia calls it:

FindCritCV.rf=function(Pwr.T, GMR, Nps, Is.St2=1, toler=0.000001)

  while (abs(CV1-CV2)>toler)
   p1=Power.calc(Nps, GMR, CV1, Is.St2)-Pwr.T
   p2=Power.calc(Nps, GMR, CV2, Is.St2)-Pwr.T


   ##cat("Noi=", Noi, "\n")
   tmp=Power.calc(Nps, GMR, CV3, Is.St2) -Pwr.T
   if (tmp<0) CV2=CV3
      else    CV1=CV3
   cat("CV1=", CV1, "CV2=", CV2, "dCV=", abs(CV2-CV1), "\n")
  ##cat("Iterations RF:", Iter,"\n")
  return(0.5*(CV2+CV1) )

It is a little faster than bisection and does not require a good guess apart from the above. It is stable for power here since the power does not misbehave within any CV-interval of interest; there are no minima or maxima or things that can screw it badly up :-)

I could be wrong, but...

Best regards,

"Pass or fail" (D. Potvin et al., 2008)

Complete thread:

 Admin contact
20,962 posts in 4,373 threads, 1,459 registered users;
online 12 (0 registered, 12 guests [including 4 identified bots]).
Forum time: Monday 14:05 CEST (Europe/Vienna)

Garbage in, garbage out.
It’s very very simple.    Anders Fuglsang

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