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

posted by ElMaestro  – Denmark, 2017-08-19 22:04 (2413 d 00:53 ago) – Posting: # 17716
Views: 27,655

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

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,636 registered users;
75 visitors (0 registered, 75 guests [including 10 identified bots]).
Forum time: 21:57 CET (Europe/Vienna)

Nothing shows a lack of mathematical education more
than an overly precise calculation.    Carl Friedrich Gauß

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