'ANOVA and Blocking Design

I have a field experiment carried out with trees in which we have planted different genotypes in a little plantation following a randomized complete block design (RCBD). Now I want to do the analysis in R but I have some doubts about how to do it. In a nutshell, I have 3 blocks and 5 genotypes, in addition to several variables we've measured, one of those is HEIGHT. The code I am using to do the ANOVA test is:

fit <- lm(HEIGHT~GENOTYPE+BLOCK,data=data)

anova(fit)

In some webpages I've seen that they write:

lm(HEIGHT~BLOCK+GENOTYPE,data=data)

I don't know which is exactly the difference but I've tried both linear models (lm) and the results are not the same. The question is very simple: why? What is exactly what I'm telling to R when I write "Height~Genotype+Block" and when I'm telling "Height~Block+Genotype"? The other question is: Am I doing the blocking ANOVA correctly?

Thank you very much in advance!!

r


Solution 1:[1]

When using lm, the block should be placed after the main effect under study in the model since you want to determine how much of the total variation is described by the main effect with respect to the blocking factor. If you place the the blocking factor first, it would actually functions as a main effect and the GENOTYPE effect would become a blocking factor.

You can also perform the same analysis using aov() function with the code below, but in such case, you should place the blocking effect first followed by the main effect because of the sequential sum of squares applied in aov.

fit <- aov(HEIGHT ~ BLOCK + GENOTYPE, data=data)

summary(fit)

Meaning that the genotype main effect is tested in presence of the block effect.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 patL