Dear all,
I am working on a data set in which I have sequentially measured egg
temperatures ("eggtemp") in birds incubating in different ambient
temperatures ("treat", sample data set below), "id" is not
replicated within
treatment.
id treat eggtemp
1 79 3 30.90166
2 42 3 34.94044
3 10 3 32.69945
4 206 3 36.64127
5 23 3 31.80055
6 5 3 29.98338
7 24 3 35.72992
8 45 3 30.49584
9 29 3 33.64958
10 78 3 31.37673
11 44 3 32.85873
12 368 3 34.44875
13 79 4 31.24100
14 42 4 34.11634
15 10 4 34.73407
16 206 4 36.20914
17 23 4 34.98061
18 5 4 34.17590
19 24 4 37.71468
20 45 4 35.34765
21 29 4 35.48892
22 78 4 33.26593
23 44 4 34.86981
24 368 4 34.44875
25 79 2 27.33241
26 42 2 30.73269
27 10 2 29.54986
28 206 2 31.78947
29 23 2 29.69114
30 24 2 36.48199
31 45 2 29.76454
32 29 2 30.56510
33 78 2 27.71468
For this data, I want to construct a model with a random intercept and slope
to compare with a model containing only the random intercept to check
whether or not different individuals respond differently to
treatment.> temp2.lme<-lme(eggtemp~treat,random=~treat|id,data=temp3.df)
However, I get the below error, which I suspect might be because individuals
are not replicated within treatments.
> nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (9)
If I specify treatment as a factor (which it really is not, just different
ambient temperatures), the model seems to converge. Similarly, the model
converges if I exclude one of the treatment levels. However, this does not
feel very satisfactorily.
So, how do I move on from here? Any tips and hints are much appreciated. I
have tried to include the random slope only, which also works, but the
inference for such a model would be quite different and not really what I am
after.> temp3.lme<-lme(eggtemp~treat,random=~treat-1|id,data=temp3.df)
Kind regards,
Andreas Nord
Lund University
Sweden
--
View this message in context:
http://n4.nabble.com/random-slope-models-with-lme-failured-to-converge-tp1469575p1469575.html
Sent from the R help mailing list archive at Nabble.com.
Luc Villandré
2010-Feb-05 16:16 UTC
[R] random slope models with lme --> failured to converge
Hi, I have been working with LMMs for a while now and convergence has proved to be a very common problem. Right now, your model has two random effect terms, that is, one for the intercept and one for the coefficient of the "treat" variable. This implies that the default variance-covariance matrix for the random effects has three parameters. Why don't you simply try imposing a diagonal variance-covariance structure on your random effects? In order to do this, have the "random" argument take value reStruct(object = ~ treat | id, pdClass="pdDiag") It's not exactly the same model that you wanted to fit initially, but if it converges, you probably won't regret the sacrifice (which probably won't be that considerable anyways)! As to why you don't get convergence in the first place, I unfortunately can't tell. I think the R-gurus are a lot more qualified than me to answer such questions! Cheers, -- *Luc Villandré* /Biostatistician MUHC-MCH Research Institute/ On 04/02/2010 6:42 PM, anord wrote:> Dear all, > > I am working on a data set in which I have sequentially measured egg > temperatures ("eggtemp") in birds incubating in different ambient > temperatures ("treat", sample data set below), "id" is not replicated within > treatment. > > id treat eggtemp > 1 79 3 30.90166 > 2 42 3 34.94044 > 3 10 3 32.69945 > 4 206 3 36.64127 > 5 23 3 31.80055 > 6 5 3 29.98338 > 7 24 3 35.72992 > 8 45 3 30.49584 > 9 29 3 33.64958 > 10 78 3 31.37673 > 11 44 3 32.85873 > 12 368 3 34.44875 > 13 79 4 31.24100 > 14 42 4 34.11634 > 15 10 4 34.73407 > 16 206 4 36.20914 > 17 23 4 34.98061 > 18 5 4 34.17590 > 19 24 4 37.71468 > 20 45 4 35.34765 > 21 29 4 35.48892 > 22 78 4 33.26593 > 23 44 4 34.86981 > 24 368 4 34.44875 > 25 79 2 27.33241 > 26 42 2 30.73269 > 27 10 2 29.54986 > 28 206 2 31.78947 > 29 23 2 29.69114 > 30 24 2 36.48199 > 31 45 2 29.76454 > 32 29 2 30.56510 > 33 78 2 27.71468 > > For this data, I want to construct a model with a random intercept and slope > to compare with a model containing only the random intercept to check > whether or not different individuals respond differently to treatment. > >> temp2.lme<-lme(eggtemp~treat,random=~treat|id,data=temp3.df) >> > However, I get the below error, which I suspect might be because individuals > are not replicated within treatments. > > nlminb problem, convergence error code = 1 > message = iteration limit reached without convergence (9) > > If I specify treatment as a factor (which it really is not, just different > ambient temperatures), the model seems to converge. Similarly, the model > converges if I exclude one of the treatment levels. However, this does not > feel very satisfactorily. > > So, how do I move on from here? Any tips and hints are much appreciated. I > have tried to include the random slope only, which also works, but the > inference for such a model would be quite different and not really what I am > after. > >> temp3.lme<-lme(eggtemp~treat,random=~treat-1|id,data=temp3.df) >> > Kind regards, > Andreas Nord > Lund University > Sweden > >[[alternative HTML version deleted]]