I need to test which effects I should include in my model for genetic evaluation of cows. In SAS I would use a proc GLM. The SAS code would be:
data paula1; set paula0;
proc glm;
class year herd season;
model milk= year herd season age age*age;
run;
My R code is:
model1 = glm(milk ~ factor(year) + factor(herd) + factor(season) + age + I(age^2), data=paula1)
anova(model1)
I suspect that there is something wrong because all effects are statistically significant, even when I include other effects that are not related to the trait. I do not have a SAS license anymore to compare the results. Is my code in R correct? Does glm in R presents the type 3 sum of squares (for unbalanced data as presented in SAS)? Is there any difference in this case for using lm? Thanks in advance. Paula