September 2018
Beginner
206 pages
4h 27m
English
As we observed in the factor variable example, the function defaults to certain types of plots depending on the kind of data you put into it. If you were to input a linear model object, plot() automatically returns four helpful model diagnostic plots, including the Residuals versus Fitted and Normal Q-Q plots, which help you determine whether your model fits well. The following code demonstrates this:
mtcars_lm <- lm(mpg ~ wt, data = mtcars)plot(mtcars_lm)
The process of generating all four of these plots is somewhat tedious, however, so instead, let's look at plotting more than one plot at a time, combined with model object plotting.
Read now
Unlock full access