On Thu, 31 Jan 2008, Rob Forsyth wrote:
> 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?
If it 'hangs' you don't have an error to trap. If you want to
convert a
warning to an error, use options(warn=2) or set a warning handler (see
?conditions).
> Thanks
>
> Rob Forsyth
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595