[R-sig-ME] error message

Ben Bolker bbolker at gmail.com
Wed Nov 28 05:12:09 CET 2012


Lip Khoon Kho <klipkhoon at ...> writes:

> 
> Hi all,
> 
> I've just started with glmm and have been working on my data for soil
> respiration. The data is a continuous soil respiration measured over time
> on different treatments (Control, Litter, Root, SOM, and Myc). I've made a
> reproducible sample subset of data.
> 
sample.glmm2<-structure(list(Rep = structure(c(1L, 1L, 2L, 3L, 2L, 3L, 2L,
1L, 1L, 1L, 2L, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("T1",
"T2", "T3"), class = "factor"), Port = c(4L, 4L, 3L, 2L, 1L,
4L, 4L, 1L, 3L, 4L, 2L, 2L, 4L, 4L, 3L, 4L, 3L, 1L, 3L, 3L),
    Time = c(40103.23538, 40196.53689, 40015.52118, 40191.30837,
    40131.5086, 40191.21449, 40130.82421, 40146.25, 40071.55473,
    40101.5565, 40132.45973, 40136.52361, 40065.7656, 40056.5364,
    40142.20439, 40032.0448, 40075.73726, 40011.48273, 40143.37164,
    40122.35059), Lin_Flux = c(4.69, 2.4, 7.87, 11.05, 6.94,
    7.2, 3.33, 7.92, 5.28, 4.83, 1.95, 8.29, 9.79, 6.74, 1.37,
    4.95, 2.37, 7.24, 1.73, 2.33), temp = c(24.661, 22.555, 25.993,
    24.59, 24.21, 23.784, 25.991, 22.719, 25.75, 24.992, 25.057,
    25.977, 26.015, 26.558, 23.837, 25.742, 22.652, 25.096, 24.186,
    25.561), Moist = c(53.12073034, 73.17318785, 10.85104703,
    32.32684789, 68.78023321, 47.22009228, 70.96981555, 252.2126268,
    60.74723213, 49.6945396, 61.99900286, 60.96778851, 45.67500636,
    48.84389487, 80.87678452, 43.51131005, 65.55899378, 3.546478647,
    77.23567152, 64.29384304), Lit = c(0L, 0L, 0L, 0L, 1L, 0L,
    0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L),
    Root = c(1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 0L,
    1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L), SOM = c(1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L), Myc = c(1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L,
    0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)), .Names = c("Rep", "Port",
"Time", "Lin_Flux", "temp", "Moist", "Lit", "Root", "SOM", "Myc"), 
row.names = c(7031L, 2139L, 28270L, 30410L, 18838L, 30448L,
19109L, 2343L, 10930L, 7714L, 18455L, 32126L, 36769L, 24979L,
3783L, 14847L, 9266L, 17254L, 3313L, 5315L), class = "data.frame")
> 
> As for the Litter, SOM, Myc, and Root - 1 denotes respiration contribution
> to Lin_Flux, while 0 denotes that the components does not contribute to
> Lin_Flux.
> 
> I've tried to fit a model for Rep (repilcate) and Time as random effects
> using lmer. For example:
>

library(lme4)
glmm.model1 <- lmer(Lin_Flux ~ temp + Moist + Port + Lit + Root +
 (Time|Rep), data=sample.glmm2)
 
> I obtained output. However, when i try to include SOM and Myc, as follow:
> 

glmm.model1 <- lmer(Lin_Flux ~ temp + Moist + Port + Lit + Root + SOM + Myc +
 (Time|Rep), data=sample.glmm2)

With the most recent development version:

  ## rank of X = 6 < ncol(X) = 8

mm <- model.matrix(~ temp + Moist + Port + Lit + Root + SOM + Myc - 1,
data=sample.glmm2)

image(cov2cor(var(mm[,-1])))

summary(mm[,"SOM"])

  All of your SOM values are identical!
  You may find svd() useful as well.

mm2 <- model.matrix(~ temp + Moist + Port + Lit + Root +  Myc ,
data=sample.glmm2)

  Works fine without SOM.
> 
> I get error message:
> Error in mer_finalize(ans) : Downdated X'X is not positive definite, 6.
> 
> Is this due to singularity?
> If so, is there a way to go around this? I've come across a few of these
> problems - and perhaps the way to do this is to remove the singularities?
> Does this mean, to remove the predictor?


  As a side point, you shouldn't use "family" with lmer.



More information about the R-sig-mixed-models mailing list