There are two functions in R that seems almost similar yet different:
fitted()
predict() First let’s prepare some data first.
# Packages library(dplyr) # Data set.seed(123) dat <- iris %>% mutate(twoGp = sample(c("Gp1", "Gp2"), 150, replace = T), #create two group factor twoGp = as.