1
$\begingroup$

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.

enter image description here

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))
$\endgroup$
1
  • 1
    $\begingroup$ Welcome to the site. What exactly is your question? Questions about code are off topic here, but it's not clear to me whether you are asking about code or statistics. $\endgroup$
    – Peter Flom
    Mar 23, 2020 at 12:37

1 Answer 1

0
$\begingroup$

Welcome to the site, Marcel. I believe your question is about whether the temperature variable, which does not vary within plots, can be examined in a mixed effects model. The answer is yes! This is one of the powerful aspects of mixed effects models - the ability to look at predictors that are measured at the occasion or individual unit level (e.g., SLA) as well as predictors measured at the group level (e.g., temperature).

The mixed effects model separates the variance in the outcome, herbivory, into within-plot and between-plot components. Predictors that vary at the plot level can only explain between-plot variance. Predictors that vary within-plots can explain both within- and between-plot variance because such predictors' average level might vary across plots. For example, if you were to take the SLA average for each plot, you will likely find plot-to-plot variation in the means. So SLA can explain both within- and between-plot variance in herbivory.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.