I want to run a mixed effect model to test the effect of temperature and SLA on Herbivory. In my case, the random factor is plot
since my samples are nested within this grouping factor. Each plot has a certain temperature, thus, for each random factor level, one temperature value exists (see boxplot). My question is if this is a general issue. I am quite new to mixed effects and lme4 but I was thinking that singularity might be a problem since my variation (of at least one variable) within the random factor levels is zero. It somehow appears to me that I am using the "same" variable twice.
plot <- rep(c("BO1", "BO2", "BO3", "CA1", "CA2", "CA3", "SF1", "SF2", "SF3"), 5)
temperature <- rep(rnorm(9, 20), 5)
SLA <- rnorm(45, 150)
herbivory <- rnorm(45, 50)
test <- as.data.frame(cbind(plot,temperature,SLA,herbivory))
test$SLA <- as.numeric(as.character(test$SLA))
test$temperature <- as.numeric(as.character(test$temperature))
test$herbivory <- as.numeric(as.character(test$herbivory))
boxplot(test$temperature ~ test$plot)
library("lme4")
summary(lmer(herbivory ~ SLA + temperature + (1 | plot), data = test))