I want to analyze some data from an experimental study with 3 factors: treatN= nutrient manipulation 2levels N=nutrients added, A=ambient (fixed effect)
treatH= herbivory manipulation 3 levels C=ambient, H=moderate herbivory, HH=high herbivory (fixed effect)
Factor S= performed in 2 sites A and B(random effect)
I measured some response variables at the end of the experiment (area, necro...) I want to perform a three way anova or any glm with mixed effects and with treat N and treatH nested in Factor S.
Q1:I used the package lmerTest, is this the right code?
m2 = lmer(area~ treatN*treatH + (1|FactorS) , data=data)
Q2:I assume that lmer is a glm and thus the errors don´t need to be normal? If not how can I test this?
Q3: I tried glm models
m4=glm(area ~ treatN*treatH + (1|FactorS), data=data, family=Gamma (link=identity))
but I get an error
*tmp*, value = contr.funs[1 + isOF[nn]]) :contrasts can be applied only to factors with 2 or more levels
In addition: Warning message:
In Ops.factor(1, FactorS) : ‘|’ not meaningful for factors
how can I solve it?