[R] Cholmod error `matrix not positive definite'

Douglas Bates bates at stat.wisc.edu
Fri Feb 15 20:33:01 CET 2008


On Thu, Feb 14, 2008 at 3:14 PM, Douglas Bates <bates at stat.wisc.edu> wrote:
> Could you tell us which version of the lme4 package you are using?
>  You can just send the output produced by
>
>  sessionInfo()
>
>  If you can make your data available so we can test it then please do
>  so.  If the data set is large you could send it to me in private email
>  and I will make it available on a web site.
>
>  I think that the development version of the lme4 package, available via
>
>  install.packages("lme4", repos = "http://r-forge.r-project.org")
>
>  should be resistant to that type of error but I am willing to be shown
>  otherwise.

Thank you for sending your data in a separate message to me, Martjn.
One problem with your model is that the zone variable takes on only
two levels, "coast" and "inland".  It is very difficult to estimate a
variance due to zone, in addtion to a fixed effect for zone, when you
only have two levels.  If you wish to indicate that site is nested
within zone but estimate only fixed-effects for zone then you should
write the model as

aphids ~ densroot + zone + (1|zone:site)

This does give the six distinct levels for site within zone.

Using this model specification and the development version of lmer I
was able to fit models with densroot, vitality and totmas as
predictors.  A bit of exploratory graphics suggested the model

> m4 <- lmer(aphids~vitality*zone+(1|zone:site), aphids, family=quasipoisson)
> m4
Generalized linear mixed model fit by the Laplace approximation
Formula: aphids ~ vitality * zone + (1 | zone:site)
   Data: aphids
  AIC  BIC logLik deviance
 2437 2453  -1212     2425
Random effects:
 Groups    Name        Variance Std.Dev.
 zone:site (Intercept) 119.54   10.9334
 Residual               75.13    8.6678
Number of obs: 120, groups: zone.site, 6

Fixed effects:
                    Estimate Std. Error t value
(Intercept)           -1.224      6.422 -0.1905
vitality               5.173      2.011  2.5723
zoneinland            -8.935      9.714 -0.9198
vitality:zoneinland    9.868      4.746  2.0793

Correlation of Fixed Effects:
            (Intr) vitlty znnlnd
vitality    -0.252
zoneinland  -0.661  0.167
vtlty:znnln  0.107 -0.424 -0.424

or perhaps

> (m5 <- lmer(aphids~vitality*zone+(vitality|zone:site), aphids, family=quasipoisson))
Generalized linear mixed model fit by the Laplace approximation
Formula: aphids ~ vitality * zone + (vitality | zone:site)
   Data: aphids
  AIC  BIC logLik deviance
 2239 2261  -1112     2223
Random effects:
 Groups    Name        Variance Std.Dev. Corr
 zone:site (Intercept) 291.78   17.0815
           vitality    677.85   26.0355  -0.973
 Residual               29.52    5.4333
Number of obs: 120, groups: zone.site, 6

Fixed effects:
                    Estimate Std. Error t value
(Intercept)          -0.9467     9.7669 -0.0969
vitality              4.7625    14.8494  0.3207
zoneinland           -5.7539    14.0201 -0.4104
vitality:zoneinland   6.2250    21.1767  0.2940

Correlation of Fixed Effects:
            (Intr) vitlty znnlnd
vitality    -0.973
zoneinland  -0.697  0.678
vtlty:znnln  0.682 -0.701 -0.972


The enclosed plot was produced by

xyplot(sqrt(aphids) ~ vitality | zone, aphids, groups = site, type =
c("g", "p", "smooth"))
>  On Thu, Feb 14, 2008 at 10:36 AM, Martijn Vandegehuchte
>  <martijn.vandegehuchte at ugent.be> wrote:
>  > Dear R-users,
>  >
>  >  I'm new to R, so my apologies if this question doesn't make sense.
>  >
>  >  I've tried the following model in lmer, and it works perfectly:
>  >  model<-lmer(aphids~densroot+zone+(1|zone/site), family=quasipoisson)
>  >
>  >  But if I try the exact same model with a different variable, totmas, the model looks as follows:
>  >  model<-lmer(aphids~totmas+zone+(1|zone/site), family=quasipoisson)
>  >
>  >  Totmas is also a continuous variable just like densroot, but in this case I receive the following message:
>  >
>  >  CHOLMOD warning: &߆e
>  >  Error in objective(.par, ...) :
>  >   Cholmod error `matrix not positive definite' at file:../Supernodal/t_cholmod_super_numeric.c, line 613
>  >
>  >  Moreover, if I test yet another continuous variable "vitality", to my surprise R just crashes completely.
>  >
>  >
>  >  This is a mystery to me, especially because the variables totmas or vitality don't give any problem when I build the exact same models in SAS with proc glimmix...
>  >
>  >  Does someone have experience with this type of problem?
>  >
>  >  Thank you in advance,
>  >
>  >  Martijn.
>  >
>  >
>  >
>  >
>  >  --
>  >  Martijn Vandegehuchte
>  >  Ghent University
>  >  Department Biology
>  >  Terrestrial Ecology Unit
>  >  K.L.Ledeganckstraat 35
>  >  B-9000 Ghent
>  >  telephone: +32 (0)9/264 50 84
>  >  e-mail: martijn.vandegehuchte at ugent.be
>  >
>  >  website TEREC: www.ecology.ugent.be/terec
>  >
>  >         [[alternative HTML version deleted]]
>  >
>  >
>  > ______________________________________________
>  >  R-help at r-project.org mailing list
>  >  https://stat.ethz.ch/mailman/listinfo/r-help
>  >  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  >  and provide commented, minimal, self-contained, reproducible code.
>  >
>  >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aphids.pdf
Type: application/pdf
Size: 18230 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080215/4fcd3d07/attachment.pdf 


More information about the R-help mailing list