O'Reilly logo

R Data Visualization Cookbook by Atmajitsinh Gohil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Plotting a regression line

All of us have studied regressions or at least heard about them in newspapers or journal articles. Regression lines are a visual representation of the regression equation. Gareth, Witten, Hastie, and Tibshirani in the book An Introduction to Statistical Learning, have defined a simple linear regression as, "it is a very straightforward approach for predicting a quantitative response Y on the basis of a single predictor variable X. It assumes that there is approximately a linear relationship between X and Y". Readers should refer to chapter 3 of that book to learn the concept of linear regression and its application using R.

From the preceding plot, we observe that horsepower has a negative relationship with miles per ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required