[R] lme convergence failure within a loop
Daniel Malter
daniel at umd.edu
Thu Jun 23 05:21:41 CEST 2011
I am not an expert in this. But try try() :)
hth,
Daniel
Sam Nicol wrote:
>
> Hi R-users,
>
> I'm attempting to fit a number of mixed models, all with the same
> structure, across a spatial grid with data points collected at various
> time points within each grid cell. I'm trying to use a 'for' loop to try
> the model fit on each grid cell. In some cells lme does not converge,
> giving me the error:
>
> Error message: In lme.formula(logarea ~ year + summ_d, data = grid2,
> random = ~year + :
> nlminb problem, convergence error code = 1
> message = iteration limit reached without convergence (9)
>
> When I get the error, the program aborts, and my loop stops.
>
> I'm not too worried about the error, as a generic mixed model structure
> may not be the best fit for every cell. I expect the optimization to
> fail in some places. I want to be able to detect when the algorithm has
> failed to converge automatically, so that I can continue my loop and
> record the places where the model does fit. I've used the lmeControl
> method with returnObject=TRUE options to allow me to continue looping,
> however I want to be able to flag the places where the convergence
> failed so that I can reject these gridcells and not mistakenly claim
> that the model fits at these points. Is there a way to do this?
>
> My example code shows the relevant lines of code-- what I'm hoping for
> is a way to determine that the convergence failed and record this as a
> boolean value, or something similar.
>
> Thanks,
>
> Sam Nicol
>
>
>
> ______________________________________________
> 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.
>
--
View this message in context: http://r.789695.n4.nabble.com/lme-convergence-failure-within-a-loop-tp3618778p3618902.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list