[R] Wide confidence intervals or Error message in a mixed effects model (nlme)

Dieter Menne dieter.menne at menne-biomed.de
Mon Jul 25 16:42:58 CEST 2011


Menelaos Stavrinides-2 wrote:
> 
> I am analyzing a dataset on the effects of six pesticides on population
> growth rate of a predatory mite. The response variable is the population
> growth rate of the mite (ranges from negative to positive) and the
> exploratory variable is a categorical variable (treatment). The
> experiment was blocked in time (3 blocks / replicates per block) and it
> is unbalanced - at least 1 replicate per block. I am analyzing the data
> in nlme using model<-lme(growth.rate~treatment,random=~1|block). 
> 
> 
> In another study, I am investigating the interactions between pesticides
> in a two-way design: (pesticideA x no pesticide A) crossed with
> (pesticideB x no pesticide B). The blocking is as above, and the data
> are unbalanced again. The model is defined as
> model<-lme(growth.rate~pestA*pestB,random=~1|block). When I run
> intervals (model), I usually get the following error message: "Error in
> intervals.lme(model) : Cannot get confidence intervals on var-cov
> components: Non-positive definite approximate variance-covariance". 
> 
> 

It depends on your data which you did not show. At least show str() or
summary(), it could also be a forgotten factor(). With simulated data, it is
quite easy to get reasonable-looking cases where var-cov is degenerate.

Dieter

library(nlme)
set.seed(47)
d = expand.grid(block=LETTERS[1:3],treatment=letters[1:6])
d$growth.rate = as.integer(d$treatment)*0.2+rnorm(nrow(d))
#d.lme = lme(growth.rate~treatment, random=~1|block,data=d)

for (i in 1:100){
  d1= d[sample(nrow(d) ,nrow(d)-3)  ,]
  d.lme = lme(growth.rate~treatment, random=~1|block,data=d1)
  iv = try(intervals(d.lme), TRUE)
  if (inherits(iv, "try-error")){
    print(iv)
    print(table(d1[,c("block","treatment")]))
  }
}






--
View this message in context: http://r.789695.n4.nabble.com/Wide-confidence-intervals-or-Error-message-in-a-mixed-effects-model-nlme-tp3692637p3692986.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list