[R] nlrob problem

Pascal.Niklaus pascal.niklaus at ieu.uzh.ch
Fri Dec 23 16:41:02 CET 2011

Please ignore my previous posting, in the meanwhile I have realised that I
did not look carefully enough how nlrob works (irls), although this is
pretty obvious from the code.

The only issue that remains is the case of zero weight for redescending M
estimators, in which case NaN's are produced. I think it would be better if
one could avoid the NaN's produced by dividing by zero when psi becomes

Something along the line of replacing 

           resid <- -residuals(out)/sqrt(w)


           resid <- ifelse(w>0,-residuals(out)/sqrt(w),0);

There probably is a more elegant way to do this. 

This would avoid that one has to use na.action=na.exclude for cases where
there are no NAs in the data set originally passed to nlrob (and the NAs
only occur 'internally' in the code of nlrob).

Hope I haven't missed something else this time...

Pascal Niklaus

View this message in context: http://r.789695.n4.nabble.com/nlrob-problem-tp4215473p4229016.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list