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

posted by ElMaestro  – Denmark, 2017-08-19 20:04 (1256 d 12:53 ago) – Posting: # 17716
Views: 25,177


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:
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

Pass or fail!

Complete thread:

 Admin contact
21,316 posts in 4,446 threads, 1,489 registered users;
online 4 (0 registered, 4 guests [including 3 identified bots]).
Forum time: Wednesday 07:57 CET (Europe/Vienna)

Nothing fails like success because you do not learn anything from it.
The only thing we ever learn from is failure.
Success only confirms our superstitions.    Kenneth E. Boulding

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