[R] linear mixed model question

Wen Huang whuang.ustc at gmail.com
Sun Sep 6 17:49:03 CEST 2009


Hello,

I wanted to fit a linear mixed model to a data that is similar in  
terms of design to the 'Machines' data in 'nlme' package except that  
each worker (with triplicates) only operates one machine. I created a  
subset of observations from 'Machines' data such that it looks the  
same as the data I wanted to fit the model with (see code below).

I fitted a model in which 'Machine' was a fixed effect and 'Worker'  
was random (intercept), which ran perfectly. Then I decided to  
complicate the model a little bit by fitting 'Worker' within  
'Machine', which was saying variation among workers was nested within  
each machine. The model could be fitted by 'lme', but when I tried to  
get
confidence intervals by 'intervals(fm2)' it gave me an error:

Error in intervals.lme(fm2) :
   Cannot get confidence intervals on var-cov components: Non-positive  
definite approximate variance-covariance

I am wondering if this is because it is impossible to fit a model like  
'fm2' or there is some other reasons?

Thanks a lot!

Wen

#################

library(nlme)
data(Machines)
new.data = Machines[c(1:6, 25:30, 49:54), ]
fm1 = lme(score ~ Machine, random = ~1|Worker, data = new.data)
fm1
fm2 = lme(score ~ Machine, random = ~Machine-1|Worker, data = new.data)
fm2
intervals(fm2)




More information about the R-help mailing list