no convergence using lme

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

no convergence using lme

Margaret Gardiner-Garden
Hi.  I was wondering if anyone might have some suggestions about how I can
overcome a problem of   "iteration limit reached without convergence" when
fitting a mixed effects model.

 

In this study:

Outcome is a measure of heart action

Age is continuous (in weeks)

Gender is Male or Female (0 or 1)

Genotype is Wild type or knockout (0 or 1)

Animal is the Animal ID as a factor

Gender.Age is Gender*Age

Genotype.Age is Genotype*Age

Gender.Genotype.Age is Gender*Genotype*Age

 

If I have the intercept (but not the slope) as a random effect the fit
converges OK

fit1 <- lme(Outcome~Age + Gender + Genotype  + Gender.Age + Genotype.Age +
Gender.Genotype.Age,

                  random=~1|Animal, data=VC)

 

 

If I have the slope (but not the intercept) as a random factor it converges
OK

fit2 <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age
+Gender.Genotype.Age,

                  random=~Age-1|Animal, data=VC)

 

 

If I have both slope and intercept as random factors it won't converge

fit3 <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age +
Gender.Genotype.Age,

                  random=~ Age|Animal, data=VC)

Gives error:

Error in lme.formula(LVDD ~ Age + Gender + Genotype + Gender.Age +
Genotype.Age +  :

      iteration limit reached without convergence (9)

 

 

 

If I try to increase the number of iterations (even to 1000) by increasing
maxIter it still doesn't converge

 

fit <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age +
Gender.Genotype.Age,

+                   random=~ Age|Animal, data=VC, control=list(maxIter=1000,
msMaxIter=1000, niterEM=1000))

 

NB.  I changed maxIter  value in isolation as well as together with two
other controls with "iter" in their name (as shown above) just to be sure (
as I don't understand how the actual iterative  fitting of the model works
mathematically)  



 

I was wondering if anyone knew if there was anything else in the control
values I should try changing.  

Below are the defaults..

lmeControl

function (maxIter = 50, msMaxIter = 50, tolerance = 1e-06, niterEM = 25,

    msTol = 1e-07, msScale = lmeScale, msVerbose = FALSE, returnObject =
FALSE,

   gradHess = TRUE, apVar = TRUE, .relStep = (.Machine$double.eps)^(1/3),

   minAbsParApVar = 0.05, nlmStepMax = 100, optimMethod = "BFGS",

    natural = TRUE)

 

I was reading on the R listserve that lmer from the lme4 package may be
preferable to lme (for convergence problems) but lmer seems to need you to
put in starting values and I'm not sure how to go about chosing them.  I was
wondering if anyone had experience with lmer that might help me with this?

 

Thanks again for any advice you can provide.

 

Regards

Marg

 

 

Dr Margaret Gardiner-Garden

Garvan Institute of Medical Research

384 Victoria Street

Darlinghurst Sydney

NSW 2010 Australia

 

Phone: 61 2 9295 8348

Fax: 61 2 9295 8321

 

 


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: no convergence using lme

Spencer Graves
          Without a simple, self-contained, reproducible example, it is
impossible to say for sure why "lme" did not converge for you.  However,
if age were constant within animal, that would surely give the symptom
you describe.  I might try computing the difference in the range within
subject, something like the following:

### NOT TESTED:
tapply(VC$Age, VC$animal, function(x)diff(range(x)))

          If these numbers are all 0, that should answer your question.  If
not, one must dig deeper.  For example, do you get the same error with
Outcome~1, etc.?

          hope this helps.
          spencer graves

Margaret Gardiner-Garden wrote:

> Hi.  I was wondering if anyone might have some suggestions about how I can
> overcome a problem of   "iteration limit reached without convergence" when
> fitting a mixed effects model.
>
>  
>
> In this study:
>
> Outcome is a measure of heart action
>
> Age is continuous (in weeks)
>
> Gender is Male or Female (0 or 1)
>
> Genotype is Wild type or knockout (0 or 1)
>
> Animal is the Animal ID as a factor
>
> Gender.Age is Gender*Age
>
> Genotype.Age is Genotype*Age
>
> Gender.Genotype.Age is Gender*Genotype*Age
>
>  
>
> If I have the intercept (but not the slope) as a random effect the fit
> converges OK
>
> fit1 <- lme(Outcome~Age + Gender + Genotype  + Gender.Age + Genotype.Age +
> Gender.Genotype.Age,
>
>                   random=~1|Animal, data=VC)
>
>  
>
>  
>
> If I have the slope (but not the intercept) as a random factor it converges
> OK
>
> fit2 <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age
> +Gender.Genotype.Age,
>
>                   random=~Age-1|Animal, data=VC)
>
>  
>
>  
>
> If I have both slope and intercept as random factors it won't converge
>
> fit3 <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age +
> Gender.Genotype.Age,
>
>                   random=~ Age|Animal, data=VC)
>
> Gives error:
>
> Error in lme.formula(LVDD ~ Age + Gender + Genotype + Gender.Age +
> Genotype.Age +  :
>
>       iteration limit reached without convergence (9)
>
>  
>
>  
>
>  
>
> If I try to increase the number of iterations (even to 1000) by increasing
> maxIter it still doesn't converge
>
>  
>
> fit <- lme(LVDD~Age + Gender + Genotype + Gender.Age + Genotype.Age +
> Gender.Genotype.Age,
>
> +                   random=~ Age|Animal, data=VC, control=list(maxIter=1000,
> msMaxIter=1000, niterEM=1000))
>
>  
>
> NB.  I changed maxIter  value in isolation as well as together with two
> other controls with "iter" in their name (as shown above) just to be sure (
> as I don't understand how the actual iterative  fitting of the model works
> mathematically)  
>
>
>
>  
>
> I was wondering if anyone knew if there was anything else in the control
> values I should try changing.  
>
> Below are the defaults..
>
> lmeControl
>
> function (maxIter = 50, msMaxIter = 50, tolerance = 1e-06, niterEM = 25,
>
>     msTol = 1e-07, msScale = lmeScale, msVerbose = FALSE, returnObject =
> FALSE,
>
>    gradHess = TRUE, apVar = TRUE, .relStep = (.Machine$double.eps)^(1/3),
>
>    minAbsParApVar = 0.05, nlmStepMax = 100, optimMethod = "BFGS",
>
>     natural = TRUE)
>
>  
>
> I was reading on the R listserve that lmer from the lme4 package may be
> preferable to lme (for convergence problems) but lmer seems to need you to
> put in starting values and I'm not sure how to go about chosing them.  I was
> wondering if anyone had experience with lmer that might help me with this?
>
>  
>
> Thanks again for any advice you can provide.
>
>  
>
> Regards
>
> Marg
>
>  
>
>  
>
> Dr Margaret Gardiner-Garden
>
> Garvan Institute of Medical Research
>
> 384 Victoria Street
>
> Darlinghurst Sydney
>
> NSW 2010 Australia
>
>  
>
> Phone: 61 2 9295 8348
>
> Fax: 61 2 9295 8321
>
>  
>
>  
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html