2

I want to run a linear mixed effects model with nested and random effects using lmer in R, but continue getting errors. Two questions: what is causing the errors and how can I fix my model to run the appropriate analyses? Thanks so much!

Experimental design: Four sites- each site has 2 plant species and 3 accessions for each plant species (6 accessions total). An accession is essentially a plant population and they are unique to a particular plant species. At each site, there are two treatments: plants given nitrogen enriched fertilizer and plants given nitrogen free fertilizer. All species and all accessions are present at every site. I collected data on plant growth and root traits and log-transformed variables as needed. I also set Accession (coded 1 - 6), Site (coded 1 - 4), and SoilN treatment (coded 1 and 2) as factors. All response variables are continuous.

Data structure:

Species Accession ID Site SoilN LeafNo LogLeaf Height NodNo SBMg
1 MESA 4 250975.1 1 1 15 1.178977 18.1 3 0.0876 2 MESA 4 250975.4 1 1 12 1.082785 18.6 3 0.0896 3 MESA 4 250975.4 1 1 20 1.303196 22.4 20 0.1395 4 MESA 4 250975.5 1 1 8 0.908485 18.4 2 0.0727 5 MESA 4 250975.2 1 2 57 1.756636 33.5 23 0.5665 6 MESA 4 250975.2 1 2 60 1.778874 44.8 61 0.5394

Model: I want to test the effects of treatment (SoilN), Species, and Accession on plant growth and root traits. I have been running two models- one for species and one for accession. I would like to test an interaction between species or accession and soil N, include site as a random effect, and nest accession within species. I wrote the following models:

 lf  <- lmer(LogLeaf ~ SoilN * Species   + (1|Species/Accession) + (1|Site), data=a)
 lf2 <- lmer(LogLeaf ~ SoilN * Accession + (1|Species/Accession) + (1|Site), data=a)

Output:

lf <- lmer(LogLeaf ~ SoilN * Species + (1|Species/Accession) + (1|Site), 
data = a)
Warning message:
   In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
   Model is nearly unidentifiable: large eigenvalue ratio
   - Rescale variables?`

summary(lf)
    Linear mixed model fit by REML 
    t-tests use  Satterthwaite approximations to degrees of freedom 
    ['lmerMod']
    Formula: LogLeaf ~ SoilN * Species + (1 | Species/Accession) + (1 | 
    Site)
    Data: a

REML criterion at convergence: 109.5

 Scaled residuals: 
     Min      1Q  Median      3Q     Max 
  -4.9162 -0.2557  0.1309  0.5600  1.5150 

 Random effects:
    Groups            Name        Variance Std.Dev.
    Accession:Species (Intercept) 0.004266 0.06531 
    Site              (Intercept) 0.046332 0.21525 
    Species           (Intercept) 0.038957 0.19738 
    Residual                      0.109152 0.33038 
    Number of obs: 140, groups:  Accession:Species, 6; Site, 4; Species, 2

 Fixed effects:
                    Estimate Std. Error        df t value Pr(>|t|)    
(Intercept)          0.90231    0.23405   0.00000   3.855   1.0000    
SoilN2               0.73319    0.07247 129.76000  10.117   <2e-16 ***
SpeciesTRPR         -0.45583    0.29753   0.00000  -1.532   1.0000    
SoilN2:SpeciesTRPR  -0.26846    0.11621 132.12000  -2.310   0.0224 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) SoilN2 SpTRPR
SoilN2      -0.166              
SpeciesTRPR -0.619  0.128       
SlN2:SpTRPR  0.102 -0.620 -0.223
convergence code: 0
Model is nearly unidentifiable: large eigenvalue ratio
    - Rescale variables?

anova(lf)
    Analysis of Variance Table of type III  with  Satterthwaite 
    approximation for degrees of freedom
                 Sum Sq Mean Sq NumDF  DenDF F.value  Pr(>F)    
  SoilN         11.5037 11.5037     1 132.11 105.392 < 2e-16 ***
  Species        0.4513  0.4513     1   0.00   4.135 0.99998    
  SoilN:Species  0.5825  0.5825     1 132.12   5.337 0.02243 *  
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?`

For the accession model (lf2), I get the following warnings:

lf2 <- lmer(LogLeaf ~ SoilN * Accession + (1|Species/Accession) + (1|Site), data = a) Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 1 negative eigenvalues

summary(lf2) Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned summary from lme4 is returned some computational error has occurred in lmerTest

anova(lf2) Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned anova from lme4 is returned some computational error has occurred in lmerTest Analysis of Variance Table Df Sum Sq Mean Sq F value SoilN 1 13.4357 13.4357 121.8414 Accession 5 0.3728 0.0746 0.6761 SoilN:Accession 5 0.8892 0.1778 1.6127 Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 1 negative eigenvalues

Other notes:

  1. The model runs if I nest Accession within Species within Site, although I'm not sure that's a correct way to analyze the data.

  2. It also runs if I don't nest Accession within Species, but still include Site and Accession as random effects.

  3. I do have some zeros in my data set because some of the plant died. I added data to determine whether the zeros were causing the issue, but continued to get errors.

  • 1
    Make sure when asking for help to provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). There is no variable named `LogLeaf` in your example data. Do you really only have 6 observations and you are trying to estimate all these parameters? That seems a bit statistically inappropriate. Maybe you should be asking for statistic help over at [stats.se] rather than programming help here. – MrFlick May 30 '17 at 14:17
  • Sorry about that. I'll fix it. – Nikki Forrester May 30 '17 at 14:44
  • I asked for help at Cross Validated, but was unable to fix the issues, so I figured I'd try here as well. Thanks for the tips! – Nikki Forrester May 30 '17 at 14:44
  • can you give the link to CrossValidated? – Ben Bolker May 30 '17 at 14:51
  • Sorry one more thing- I'm not trying to estimate parameters for 6 observations (I have several hundred observations). The 6 refers to specific plant populations that are unique to 2 plant species, so I want to nest the accessions within species to account for that. – Nikki Forrester May 30 '17 at 15:04
  • Cross validated link: https://stats.stackexchange.com/questions/281867/mixed-effects-model-with-random-and-nested-effects-in-lmer – Nikki Forrester May 30 '17 at 15:05

0 Answers0