<div class="gmail_extra">this part will always make your code crawl along:<br><br><div class="gmail_quote">On Wed, Dec 5, 2012 at 11:09 AM, Honglang Wang <span dir="ltr"><<a href="mailto:wanghonglang2008@gmail.com" target="_blank">wanghonglang2008@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">  arma::vec betahat = arma::inv(Inv)*arma::trans(D)*W*y;<br></div><div class="im"></div></blockquote></div>

<div class="gmail_extra"><br></div>first time I wrote a GLM engine, I wrote it the way statistics books illustrate it (i.e. actually invert things to do IWLS) and it crawled.  I took it to a physicist friend who went through alternate stages of disgust and laughter then told me never to invert anything I didn't have to.  </div>

<div class="gmail_extra"><br></div><div class="gmail_extra">You should take Doug Bates' advice, it could save you a great deal of time.  Never bit fiddle when you can use a better algorithm.</div><div class="gmail_extra">

<br></div><div class="gmail_extra"><br>-- <br><i>A model is a lie that helps you see the truth.</i><div><i><br></i><div><a href="http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf" target="_blank">Howard Skipper</a></div>

</div><br>
</div>