# NOT RUN {
# Linear regression example
data(trees)
model <- lm(Volume ~ Girth + Height, data=trees)
residual_plot(model)
model2 <- lm(Volume ~ Girth + I(Girth^2) + Height, data=trees)
residual_plot(model2)
# Add extra information about points by adding geom_text to the object produced
m <- lm(mpg ~ hp + factor(vs), data=mtcars)
residual_plot(m) + ggplot2::geom_point(ggplot2::aes(color=factor(cyl)), data=mtcars)
# }
Run the code above in your browser using DataLab