Page 316 - Applied Statistics with R
P. 316

316                              CHAPTER 14. TRANSFORMATIONS


                                 gala_model = lm(Species ~ Area + Elevation + Nearest + Scruz + Adjacent, data = gala)





                                 plot(fitted(gala_model), resid(gala_model), col = "dodgerblue",
                                      pch = 20, cex = 1.5, xlab = "Fitted", ylab = "Residuals")
                                 abline(h = 0, lty = 2, col = "darkorange", lwd = 2)















                                       150

                                       100
                                   Residuals  50  0







                                       -100


                                                0          100         200         300          400
                                                                   Fitted










                                 Even though there is not a lot of data for large fitted values, it still seems very
                                 clear that the constant variance assumption is violated.



                                 boxcox(gala_model, lambda = seq(-0.25, 0.75, by = 0.05), plotit = TRUE)
   311   312   313   314   315   316   317   318   319   320   321