I have a nlsLM
inside a for loop
because I want to try different start values
to fit my data. I already know that some start values
generates this error
: singular gradient matrix at initial parameter estimates
, but I want to skip this error
and continue with the loop
, fitting the regression with the next start values
. I tried to put all the for loop
inside a try
and a tryCatch
block, setting silence=TRUE
, but the code still stopping when the singular gradient matrix at initial parameter estimates
error
occurs.
Someone can help me with that?
Here is the code:
try({
for (scp.loop in scp.matrix){
for (fit.rate in 1:10){
print(scp.loop)
print(fit.rate)
#fit model with nlsLM
#blah, blah, blah
}}
},silent=FALSE)