0

I was asked to build a mixed effect model using 'lmer' and 'lmerTest'. The data is shown below: First 8 rows of the data, it's about how pollination, herbivory and plant defense(HCN) may alter flower traits

The full Question is : "Use the lme4 and lmerTest R packages to run a linear mixed-effects model examining how herbivores (Herbivory), pollinators (Pollination), plant defences (HCN) and all interactions influence the length of banner petals (Avg.Bnr.Wdth) produced by plants while accounting for variation due to spatial block and plant genotype. Allow the intercept for Genotype to vary across the levels of the herbivory treatment (Hint: are Genotype and Herbivory crossed or nested?)"

My attempt to build a model:

model_2a <- lmer(data = plant_data, Avg.Bnr.Wdth ~ Herbivory * Pollination +
                   Herbivory * HCN +
                   Pollination * HCN +
                   (1|Block) +
                   (1|Genotype))
summary(model_2a)

However, the output is odd:

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.7400 -0.5967  0.0692  0.6326  3.2019 

Random effects:
 Groups   Name        Variance Std.Dev.
 Genotype (Intercept) 0.068569 0.2619  
 Block    (Intercept) 0.003272 0.0572  
 Residual             0.046580 0.2158  
Number of obs: 595, groups:  Genotype, 49; Block, 6

Fixed effects:
                                   Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)                        3.270378   0.062366  58.163245  52.438   <2e-16 ***
HerbivoryReduced                   0.005644   0.031429 540.971084   0.180   0.8575    
PollinationSupp                   -0.051416   0.031547 538.253166  -1.630   0.1037    
HCNYes                            -0.110019   0.081633  58.795573  -1.348   0.1829    
HerbivoryReduced:PollinationSupp   0.013405   0.036148 539.473352   0.371   0.7109    
HerbivoryReduced:HCNYes            0.062927   0.036135 539.454401   1.741   0.0822 .  
PollinationSupp:HCNYes             0.071009   0.035959 539.235883   1.975   0.0488 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) HrbvrR PllntS HCNYes HrR:PS HR:HCN
HerbvryRdcd -0.262                                   
PollintnSpp -0.246  0.328                            
HCNYes      -0.640  0.132  0.117                     
HrbvryRd:PS  0.150 -0.589 -0.609  0.001              
HrbvrR:HCNY  0.156 -0.581  0.012 -0.241  0.022       
PllntS:HCNY  0.133  0.038 -0.536 -0.214 -0.021 -0.036

First. I have no idea how to "vary the Genotype intercept across the Herbivory treatment."

Second. Why it's "HerbivoryReduced","PollinationSupp" in the output, I tried to as.factor Pollination, Herbivory and HCN, but it still shows the same thing

Sam Chen
  • 31
  • 1
  • is the only thing that's "odd" about the output the appearance of "HerbivoryReduced","PollinationSupp" in the output? This is part of the standard behaviour of linear models in R: https://stackoverflow.com/questions/41032858/lm-summary-not-display-all-factor-levels – Ben Bolker Oct 17 '22 at 01:09
  • I mean, "Herbivory," "Pollination" and "HCN" all have more than one level (e.g. ambient vs. reduced on Herbivory), I wonder what happened to other levels – Sam Chen Oct 17 '22 at 01:21
  • Did you read the link in my comment? – Ben Bolker Oct 17 '22 at 12:21

0 Answers0