I'm fitting a non-linear model to a large number (1000s) of data curves. I expect that the model cannot be fit to some of the curves, so when going through the data set I'd like to ignore those few cases for which nls returns an error and continue. The basic nls function provides a way to do this with the warnOnly=TRUE parameter which is passed by using nls.control. I also wanted to try the nlsLM function from the minpack.lm package. It seems, however, that even though the argument list for nlsLM is the same as that for nls, the warnOnly= parameter isn't available. Is there some other way of avoiding termination when nlsLM encounters an error? Thanks.
Asked
Active
Viewed 319 times
0
-
`nlsList` from the `nlme` package has similar functionality, and it does not stop on errors – Marat Talipov Feb 11 '15 at 20:27
-
Thanks, Marat. I'll have a look. – Fleetboat Feb 12 '15 at 22:02
1 Answers
0
After searching around on 'error' and 'message', it seems that one way to address this type of problem simply is by using try(). I enclosed the statement in the try wrapper and the code runs through the entire data set without terminating on an error.

Fleetboat
- 189
- 7