Forums | OpenR
OpenR: R & Statistics
/
A question about anova when removing unnecessary covariate
16 March 2022, 4:30 PM
In the web material of anova given by group week 3, there is a part of codes:
---------------------------------------------------------------------------------------
#Delete the grazing factor
ancova3 <- update(ancova2, ~ . - df1$Grazing)
#Compare the two models
anova(ancova2,ancova3)
#"p is too smaller than 0.05, removing the Grazing factor causes a huge change to the model.
The effect of grazing on fruit production is highly significant and needs to be retained in the model.
Thus, ancova2 is the minimal adequate model."
-----------------------------------------------------
I am not fully understand what does it mean by "removing the Grazing factor". In my point of view,
ancova2 <- update(ancova, ~ . - df1$Grazing:df1$Root) |||<-this code may express a "pan(平移) moving"
between df1$Grazing:df1$Root, for example , to measure the relations between attendence frequency and sports mark,
while the gender may have an influence on it (e.g. boys get 2marks higher in the sports on average).
ancova3 <- update(ancova2, ~ . - df1$Grazing) ||| <- But when referring to this code, I can't quite understand.
Could someone tell me the meaning of it? It will be very appreciated.
16 March 2022, 6:24 PM
ancova <- lm(df1$Fruit~df1$Grazing*df1$Root)
ANDdf1$Grazing*df1$Root=df1$Grazing+df1$Root+df1$Grazing:df1$Root
df1$Grazing:df1$Root means the interaction between Grazing and Root
ancova2 <- update(ancova, ~ . - df1$Grazing:df1$Root)=lm(df1$Fruit~df1$Grazing+df1$Root)
This step means to remove the interaction between Grazing and Root
ancova3 <- update(ancova2, ~ . - df1$Grazing)=lm(df1$Fruit~df1$Root)
This step just want to show you if the "Grazing" was removed, was the model changed? In other word, this step just want to test if there is significant difference between model ancova2 and ancova3.
anova(ancova2,ancova3) we know that there is significant difference between
Then with the codemodel ancova2 and ancova3.
So we should not removethe "Grazing", and we should choose model ancova2 but not ancova3.
16 March 2022, 7:44 PM
Thank you very much! May I also wonder what is the difference between
1. remove the interaction between Grazing and Root
and
2. remove the "Grazing" .
For the first one, in a lively way, my understanding is that remove the interaction between Grazing and Root is to "move" the
the value of dependent valuable of the two groups seperated by the covariate (e.g. gender). But based on this, what does that
mean to "remove a covariate?"
Sincerely
16 March 2022, 8:43 PM
I suggest you to go back to “Analysis of covariance (ANCOVA)” 1.4.2 Explain,
and read the 6 plots to understand what is "variables interfere with each other"
16 March 2022, 10:24 PM
Apart from what Shanxing suggested, you could also check the concept of interaction which was introduced in Week 11 of ENV221, especially "Figure 11.1: The concept of interaction".