[R] Error handling in nlme call

Rob Forsyth r.j.forsyth at newcastle.ac.uk
Thu Jan 31 10:51:48 CET 2008


In some trial simulation work I need to create batch files that will  
repeatedly generate pseudoreplicate datasets and then create non- 
linear mixed effects models using nlme. Inevitably these models  
sometimes fail to converge but I need the batch file to simply move on  
to another simulation rather than abort. I am using the try() function  
as in

model<-try((nlme(...)))

which handles reported errors such as the "Step halving in PNLS step"  
error well. On rare runs however the nlme function hangs without an  
error message. Aborting the script prompts a notification of multiple  
warnings and warnings() gives multiple recurrences of "Singular  
precision matrix in level -1, block 1". I understand why these occur  
but would like to trap these events too and simply move on to the next  
simulation. The try() function doesn't work presumably as no actual  
error message is reported during the run. Is there a way to test for  
this condition?

Thanks

Rob Forsyth



More information about the R-help mailing list