Introduction to Regression in R
Richie Cotton
Data Evangelist at DataCamp
Bream: the "good" model
mdl_bream <- lm(mass_g ~ length_cm, data = bream)
Perch: the "bad" model
mdl_perch <- lm(mass_g ~ length_cm, data = perch)
Bream
Perch
Bream
Perch
library(ggplot2)
library(ggfortify)
autoplot(model_object, which = ???)
Values for which
1
residuals vs. fitted values2
Q-Q plot3
scale-locationautoplot(
mdl_perch,
which = 1:3,
nrow = 3,
ncol = 1
)
Introduction to Regression in R