Dear all,
I'm trying to fit a model on ecological data in which I have measured a few
biotic and abiotic factors over the course of a few days in several
individuals. Specifically, I'm interested in modelling y ~ x1, with x2, x3,
and 'factor' as independent variables. Because data suggests both slope
and
intercept (for y ~x1) might differ between individuals, I'd want to compare
model fit for a saturated model with random intercept only, against that of
a model with random slope + intercept. Data are available in full from this
link:
https://www.dropbox.com/s/mzk8utvgkzp4rtr/data.txt
The random intercept model seems to function appropriately:
data<-subset(data,data$id!='id225' & data$id!='id237'
& data$id!='id233')
m1.lme<-with(data,lme(y~x1+x2+x3+factor,random=~1|id,na.action=na.omit))
However, fitting the random slope+intercept model produces an error message
I can't quite make sense of.
m2.lme<-with(data,lme(y~x1+x2+x3+factor,random=~1+y|id,na.action=na.omit))
#Error in chol.default((value + t(value))/2) :
# the leading minor of order 2 is not positive definite
I also tried fitting the same model with a diagonal covariance structure,
which resulted in convergence failure.
m3.lme<-with(data,lme(y~x1+x2+x3+factor,random=reStruct(object=~1+y|id,pdClass="pdDiag"),na.action=na.omit))
#Error in lme.formula(y ~ x1 + x2 + x3, random = reStruct(object = ~y | :
#nlminb problem, convergence error code = 1
#message = false convergence (8)
However, changing lmeControl gets this model to run, but I can't make sense
of the estimates for fixed effects, suggesting the model might be biased.
In addition, I'm not sure how changing lmeControl changes model
interpretation. Perhaps someone could fill me in on this?
m4.lme<-with(data,lme(y~x1+x2+x3+factor,random=reStruct(object=~y|id,pdClass="pdDiag"),na.action=na.omit,
control=lmeControl(opt = "optim")))
Any hints on how to proceed from this would be greatly appreciated.
Best, and thanks,
Andreas
--
View this message in context:
http://r.789695.n4.nabble.com/Problems-with-lme-random-slope-intercept-model-tp4679104.html
Sent from the R help mailing list archive at Nabble.com.