## Nitpicker! [Two-Stage / GS Designs]

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) {   CV1=0.0123   CV2=8.7654   Iter=0   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    Iter=Iter+1    CV3=CV2-p2*((CV2-CV1)/(p2-p1))    ##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,
ElMaestro

No, of course you do not need to audit your CRO if it was inspected in 1968 by the agency of Crabongostan. Ing. Helmut Schütz
{"ft_lang_label":"__label__en","ft_lang_prob":0.7737966,"math_prob":0.92053145,"size":5647,"snap":"2020-45-2020-50","text_gpt3_token_len":1878,"char_repetition_ratio":0.1920964,"word_repetition_ratio":0.66888887,"special_character_ratio":0.3548787,"punctuation_ratio":0.14052288,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9866145,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-24T17:49:49Z\",\"WARC-Record-ID\":\"<urn:uuid:40e3f20c-1b8d-4fc5-97db-2acbb8192755>\",\"Content-Length\":\"24556\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a161a044-2909-4f34-8e85-bec2c99a6b97>\",\"WARC-Concurrent-To\":\"<urn:uuid:36595940-7013-4747-a382-0d6767d169c9>\",\"WARC-IP-Address\":\"172.67.142.160\",\"WARC-Target-URI\":\"https://forum.bebac.at/forum_entry.php?id=17735&category=22&order=time\",\"WARC-Payload-Digest\":\"sha1:KSNEPIZGTAWNUV2EQ7QZSC6B7R2CZW6F\",\"WARC-Block-Digest\":\"sha1:OEUMQHYBCLEH7CQJA75HG2TQ56ZRWD4E\",\"WARC-Identified-Payload-Type\":\"text/x-php\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141176922.14_warc_CC-MAIN-20201124170142-20201124200142-00693.warc.gz\"}"}