The n ext crackpot iteration [Two-Stage / GS Designs]

posted by ElMaestro  – Belgium?, 2017-08-19 20:04  – Posting: # 17716
Views: 24,472

Further:

When we initiate a Potvin run the assumed GMR = 0.95 or whatever is known at the time the iterations are started, they do not change as we go. Same for Target power.

Note this:
CV=c(100:1000)/1000
N=rep(0, length(CV))
for (i in 1:length(N))
 
N[i]=GetNps(0.95, CV[i], 0.8) ##Yes, Hötzi, plug in your own function here
plot (CV, N)


Aha, within some reason the necessary number of subjects per sequence (given the GMR and the target power) varies in a simply manner with CV, perhaps this is well modeled with a polynomial?

M=lm(N~poly(CV, 4, raw=TRUE))
points(CV, fitted(M), col="red")


Oh how wonderful!! The polynomial provides a fantastic approximation within our entire interval of interest.
Let us create an approximating the function:

GuessNps=function(CV, GMR, T.Pwr)
{
   if ((GMR==0.95) && (T.Pwr==0.8))
    Rslt = 6 -43.3322*CV + 363.4835*CV*CV -238.5417 *CV*CV*CV+ 62.7520*CV*CV*CV*CV
   ##get your coefficient from summary(M) or coef(M)
 
   ##note: We might not want to write blah^3 etc if we optimize for speed, not sure.
   ##fill in the other GMR, T.Pwr scenarios here  :-):-):-)
   return(round(Rslt,0)) ## perhaps ceil would be better?
}


And this one is really really fast! The initial guess may be as accurate as Zhang (haven't checked because I don't speak Zhango), but it does not rely on pnorm, qnorm, pt or qt and there is no division, sqrt, exp or ln. Therefore this is blazing fast.

All it takes is a split second of numerical gymnastics before a Potvin run (and you do not need c(100:1000)/1000 - we can even do c(10:100)/100 and get the same quality of estimate, cheaper.

Actually we might even completely abolish sample size iteration altogether because:
for (i in 1:length(N))
  cat("i=",i, "Diff=", GetNps(0.95,CV[i],0.8) - GuessNps(CV[i], 0.95, 0.8),"\n")


You see, the sample size estimates are sort of almost perfect already. If you want to remove the very few 1's and -1's then just increase the polynomial degree above.

The implementation of Potvin et al. is hereby sped up by a factor 10 gazillion :-D:-D:-D:-D:-D

I could be wrong, but...

Best regards,
ElMaestro

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

Complete thread:

Activity
 Admin contact
20,778 posts in 4,351 threads, 1,444 registered users;
online 22 (0 registered, 22 guests [including 12 identified bots]).
Forum time: 10:07 CEST (Europe/Vienna)

All we know about the world teaches us that the effects of A and B
are always different—in some decimal place—for any A and B.
Thus asking “are the effects different?” is foolish.    John W. Tukey

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