Skip to content
Prev 132111 / 398506 Next

convergence error code in mixed effects models

Thank you for sending the data.  It is very helpful in understanding
the nature of the problem.

For example, in your original description of your study you referred
to week as a factor, which is a completely reasonable term, but I
mistakenly thought that you meant an object of class "factor" and that
was why I replied that you would be estimating too many variances and
covariances.

I can tell you why you are having problems fitting a mixed-effects
model.  Strangely it is because there is too little variability in the
patterns across the replicates, especially at the early times.  The
leaf number is discrete with a small range (all the leaffra
observations in this example are 4, 5, 6, 7 or 8) and non-decreasing
over time.  (I assume the nature of the experiment is such that the
leaf number is necessarily non-decreasing.)  That doesn't allow for
many patterns.  I'm sure some clever person reading this will be able
to tell us exactly how many different such patterns you could get but
I will simply say "not many".

Notice that the first 10 lines show that the leaffra is 4 at week 4 in
*every* replicate.  There isn't a whole lot of variation here for the
random effects to model.

The best place to start is with a plot of the data.  I changed the
levels of the rep factor to "f1"-"f5" and "s1"-"s5" to indicate that
each rep is at one level of the treat. (Those who are playing along at
home should be careful of the ordering of the original levels because
ID10, which I now call s5, occurs between ID1 and ID2.)

With this set of labels the cross-tabulation and treat should be
treat
rep  pHf pHs
  f1   4   0
  f2   4   0
  f3   4   0
  f4   4   0
  f5   4   0
  s1   0   4
  s2   0   4
  s3   0   4
  s4   0   4
  s5   0   4

Now look at lattice plots such as

library(lattice)
xyplot(heightfra ~ week | rep, leaf, type = c("g", "p", "r"), layout =
c(5,2), aspect = 'xy', groups = treat)

(I enclose PDF files of these plots for each of the three responses.)
First you can see that there is very little variation at the low end.
Strangely enough, this causes a problem in fitting mixed-effects
models because the mle's of the variances of  the random effects for
the intercept will be zero.  The lme function does not handle this
gracefully.  The lmer function from the lme4 package does a better job
on this type of model.

Also, note that the pattern of heightfra over time is not linear.  It
is consistently concave down.  Thuso a mixed-effects model that is
linear in week will miss much of the structure in the data.

The point of R is to encourage you to explore your data rather than
subjecting it to a "canned" analysis.  You could try fitting a
mixed-effects model to these data in SAS PROC MIXED or SPSS MIXED and
I have no doubt that those packages would give you estimates (not to
mention p-values, something that the author of lmer has been woefully
negligent in not providing :-) but you probably won't get much of a
hint that the model doesn't make sense.  I would prefer to start with
the plot and see what the data have to say.


The technical problem with convergence in lme is that the mle of the
variance of the intercept term is zero.  You can see that if you use
lmer from the lme4 package instead to fit the model.
the random effect for the intercept is estimate
On Dec 14, 2007 4:40 AM, Ilona Leyer <ileyer at yahoo.de> wrote:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hf.pdf
Type: application/pdf
Size: 22554 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071214/e8cff557/attachment.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lf.pdf
Type: application/pdf
Size: 23715 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071214/e8cff557/attachment-0001.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lv.pdf
Type: application/pdf
Size: 23776 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071214/e8cff557/attachment-0002.pdf