[R] optim function

R Granell, Medicine Raquel.Granell at bristol.ac.uk
Thu May 11 12:18:06 CEST 2006


Hello,

I want to use optim with simulated data.
My program generates a sample and then calls optim to optimise a function 
that depends on the generated sample.

I want to do this with 100 samples. But optim does not 'work' for the 100 
samples, sometimes I get a message saying that sigma matrix was not 
invertible and therefore the optimisation was not carried out, and then my 
program breaks.

Is there any way to implement a condition to avoid this? I mean, how can I 
specify that if this is the case, ignore such sample and try with the next 
one.

Many thanks for your help

Raquel




More information about the R-help mailing list