See

?try
?tryCatch

FAQ 7.32

This is not a Windows/UNIX difference as you suppose, but an 
interactive/batch difference.  You could also look into using 
options(error=).

On Sun, 15 Oct 2006, Toby Gardner wrote:

> Dear R-users,
>
> I have a frustrating problem that I am hoping has a simple fix.  I am 
> running a series of lmer models from the lme4 package of the general 
> form:
>
> model<-lmer(y~x1 + x2 ..... + xn + 
> (1|site),data=dataframe,family=poisson,method="Laplace",control=list(usePQL=FALSE,msVerbose=TRUE))
>
> where the same model is executed multiple times on a bootstrapped 
> dataframe.  For each bootstrapped model run the resulting model object 
> is used to return the AIC (and models are then compared using a 
> bootstrapped weight - frequency of runs a given model had the lowest 
> AIC).
>
> This works just fine when running interactively on my windows machine 
> (so there is nothing the matter with the code, hence I have not bored 
> you with the details here).... however when I submit the job as a batch 
> to a UNIX system it usually (but not always) fails and the execution is 
> halted after an error message is produced:
>
> Error in objective (.par,...): Leading minor of order 1 in downdated X'X is 
> not positive definite
> In addition: There were 12 warnings (use warnings() to see them)
> Error in logLik(model) : no applicable method for "logLik"
> Execution halted
>
> On windows when the execution of a single model run fails to estimate 
> the logLik (an unstable model...) R just continues past the error and 
> still runs to the end of the script (i.e. runs through all the 
> bootstraps), and I can then inspect the output and any errors at the 
> end.
>
> My question, then is when using UNIX on batch mode, how can I get the 
> job to NOT halt it's execution on the production of an unstable model 
> (not positive definite) and continue running? If the models are not 
> bootstrapped then the script is executed without any problem in UNIX (so 
> the script is successfuly submitted as a batch job), so it seems that 
> some of the bootstrap runs are producing unstable models in rare 
> instances, but just one is sufficient to halt the execution of the 
> script.
>
> I am running R.2.3.1 on both Windows and UNIX,
>
> Many thanks in advance,
>
> Toby Gardner
>
> School of Environmental Sciences
> University of East Anglia
> Norwich, NR4 7TJ
> United Kingdom
> Email: [EMAIL PROTECTED]
> Website: www.uea.ac.uk/~e387495
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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,                  [EMAIL PROTECTED]
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

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to