Skip to content

Error: "Cannot get confidence intervals...", with lme, what does it means?

4 messages · R.S. Cotter, Gang Chen, Dimitris Rizopoulos +1 more

#
Hello,

In some occasions I get this error message: "Cannot get confidence
intervals on var-cov components: Non-positive definite approximate
variance-covariance".

I have tried to figure out this by using help function, but didn't
find answer to the question. I address this question with describing
the model and the primary task that I want to solve. Sorry if the
question is clumsy formulated, I 'm not that experienced with R and
statistics.

My model is:
Response= Weight(continous)
Explanatory variables= Time (continous) and Diet (kategorical, two groups; B&C)

The primary question of interest is wheter the growth rates
(Weight/Time) differ among the two diets.

lmefit1<-lme(Weight ~ Diet*Time,random=~1|Place,data=Total)

Summary output is ok, so far so good. But I also wanted to get the
slope and confidence intervals for the growth rates for both diets
(B&C), so I ran intervals(). And I got the intercept, slope and
confidence intervals for diet B, see below.

But I also wanted the same for the diet C, to do this I renamed diet C
to A in the data sheet to force C to be the dummy variable. Is this
the right way to do it?

When running the intervals () once again, I got this message: "Cannot
get confidence intervals on var-cov components: Non-positive definite
approximate variance-covariance". What could be wrong..? Is there
other ways to get the slope and confidence intervals from a lme model?
Approximate 95% confidence intervals

 Fixed effects:
                          lower               est.                 upper
(Intercept)           66.040673     108.122242     150.203810
DietC                -175.080336   -109.638518     -44.196700
Time                     4.177387         5.434087       6.690788
DietC:Time          7.938101         11.180806     14.423511
attr(,"label")
[1] "Fixed effects:"

 Random Effects:
  Level: Place
                    lower     est.    upper
sd((Intercept)) 0.1478599 13.50651 1233.775

 Within-group standard error:
   lower     est.    upper
159.9128 174.8928 191.2761

Best regards Cotter
#
Cotter,

Check the following component
If you see something like this

   [1] "Non-positive definite approximate variance-covariance"

it most likely indicates you have an inappropriate model for the  
data. Try plotting out the data, and get some idea about the feasible  
models, and then fit the data with those models.

Cheers,
Gang
On Sep 2, 2008, at 8:29 AM, R.S. Cotter wrote:

            
#
check whether the following solves the problem:

Total$DietC <- relevel(Total$Diet, "C")

lmefit1 <- lme(Weight ~ Diet * Time, Total, random = ~ 1 | Place)
intervals(lmefit1)

lmefit2 <- lme(Weight ~ DietC * Time, Total, random = ~ 1 | Place)
intervals(lmefit2)


I hope it helps.

Best,
Dimtris
R.S. Cotter wrote:

  
    
2 days later
#
Hello!

Sorry to keep this going, but could you elaborate on the meaning of  
that output? I am asking this because I am trying to model my data  
set, and with the same model, I get that output if I use REML, but I  
get a normal output if I use ML - so I'm assuming it may be related to  
the model, but also in the estimating method. The intervals calculated  
using intervals() under the ML method are very similar to the ones I  
obtain when computing them by hand.

Under my limited knowledge, I believe I am using the most appropriate  
model for my data, even though it is definitely not a "good" one for  
the data (which is inherently unbalanced).

Commands follow, below. Many thanks for any help!

Best,
Rafael

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

 > m1<-update(m1, method="ML")

 > intervals(m1)
Approximate 95% confidence intervals

Fixed effects:
                     lower      est.      upper
(Intercept)      0.2268163  1.318894  2.4109708
factor(Status)2  0.7653039  1.812026  2.8587479
Ano             -1.7888219 -1.112453 -0.4360846
attr(,"label")
[1] "Fixed effects:"

Random Effects:
  Level: ind
                                         lower       est.       upper
sd((Intercept))                   1.692475e-02  0.9802002    56.76849
sd(factor(Status)2)               2.009503e-05  0.8586423 36689.01183
cor((Intercept),factor(Status)2) -1.000000e+00 -0.8485173     1.00000

Within-group standard error:
       lower         est.        upper
3.685400e-14 3.630675e-01 3.576762e+12
On 2 Sep 2008, at 11:09, Gang Chen wrote: