Section 16 Two-way ANOVA: function lm
16.1 lm
We can fit a linear model using the function
lm
Fit a linear model using the function
lm
to compare if there is a difference between Groups.Examine the R object of the
lm
outputs.Note: It is crucial to convert the grouping variable into a factor before running the ANOVA analysis. This is the key difference between an ANOVA analysis and a regression analysis, and the results could be very misleading if this step is not performed.