[R] NaNs in Nested Mixed Model

Johan Stenberg jonstg at gmail.com
Tue Mar 8 16:51:43 CET 2011


Dear R users,

I have a problem with something called "NaNs" in a nested mixed model.

The background is that I have studied the number of insect nymphs
emerging from replicated Willow genotypes in the field. I have 15
replicates each of 4 Willow genotypes belonging two 2 Willow species.
Now I want to elucidate the effect of Willow genotype on the number of
emerging nymphs. Previously I performed a simple one-way anova with
"genotype" as explanatory factor and "number of nymphs emerging" as
dependent variable, but the editor of the journal I've submitted this
piece to wants me to nest Willow genotype within Willow species before
he accepts the paper for publication [Species*Genotype(Species)].

The fact that I didn't include "Willow species" as a factor in my
initial analysis reflects that I am not very interested in the species
factor per se - I am just interested in if genetic variation in the
host plant is important, but "species" is of course a factor that
structures genetic diversity.

I thought the below model would be appropriate:

> model<-lme(Nymphs~Species*Genotype,random=~1|Species/Genotype)

...but I then get the error message "Error in MEEM(object, conLin,
control$niterEM) : Singularity in backsolve at level 0, block 1"

I then tried to remove "Genotype" from the fixed factors, but then I
get the error message "NaNs produced".

> model<-lme(Nymphs~Species,random=~1|Species/Genotype)
> summary(model)
Linear mixed-effects model fit by REML
 Data: NULL
       AIC      BIC    logLik
  259.5054 269.8077 -124.7527

Random effects:
 Formula: ~1 | Species
        (Intercept)
StdDev:   0.9481812

 Formula: ~1 | Genotype %in% Species
        (Intercept) Residual
StdDev:   0.3486937 1.947526

Fixed effects: Nymphs ~ Species
                 Value Std.Error DF   t-value p-value
(Intercept)   2.666667  1.042243 56  2.558585  0.0132
Speciesviminalis -2.033333  1.473954  0 -1.379510     NaN
 Correlation:
             (Intr)
Speciesviminalis -0.707

Standardized Within-Group Residuals:
       Min         Q1        Med         Q3        Max
-1.4581821 -0.3892233 -0.2751795  0.3439871  3.1630658

Number of Observations: 60
Number of Groups:
          Species Genotype %in% Species
            2             4
Warning message:
In pt(q, df, lower.tail, log.p) : NaNs produced
***********

Do you have any idea what these error messages mean in my case and how
I can get around them?

Thank you on beforehand! (data set attached).

Johan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.pdf
Type: application/pdf
Size: 30894 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110308/17f9eaeb/attachment.pdf>


More information about the R-help mailing list