# ANOVA, ANCOVA, linear mixed effect model

I experimentally tested the relation between dependent variable $$y$$ (continuous) and independent variable $$x$$ (continuous) for $$10$$ replicates of $$2$$ plant varieties (categorical) of $$3$$ species (categorical) each (Variable $$A$$) that were grown in $$3$$ differently pre-treated soils (categorical, Variable $$B$$). The experiment was conducted in different greenhouses (GH) at the same time whereby the plant-soil combinations were distributed randomly.

I primarily want to know if the relation between y and x differs between soils. I also want to know if it differs between the two plant varieties per species when they were grown in the same soil. I want to account for the greenhouse as potential random effect.

Do I conduct:

1. An ANOVA like: lm(y ~ x + A*B, data = dat)
2. An ANCOVA? And how?
3. A linear mixed effect model like: lme(y ~ x + A * B, random = ~ 1 | GH, data = dat)
• How many plants do you have here? Not the plant varieties but the total number of plants. Feb 15 at 8:58
• 10 reps x 2 varieties per species x 3 species x 3 soil treatments = 180 plants Feb 15 at 9:01

Option 1 and 2 are a no-go because your observations are clearly non-independent given the repeated measures. Option 3 looks the best to me. I prefer using lme4 for mixed models, and the code for that in R would be:

fit <- lmer(y ~ X + Species * Treatment + (1|plant), data = data)


This would fit the fixed effects of species and treatment with their interaction along with the covariate $$x$$, while estimating the random intercepts of each plant (because of the repeated measures). I'm not sure how variety changes things in species, but I noticed that wasn't included. Not sure if that was on purpose or not.

A few side notes...its not clear what $$x$$ or $$y$$ is here. Depending on the residuals, you may need to change your error term for this model if it is something like a count variable or binary ($$y = [0,1]$$). In terms of greenhouse effects, I'm guessing you mean that your plants were housed in different sites based on your question. If that is the case, you may need to nest your random effects in a hierarchical model like this:

fit <- lmer(y ~ X + Species * Treatment + (1|site/plant), data = data)


Which estimates the random intercepts of plants within sites where the plants were grown.

• Thank you, Shawn! That sounds good to me but I am considering to replace Species with Variety. Species would be something like tomato, cucumber, and carrot and Variety the specific genotypes. I do not want to compare how y in tomato delt with the increase x compared to cucumber but I want to compare the two specific tomato genotypes. Y is a measure of plant growth while X represents a step-wise increase in temperature (= 5-6 levels) at which Y was measured. At the time-point of measuring Y, X was always slightly different depending on the greenhouse. Feb 16 at 8:31
• You can model whatever variables that you want, just needs to fit with whatever you are trying to investigate scientifically. Main thing is that you don't want to introduce any unnecessary confounding in the analysis, so if there is clearly some issue with including/discluding species over variety then I would consider that for the analysis. Otherwise I don't see the issue. Feb 16 at 11:17
• Alright, thank you for your help! :) Feb 19 at 9:19